From b75db3f6fbc91dbfabb2fa792fcb1297fafecbc3 Mon Sep 17 00:00:00 2001 From: Sungju Date: Mon, 29 Jun 2026 15:32:46 +0900 Subject: [PATCH 1/6] =?UTF-8?q?feat(drift):=20UNVERIFIED=5FAC=20multi-fram?= =?UTF-8?q?ework=20test=5Fref=E2=86=94testcase=20matching=20(closes=20#203?= =?UTF-8?q?)=20(#204)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(drift): UNVERIFIED_AC — verify test_refs ran and passed via JUnit XML (F-96700032) UNTESTED_AC only checks that a done AC's test_refs EXIST on disk — an empty file, a test.skip, or a failing test all satisfied the gate, so the chain stopped at "AC → named file", not "AC → observed pass". UNVERIFIED_AC closes that gap when a JUnit XML report is available. - New detector UNVERIFIED_AC (src/stages/detectors/unverified-ac.ts) + a pure regex JUnit parser (src/stages/junit-report.ts, no XML dependency, mirroring the coverage-XML approach). Report path comes from gate.test_report in .cladding/config.yaml or a conventional default; failing/errored or only-skipped test_refs are an error, absent ones a warn (--strict promotes). - Graceful by default: no report present → emits nothing, leaving UNTESTED_AC's existence check as the baseline, so non-JUnit projects are unaffected. - Registered in detectors/index.ts (count auto-recomputed 37→38); catalog + self-consistency detector-count claims bumped to 38. Co-Authored-By: Claude Opus 4.8 * feat(drift): UNVERIFIED_AC multi-framework test_ref↔testcase matching (F-d980359c) UNVERIFIED_AC's matcher was effectively vitest-only — it keyed every testcase by `classname` and assumed that was a file path. pytest (`tests.test_foo`), Java/Kotlin FQCN (`com.example.FooTest`), and `file=`-attribute emitters never matched, so a passing test read as `absent` (a false positive under --strict) and a real fail/skip was mis-reported as "did not run". - parse: index each testcase under every path-shaped key it yields — the `file=` attribute, the `classname` as-is, and a dot→slash conversion of a dotted (no-separator) classname — sharing one accumulator (no double count). - lookup: extension-agnostic exact/suffix match (`FooTest` ↔ `FooTest.kt`). - detector: confident-or-degrade — a report with no path-like keys (e.g. jest describe-title classnames) is unmappable, so emit nothing instead of flooding false `absent` findings (preserves the low-false-positive contract). Measured A/B (OLD = classname-only): correct verdicts across a vitest/pytest/Kotlin/jest matrix 2/8 → 8/8; parse cost on a 10k-case report +1.6ms (vitest) … +7.8ms (pytest) per gate run — noise vs the ~50s gate. Blind-authored tests (tests/stages/junit-multiframework.test.ts) cover all 5 ACs. Existing UNVERIFIED_AC tests stay green (backward compatible). Co-Authored-By: Claude Opus 4.8 --------- Co-authored-by: Claude Opus 4.8 --- AGENTS.md | 2 +- CHANGELOG.md | 34 ++ docs/project-context.md | 2 +- .../claude-code/.claude-plugin/plugin.json | 4 +- plugins/claude-code/dist/clad.js | 560 +++++++++--------- spec.yaml | 8 +- spec/attestation.yaml | 50 +- spec/capabilities.yaml | 2 +- ...unit-multiframework-matching-d980359c.yaml | 42 ++ .../unverified-ac-junit-96700032.yaml | 51 ++ spec/index.yaml | 2 + src/stages/detectors/README.md | 3 +- src/stages/detectors/index.ts | 2 + src/stages/detectors/unverified-ac.ts | 115 ++++ src/stages/junit-report.ts | 123 ++++ src/stages/toolchain/gate-config.ts | 11 +- tests/stages/junit-multiframework.test.ts | 136 +++++ tests/stages/unverified-ac.test.ts | 110 ++++ 18 files changed, 942 insertions(+), 315 deletions(-) create mode 100644 spec/features/junit-multiframework-matching-d980359c.yaml create mode 100644 spec/features/unverified-ac-junit-96700032.yaml create mode 100644 src/stages/detectors/unverified-ac.ts create mode 100644 src/stages/junit-report.ts create mode 100644 tests/stages/junit-multiframework.test.ts create mode 100644 tests/stages/unverified-ac.test.ts diff --git a/AGENTS.md b/AGENTS.md index 8ea4f59f..df9d2bdb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,7 +4,7 @@ This file is the cross-tool entry point for any AI coding agent working on cladd ## 1. Project -cladding is the reference implementation of the [Ironclad](https://github.com/qwerfunch/ironclad) standard. Multi-agent dev harness; 15 Iron Law stages; 37 drift detectors; polyglot toolchain (9 languages). Successor to harness-boot. +cladding is the reference implementation of the [Ironclad](https://github.com/qwerfunch/ironclad) standard. Multi-agent dev harness; 15 Iron Law stages; 38 drift detectors; polyglot toolchain (9 languages). Successor to harness-boot. ## 2. Setup diff --git a/CHANGELOG.md b/CHANGELOG.md index f1555087..a90b83ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,40 @@ Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added + +- **`UNVERIFIED_AC` drift detector — AC → test → *observed pass*** (`F-96700032`) + — closes the one soft spot in the otherwise execution-based gate. `UNTESTED_AC` + only checks that a done AC's `test_refs` *exist on disk*, so an empty file, a + `test.skip`, or a failing test still satisfied it. When a JUnit XML report is + available — `gate.test_report` in `.cladding/config.yaml`, or a conventional + path (`test-report.junit.xml`, `coverage/junit.xml`, `.cladding/test-report.junit.xml`) + — `UNVERIFIED_AC` confirms each done AC's referenced tests actually **ran and + passed**: failing/errored or only-skipped tests are an `error`, and a test_ref + absent from a present report is a `warn` (a scoped/partial run is legitimate; + `--strict` promotes it). **Graceful by default:** with no report present the + detector emits nothing, leaving `UNTESTED_AC`'s existence check as the baseline, + so projects that don't emit JUnit XML are unaffected. Parsing is pure and + regex-based (no XML dependency), mirroring the coverage-XML approach. + +- **`UNVERIFIED_AC` multi-framework `test_ref`↔testcase matching** (`F-d980359c`) + — the matcher was effectively vitest-only: it keyed every testcase by its + `classname` and assumed that was a file path. pytest (`tests.test_foo`), + Java/Kotlin (`com.example.FooTest`), and `file=`-attribute emitters therefore + never matched, so a *passing* test read as **`absent`** (a false positive under + `--strict`) and a *real* fail/skip was mis-reported as "did not run". The + parser now indexes each testcase under every path-shaped key it can derive + (the `file=` attribute, the `classname` as-is, and a dot→slash conversion of a + dotted classname) and matches `test_refs` **extension-agnostically** + (`FooTest` ↔ `FooTest.kt`). **Confident-or-degrade:** a report whose keys are + none path-like (e.g. jest describe-title `classname`s that cannot be mapped to + files) is treated as unmappable and the detector emits nothing, rather than + flooding false `absent` findings — preserving the low-false-positive contract. + Measured A/B (OLD = `classname`-only): correct verdicts across a + vitest/pytest/Kotlin/jest matrix went **2/8 → 8/8**; parse cost on a 10k-case + report grew by ~1.6 ms (vitest-shaped) to ~7.8 ms (pytest-shaped) per gate run + — noise against the ~50 s gate. + ## [0.6.3] — 2026-06-26 — Honest Status **In one line:** the one-line-per-feature index that agents grep (and that feeds diff --git a/docs/project-context.md b/docs/project-context.md index d802d67c..3da0d545 100644 --- a/docs/project-context.md +++ b/docs/project-context.md @@ -18,7 +18,7 @@ The 4-tier SSoT model (Tier A spec sealed → Tier B design editable → Tier C ## 3. What is its purpose? -To make AI-coupled development **measurably safer and more honest** than vanilla AI coding. Honest = drift becomes visible; measurable = 37 detectors fire actionable findings; safer = the Iron Law gates fail CI when artifacts diverge from code reality. +To make AI-coupled development **measurably safer and more honest** than vanilla AI coding. Honest = drift becomes visible; measurable = 38 detectors fire actionable findings; safer = the Iron Law gates fail CI when artifacts diverge from code reality. ## Related governance documents diff --git a/plugins/claude-code/.claude-plugin/plugin.json b/plugins/claude-code/.claude-plugin/plugin.json index c26c0664..3a1a97c9 100644 --- a/plugins/claude-code/.claude-plugin/plugin.json +++ b/plugins/claude-code/.claude-plugin/plugin.json @@ -41,12 +41,12 @@ "spec-fetched": "2026-05-18", "target": { "iron-law": "L4", - "detectors": "37/37", + "detectors": "38/38", "ears": "full" }, "current": { "iron-law": "L4", - "detectors": "37/37", + "detectors": "38/38", "ears": "syntactic", "phase": "L21.12 — Territory → Integrity Panel rename (vocab anchored to Trinity of Integrity)", "stages-implemented": ["stage_1.1", "stage_1.2", "stage_1.3", "stage_1.4", "stage_1.5", "stage_1.6", "stage_2.1", "stage_2.2", "stage_2.3", "stage_2.4", "stage_3.1", "stage_3.2", "stage_3.3", "stage_4.1", "stage_4.2"], diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 10062c0e..37fcee6d 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,102 +4,102 @@ const require = __claddingCreateRequire(import.meta.url); // Marker for stages/*.ts: when true, the per-stage CLI-entry guard // short-circuits so the bundle doesn't fire every stage at startup. globalThis.__CLADDING_BUNDLED = true; -var Qoe=Object.create;var K0=Object.defineProperty;var ese=Object.getOwnPropertyDescriptor;var tse=Object.getOwnPropertyNames;var rse=Object.getPrototypeOf,nse=Object.prototype.hasOwnProperty;var Le=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Sr=(t,e)=>{for(var r in e)K0(t,r,{get:e[r],enumerable:!0})},ise=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of tse(e))!nse.call(t,i)&&i!==r&&K0(t,i,{get:()=>e[i],enumerable:!(n=ese(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Qoe(rse(t)):{},ise(e||!t||!t.__esModule?K0(r,"default",{value:t,enumerable:!0}):r,t));var qu=v(Y0=>{var Rh=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},J0=class extends Rh{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Y0.CommanderError=Rh;Y0.InvalidArgumentError=J0});var Ch=v(Q0=>{var{InvalidArgumentError:ose}=qu(),X0=class{constructor(e,r){switch(this.description=r||"",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.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new ose(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function sse(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}Q0.Argument=X0;Q0.humanReadableArgName=sse});var rk=v(tk=>{var{humanReadableArgName:ase}=Ch(),ek=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>ase(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` -`)}displayWidth(e){return vL(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return utypeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Sr=(t,e)=>{for(var r in e)X0(t,r,{get:e[r],enumerable:!0})},yse=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of mse(e))!gse.call(t,i)&&i!==r&&X0(t,i,{get:()=>e[i],enumerable:!(n=pse(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?fse(hse(t)):{},yse(e||!t||!t.__esModule?X0(r,"default",{value:t,enumerable:!0}):r,t));var Zu=v(ek=>{var Nh=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},Q0=class extends Nh{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};ek.CommanderError=Nh;ek.InvalidArgumentError=Q0});var jh=v(rk=>{var{InvalidArgumentError:_se}=Zu(),tk=class{constructor(e,r){switch(this.description=r||"",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.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new _se(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function vse(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}rk.Argument=tk;rk.humanReadableArgName=vse});var ok=v(ik=>{var{humanReadableArgName:bse}=jh(),nk=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>bse(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` +`)}displayWidth(e){return wL(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return u{let a=s.match(i);if(a===null){o.push("");return}let c=[a.shift()],l=this.displayWidth(c[0]);a.forEach(u=>{let d=this.displayWidth(u);if(l+d<=r){c.push(u),l+=d;return}o.push(c.join(""));let f=u.trimStart();c=[f],l=this.displayWidth(f)}),o.push(c.join(""))}),o.join(` -`)}};function vL(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}tk.Help=ek;tk.stripColor=vL});var sk=v(ok=>{var{InvalidArgumentError:cse}=qu(),nk=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=lse(e);this.short=n.shortFlag,this.long=n.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,this.helpGroupHeading=void 0}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),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}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new cse(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?bL(this.name().replace(/^no-/,"")):bL(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},ik=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function bL(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function lse(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} +`)}};function wL(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}ik.Help=nk;ik.stripColor=wL});var lk=v(ck=>{var{InvalidArgumentError:Sse}=Zu(),sk=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=wse(e);this.short=n.shortFlag,this.long=n.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,this.helpGroupHeading=void 0}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),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}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new Sse(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?xL(this.name().replace(/^no-/,"")):xL(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},ak=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function xL(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function wse(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} - a short flag is a single dash and a single character - either use a single dash and a single character (for a short flag) - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a} - too many short flags`):i.test(s)?new Error(`${a} - too many long flags`):new Error(`${a} -- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}ok.Option=nk;ok.DualOptions=ik});var wL=v(SL=>{function use(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function dse(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=use(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` +- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}ck.Option=sk;ck.DualOptions=ak});var kL=v($L=>{function xse(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function $se(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=xse(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` (Did you mean one of ${n.join(", ")}?)`:n.length===1?` -(Did you mean ${n[0]}?)`:""}SL.suggestSimilar=dse});var EL=v(dk=>{var fse=Le("node:events").EventEmitter,ak=Le("node:child_process"),Mi=Le("node:path"),Dh=Le("node:fs"),ze=Le("node:process"),{Argument:pse,humanReadableArgName:mse}=Ch(),{CommanderError:ck}=qu(),{Help:hse,stripColor:gse}=rk(),{Option:xL,DualOptions:yse}=sk(),{suggestSimilar:$L}=wL(),lk=class t extends fse{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,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._savedState=null,this._outputConfiguration={writeOut:r=>ze.stdout.write(r),writeErr:r=>ze.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>ze.stdout.isTTY?ze.stdout.columns:void 0,getErrHelpWidth:()=>ze.stderr.isTTY?ze.stderr.columns:void 0,getOutHasColors:()=>uk()??(ze.stdout.isTTY&&ze.stdout.hasColors?.()),getErrHasColors:()=>uk()??(ze.stderr.isTTY&&ze.stderr.hasColors?.()),stripColor:r=>gse(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}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 r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new hse,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...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,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name -- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new pse(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.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,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"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,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(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,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. -Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new ck(e,r,n)),ze.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new xL(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=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 '${n}' -- already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof xL)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}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,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){ze.versions?.electron&&(r.from="electron");let i=ze.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=ze.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":ze.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. -- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(Dh.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist +(Did you mean ${n[0]}?)`:""}$L.suggestSimilar=$se});var OL=v(mk=>{var kse=Le("node:events").EventEmitter,uk=Le("node:child_process"),Mi=Le("node:path"),Mh=Le("node:fs"),ze=Le("node:process"),{Argument:Ese,humanReadableArgName:Ase}=jh(),{CommanderError:dk}=Zu(),{Help:Tse,stripColor:Ose}=ok(),{Option:EL,DualOptions:Pse}=lk(),{suggestSimilar:AL}=kL(),fk=class t extends kse{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,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._savedState=null,this._outputConfiguration={writeOut:r=>ze.stdout.write(r),writeErr:r=>ze.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>ze.stdout.isTTY?ze.stdout.columns:void 0,getErrHelpWidth:()=>ze.stderr.isTTY?ze.stderr.columns:void 0,getOutHasColors:()=>pk()??(ze.stdout.isTTY&&ze.stdout.hasColors?.()),getErrHasColors:()=>pk()??(ze.stderr.isTTY&&ze.stderr.hasColors?.()),stripColor:r=>Ose(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}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 r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new Tse,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...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,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name +- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new Ese(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.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,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"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,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(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,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. +Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new dk(e,r,n)),ze.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new EL(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=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 '${n}' +- already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof EL)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}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,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){ze.versions?.electron&&(r.from="electron");let i=ze.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=ze.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":ze.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. +- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(Mh.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=Mi.resolve(u,d);if(Dh.existsSync(f))return f;if(i.includes(Mi.extname(d)))return;let p=i.find(m=>Dh.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Dh.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=Mi.resolve(Mi.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=Mi.basename(this._scriptPath,Mi.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(Mi.extname(s));let c;ze.platform!=="win32"?n?(r.unshift(s),r=kL(ze.execArgv).concat(r),c=ak.spawn(ze.argv[0],r,{stdio:"inherit"})):c=ak.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=kL(ze.execArgv).concat(r),c=ak.spawn(ze.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{ze.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new ck(u,"commander.executeSubCommandAsync","(close)")):ze.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)ze.exit(1);else{let d=new ck(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==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=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} + - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=Mi.resolve(u,d);if(Mh.existsSync(f))return f;if(i.includes(Mi.extname(d)))return;let p=i.find(m=>Mh.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Mh.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=Mi.resolve(Mi.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=Mi.basename(this._scriptPath,Mi.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(Mi.extname(s));let c;ze.platform!=="win32"?n?(r.unshift(s),r=TL(ze.execArgv).concat(r),c=uk.spawn(ze.argv[0],r,{stdio:"inherit"})):c=uk.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=TL(ze.execArgv).concat(r),c=uk.spawn(ze.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{ze.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new dk(u,"commander.executeSubCommandAsync","(close)")):ze.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)ze.exit(1);else{let d=new dk(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==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=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` -`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in ze.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,ze.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new yse(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=$L(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=$L(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} -`),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>mse(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Mi.basename(e,Mi.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(ze.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. +`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in ze.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,ze.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Pse(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=AL(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=AL(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} +`),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>Ase(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Mi.basename(e,Mi.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(ze.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,o=>{let s;typeof r=="function"?s=r({error:o.error,command:o.command}):s=r,s&&o.write(`${s} -`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function kL(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function uk(){if(ze.env.NO_COLOR||ze.env.FORCE_COLOR==="0"||ze.env.FORCE_COLOR==="false")return!1;if(ze.env.FORCE_COLOR||ze.env.CLICOLOR_FORCE!==void 0)return!0}dk.Command=lk;dk.useColor=uk});var PL=v(cn=>{var{Argument:AL}=Ch(),{Command:fk}=EL(),{CommanderError:_se,InvalidArgumentError:OL}=qu(),{Help:vse}=rk(),{Option:TL}=sk();cn.program=new fk;cn.createCommand=t=>new fk(t);cn.createOption=(t,e)=>new TL(t,e);cn.createArgument=(t,e)=>new AL(t,e);cn.Command=fk;cn.Option=TL;cn.Argument=AL;cn.Help=vse;cn.CommanderError=_se;cn.InvalidArgumentError=OL;cn.InvalidOptionArgumentError=OL});var Ie=v(Gt=>{"use strict";var mk=Symbol.for("yaml.alias"),DL=Symbol.for("yaml.document"),Nh=Symbol.for("yaml.map"),NL=Symbol.for("yaml.pair"),hk=Symbol.for("yaml.scalar"),jh=Symbol.for("yaml.seq"),zi=Symbol.for("yaml.node.type"),kse=t=>!!t&&typeof t=="object"&&t[zi]===mk,Ese=t=>!!t&&typeof t=="object"&&t[zi]===DL,Ase=t=>!!t&&typeof t=="object"&&t[zi]===Nh,Ose=t=>!!t&&typeof t=="object"&&t[zi]===NL,jL=t=>!!t&&typeof t=="object"&&t[zi]===hk,Tse=t=>!!t&&typeof t=="object"&&t[zi]===jh;function ML(t){if(t&&typeof t=="object")switch(t[zi]){case Nh:case jh:return!0}return!1}function Pse(t){if(t&&typeof t=="object")switch(t[zi]){case mk:case Nh:case hk:case jh:return!0}return!1}var Ise=t=>(jL(t)||ML(t))&&!!t.anchor;Gt.ALIAS=mk;Gt.DOC=DL;Gt.MAP=Nh;Gt.NODE_TYPE=zi;Gt.PAIR=NL;Gt.SCALAR=hk;Gt.SEQ=jh;Gt.hasAnchor=Ise;Gt.isAlias=kse;Gt.isCollection=ML;Gt.isDocument=Ese;Gt.isMap=Ase;Gt.isNode=Pse;Gt.isPair=Ose;Gt.isScalar=jL;Gt.isSeq=Tse});var Bu=v(gk=>{"use strict";var Dt=Ie(),wr=Symbol("break visit"),zL=Symbol("skip children"),ri=Symbol("remove node");function Mh(t,e){let r=FL(e);Dt.isDocument(t)?Ja(null,t.contents,r,Object.freeze([t]))===ri&&(t.contents=null):Ja(null,t,r,Object.freeze([]))}Mh.BREAK=wr;Mh.SKIP=zL;Mh.REMOVE=ri;function Ja(t,e,r,n){let i=LL(t,e,r,n);if(Dt.isNode(i)||Dt.isPair(i))return UL(t,n,i),Ja(t,i,r,n);if(typeof i!="symbol"){if(Dt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var qL=Ie(),Rse=Bu(),Cse={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Dse=t=>t.replace(/[!,[\]{}]/g,e=>Cse[e]),Zu=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+Dse(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&qL.isNode(e.contents)){let o={};Rse.visit(e.contents,(s,a)=>{qL.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` -`)}};Zu.defaultYaml={explicit:!1,version:"1.2"};Zu.defaultTags={"!!":"tag:yaml.org,2002:"};BL.Directives=Zu});var Fh=v(Hu=>{"use strict";var ZL=Ie(),Nse=Bu();function jse(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function HL(t){let e=new Set;return Nse.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function GL(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Mse(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=HL(t));let s=GL(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(ZL.isScalar(s.node)||ZL.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}Hu.anchorIsValid=jse;Hu.anchorNames=HL;Hu.createNodeAnchors=Mse;Hu.findNewAnchor=GL});var _k=v(VL=>{"use strict";function Gu(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var zse=Ie();function WL(t,e,r){if(Array.isArray(t))return t.map((n,i)=>WL(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!zse.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}KL.toJS=WL});var Lh=v(YL=>{"use strict";var Fse=_k(),JL=Ie(),Lse=vo(),vk=class{constructor(e){Object.defineProperty(this,JL.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!JL.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Lse.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Fse.applyReviver(o,{"":a},"",a):a}};YL.NodeBase=vk});var Vu=v(XL=>{"use strict";var Use=Fh(),qse=Bu(),Xa=Ie(),Bse=Lh(),Zse=vo(),bk=class extends Bse.NodeBase{constructor(e){super(Xa.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],qse.visit(e,{Node:(o,s)=>{(Xa.isAlias(s)||Xa.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(Zse.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Uh(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Use.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Uh(t,e,r){if(Xa.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Xa.isCollection(e)){let n=0;for(let i of e.items){let o=Uh(t,i,r);o>n&&(n=o)}return n}else if(Xa.isPair(e)){let n=Uh(t,e.key,r),i=Uh(t,e.value,r);return Math.max(n,i)}return 1}XL.Alias=bk});var Et=v(Sk=>{"use strict";var Hse=Ie(),Gse=Lh(),Vse=vo(),Wse=t=>!t||typeof t!="function"&&typeof t!="object",bo=class extends Gse.NodeBase{constructor(e){super(Hse.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Vse.toJS(this.value,e,r)}toString(){return String(this.value)}};bo.BLOCK_FOLDED="BLOCK_FOLDED";bo.BLOCK_LITERAL="BLOCK_LITERAL";bo.PLAIN="PLAIN";bo.QUOTE_DOUBLE="QUOTE_DOUBLE";bo.QUOTE_SINGLE="QUOTE_SINGLE";Sk.Scalar=bo;Sk.isScalarValue=Wse});var Wu=v(e2=>{"use strict";var Kse=Vu(),Rs=Ie(),QL=Et(),Jse="tag:yaml.org,2002:";function Yse(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Xse(t,e,r){if(Rs.isDocument(t)&&(t=t.contents),Rs.isNode(t))return t;if(Rs.isPair(t)){let d=r.schema[Rs.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Kse.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Jse+e.slice(2));let l=Yse(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new QL.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[Rs.MAP]:Symbol.iterator in Object(t)?s[Rs.SEQ]:s[Rs.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new QL.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}e2.createNode=Xse});var Bh=v(qh=>{"use strict";var Qse=Wu(),ni=Ie(),eae=Lh();function wk(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Qse.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var t2=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,xk=class extends eae.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>ni.isNode(n)||ni.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(t2(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(ni.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,wk(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(ni.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&ni.isScalar(o)?o.value:o:ni.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!ni.isPair(r))return!1;let n=r.value;return n==null||e&&ni.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return ni.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(ni.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,wk(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};qh.Collection=xk;qh.collectionFromPath=wk;qh.isEmptyPath=t2});var Ku=v(Zh=>{"use strict";var tae=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function $k(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var rae=(t,e,r)=>t.endsWith(` -`)?$k(r,e):r.includes(` +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function TL(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function pk(){if(ze.env.NO_COLOR||ze.env.FORCE_COLOR==="0"||ze.env.FORCE_COLOR==="false")return!1;if(ze.env.FORCE_COLOR||ze.env.CLICOLOR_FORCE!==void 0)return!0}mk.Command=fk;mk.useColor=pk});var CL=v(cn=>{var{Argument:PL}=jh(),{Command:hk}=OL(),{CommanderError:Ise,InvalidArgumentError:IL}=Zu(),{Help:Rse}=ok(),{Option:RL}=lk();cn.program=new hk;cn.createCommand=t=>new hk(t);cn.createOption=(t,e)=>new RL(t,e);cn.createArgument=(t,e)=>new PL(t,e);cn.Command=hk;cn.Option=RL;cn.Argument=PL;cn.Help=Rse;cn.CommanderError=Ise;cn.InvalidArgumentError=IL;cn.InvalidOptionArgumentError=IL});var Ie=v(Gt=>{"use strict";var yk=Symbol.for("yaml.alias"),ML=Symbol.for("yaml.document"),zh=Symbol.for("yaml.map"),zL=Symbol.for("yaml.pair"),_k=Symbol.for("yaml.scalar"),Fh=Symbol.for("yaml.seq"),zi=Symbol.for("yaml.node.type"),zse=t=>!!t&&typeof t=="object"&&t[zi]===yk,Fse=t=>!!t&&typeof t=="object"&&t[zi]===ML,Lse=t=>!!t&&typeof t=="object"&&t[zi]===zh,Use=t=>!!t&&typeof t=="object"&&t[zi]===zL,FL=t=>!!t&&typeof t=="object"&&t[zi]===_k,qse=t=>!!t&&typeof t=="object"&&t[zi]===Fh;function LL(t){if(t&&typeof t=="object")switch(t[zi]){case zh:case Fh:return!0}return!1}function Bse(t){if(t&&typeof t=="object")switch(t[zi]){case yk:case zh:case _k:case Fh:return!0}return!1}var Zse=t=>(FL(t)||LL(t))&&!!t.anchor;Gt.ALIAS=yk;Gt.DOC=ML;Gt.MAP=zh;Gt.NODE_TYPE=zi;Gt.PAIR=zL;Gt.SCALAR=_k;Gt.SEQ=Fh;Gt.hasAnchor=Zse;Gt.isAlias=zse;Gt.isCollection=LL;Gt.isDocument=Fse;Gt.isMap=Lse;Gt.isNode=Bse;Gt.isPair=Use;Gt.isScalar=FL;Gt.isSeq=qse});var Hu=v(vk=>{"use strict";var Dt=Ie(),wr=Symbol("break visit"),UL=Symbol("skip children"),ri=Symbol("remove node");function Lh(t,e){let r=qL(e);Dt.isDocument(t)?Ja(null,t.contents,r,Object.freeze([t]))===ri&&(t.contents=null):Ja(null,t,r,Object.freeze([]))}Lh.BREAK=wr;Lh.SKIP=UL;Lh.REMOVE=ri;function Ja(t,e,r,n){let i=BL(t,e,r,n);if(Dt.isNode(i)||Dt.isPair(i))return ZL(t,n,i),Ja(t,i,r,n);if(typeof i!="symbol"){if(Dt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var HL=Ie(),Hse=Hu(),Gse={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Vse=t=>t.replace(/[!,[\]{}]/g,e=>Gse[e]),Gu=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+Vse(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&HL.isNode(e.contents)){let o={};Hse.visit(e.contents,(s,a)=>{HL.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` +`)}};Gu.defaultYaml={explicit:!1,version:"1.2"};Gu.defaultTags={"!!":"tag:yaml.org,2002:"};GL.Directives=Gu});var qh=v(Vu=>{"use strict";var VL=Ie(),Wse=Hu();function Kse(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function WL(t){let e=new Set;return Wse.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function KL(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Jse(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=WL(t));let s=KL(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(VL.isScalar(s.node)||VL.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}Vu.anchorIsValid=Kse;Vu.anchorNames=WL;Vu.createNodeAnchors=Jse;Vu.findNewAnchor=KL});var Sk=v(JL=>{"use strict";function Wu(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Yse=Ie();function YL(t,e,r){if(Array.isArray(t))return t.map((n,i)=>YL(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Yse.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}XL.toJS=YL});var Bh=v(eU=>{"use strict";var Xse=Sk(),QL=Ie(),Qse=vo(),wk=class{constructor(e){Object.defineProperty(this,QL.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!QL.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Qse.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Xse.applyReviver(o,{"":a},"",a):a}};eU.NodeBase=wk});var Ku=v(tU=>{"use strict";var eae=qh(),tae=Hu(),Xa=Ie(),rae=Bh(),nae=vo(),xk=class extends rae.NodeBase{constructor(e){super(Xa.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],tae.visit(e,{Node:(o,s)=>{(Xa.isAlias(s)||Xa.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(nae.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Zh(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(eae.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Zh(t,e,r){if(Xa.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Xa.isCollection(e)){let n=0;for(let i of e.items){let o=Zh(t,i,r);o>n&&(n=o)}return n}else if(Xa.isPair(e)){let n=Zh(t,e.key,r),i=Zh(t,e.value,r);return Math.max(n,i)}return 1}tU.Alias=xk});var At=v($k=>{"use strict";var iae=Ie(),oae=Bh(),sae=vo(),aae=t=>!t||typeof t!="function"&&typeof t!="object",bo=class extends oae.NodeBase{constructor(e){super(iae.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:sae.toJS(this.value,e,r)}toString(){return String(this.value)}};bo.BLOCK_FOLDED="BLOCK_FOLDED";bo.BLOCK_LITERAL="BLOCK_LITERAL";bo.PLAIN="PLAIN";bo.QUOTE_DOUBLE="QUOTE_DOUBLE";bo.QUOTE_SINGLE="QUOTE_SINGLE";$k.Scalar=bo;$k.isScalarValue=aae});var Ju=v(nU=>{"use strict";var cae=Ku(),Rs=Ie(),rU=At(),lae="tag:yaml.org,2002:";function uae(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function dae(t,e,r){if(Rs.isDocument(t)&&(t=t.contents),Rs.isNode(t))return t;if(Rs.isPair(t)){let d=r.schema[Rs.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new cae.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=lae+e.slice(2));let l=uae(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new rU.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[Rs.MAP]:Symbol.iterator in Object(t)?s[Rs.SEQ]:s[Rs.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new rU.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}nU.createNode=dae});var Gh=v(Hh=>{"use strict";var fae=Ju(),ni=Ie(),pae=Bh();function kk(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return fae.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var iU=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Ek=class extends pae.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>ni.isNode(n)||ni.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(iU(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(ni.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,kk(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(ni.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&ni.isScalar(o)?o.value:o:ni.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!ni.isPair(r))return!1;let n=r.value;return n==null||e&&ni.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return ni.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(ni.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,kk(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Hh.Collection=Ek;Hh.collectionFromPath=kk;Hh.isEmptyPath=iU});var Yu=v(Vh=>{"use strict";var mae=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Ak(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var hae=(t,e,r)=>t.endsWith(` +`)?Ak(r,e):r.includes(` `)?` -`+$k(r,e):(t.endsWith(" ")?"":" ")+r;Zh.indentComment=$k;Zh.lineComment=rae;Zh.stringifyComment=tae});var n2=v(Ju=>{"use strict";var nae="flow",kk="block",Hh="quoted";function iae(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===kk&&(h=r2(t,h,e.length),h!==-1&&(d=h+c));for(let x;x=t[h+=1];){if(r===Hh&&x==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(x===` -`)r===kk&&(h=r2(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(x===" "&&p&&p!==" "&&p!==` +`+Ak(r,e):(t.endsWith(" ")?"":" ")+r;Vh.indentComment=Ak;Vh.lineComment=hae;Vh.stringifyComment=mae});var sU=v(Xu=>{"use strict";var gae="flow",Tk="block",Wh="quoted";function yae(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===Tk&&(h=oU(t,h,e.length),h!==-1&&(d=h+c));for(let x;x=t[h+=1];){if(r===Wh&&x==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(x===` +`)r===Tk&&(h=oU(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(x===" "&&p&&p!==" "&&p!==` `&&p!==" "){let $=t[h+1];$&&$!==" "&&$!==` -`&&$!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Hh){for(;p===" "||p===" ";)p=x,x=t[h+=1],m=!0;let $=h>b+1?h-2:g-1;if(u[$])return t;l.push($),u[$]=!0,d=$+c,f=void 0}else m=!0}p=x}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let x=0;x{"use strict";var Pn=Et(),So=n2(),Vh=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Wh=t=>/^(%|---|\.\.\.)/m.test(t);function oae(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function Yu(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Wh(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Wh){for(;p===" "||p===" ";)p=x,x=t[h+=1],m=!0;let $=h>b+1?h-2:g-1;if(u[$])return t;l.push($),u[$]=!0,d=$+c,f=void 0}else m=!0}p=x}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let x=0;x{"use strict";var Pn=At(),So=sU(),Jh=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Yh=t=>/^(%|---|\.\.\.)/m.test(t);function _ae(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function Qu(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Yh(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length `;let d,f;for(f=r.length;f>0;--f){let w=r[f-1];if(w!==` `&&w!==" "&&w!==" ")break}let p=r.substring(f),m=p.indexOf(` `);m===-1?d="-":r===p||m!==p.length-1?(d="+",o&&o()):d="",p&&(r=r.slice(0,-p.length),p[p.length-1]===` -`&&(p=p.slice(0,-1)),p=p.replace(Ak,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{R=!0});let A=So.foldFlowLines(`${_}${w}${p}`,l,So.FOLD_BLOCK,T);if(!R)return`>${$} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),R=!1,O=Jh(n,!0);s!=="folded"&&e!==Pn.Scalar.BLOCK_FOLDED&&(O.onOverflow=()=>{R=!0});let A=So.foldFlowLines(`${_}${w}${p}`,l,So.FOLD_BLOCK,O);if(!R)return`>${$} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${$} -${l}${_}${r}${p}`}function sae(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` +${l}${_}${r}${p}`}function vae(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` `)||u&&/[[\]{},]/.test(o))return Qa(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?Qa(o,e):Gh(t,e,r,n);if(!a&&!u&&i!==Pn.Scalar.PLAIN&&o.includes(` -`))return Gh(t,e,r,n);if(Wh(o)){if(c==="")return e.forceBlockIndent=!0,Gh(t,e,r,n);if(a&&c===l)return Qa(o,e)}let d=o.replace(/\n+/g,`$& -${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return Qa(o,e)}return a?d:So.foldFlowLines(d,c,So.FOLD_FLOW,Vh(e,!1))}function aae(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Pn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Pn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Pn.Scalar.BLOCK_FOLDED:case Pn.Scalar.BLOCK_LITERAL:return i||o?Qa(s.value,e):Gh(s,e,r,n);case Pn.Scalar.QUOTE_DOUBLE:return Yu(s.value,e);case Pn.Scalar.QUOTE_SINGLE:return Ek(s.value,e);case Pn.Scalar.PLAIN:return sae(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}i2.stringifyString=aae});var Qu=v(Ok=>{"use strict";var cae=Fh(),wo=Ie(),lae=Ku(),uae=Xu();function dae(t,e){let r=Object.assign({blockQuote:!0,commentString:lae.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function fae(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(wo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function pae(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(wo.isScalar(t)||wo.isCollection(t))&&t.anchor;o&&cae.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function mae(t,e,r,n){if(wo.isPair(t))return t.toString(e,r,n);if(wo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=wo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=fae(e.doc.schema.tags,o));let s=pae(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):wo.isScalar(o)?uae.stringifyString(o,e,r,n):o.toString(e,r,n);return s?wo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}Ok.createStringifyContext=dae;Ok.stringify=mae});var c2=v(a2=>{"use strict";var Fi=Ie(),o2=Et(),s2=Qu(),ed=Ku();function hae({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=Fi.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Fi.isCollection(t)||!Fi.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||Fi.isCollection(t)||(Fi.isScalar(t)?t.type===o2.Scalar.BLOCK_FOLDED||t.type===o2.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=s2.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=ed.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=ed.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=ed.lineComment(g,r.indent,l(f))));let b,_,x;Fi.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,x=e.comment):(b=!1,_=null,x=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&Fi.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&Fi.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let $=!1,w=s2.stringify(e,r,()=>$=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` -`:"",_){let T=l(_);R+=` -${ed.indentComment(T,r.indent)}`}w===""&&!r.inFlow?R===` +`)?Qa(o,e):Kh(t,e,r,n);if(!a&&!u&&i!==Pn.Scalar.PLAIN&&o.includes(` +`))return Kh(t,e,r,n);if(Yh(o)){if(c==="")return e.forceBlockIndent=!0,Kh(t,e,r,n);if(a&&c===l)return Qa(o,e)}let d=o.replace(/\n+/g,`$& +${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return Qa(o,e)}return a?d:So.foldFlowLines(d,c,So.FOLD_FLOW,Jh(e,!1))}function bae(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Pn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Pn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Pn.Scalar.BLOCK_FOLDED:case Pn.Scalar.BLOCK_LITERAL:return i||o?Qa(s.value,e):Kh(s,e,r,n);case Pn.Scalar.QUOTE_DOUBLE:return Qu(s.value,e);case Pn.Scalar.QUOTE_SINGLE:return Ok(s.value,e);case Pn.Scalar.PLAIN:return vae(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}aU.stringifyString=bae});var td=v(Ik=>{"use strict";var Sae=qh(),wo=Ie(),wae=Yu(),xae=ed();function $ae(t,e){let r=Object.assign({blockQuote:!0,commentString:wae.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function kae(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(wo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function Eae(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(wo.isScalar(t)||wo.isCollection(t))&&t.anchor;o&&Sae.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function Aae(t,e,r,n){if(wo.isPair(t))return t.toString(e,r,n);if(wo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=wo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=kae(e.doc.schema.tags,o));let s=Eae(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):wo.isScalar(o)?xae.stringifyString(o,e,r,n):o.toString(e,r,n);return s?wo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}Ik.createStringifyContext=$ae;Ik.stringify=Aae});var dU=v(uU=>{"use strict";var Fi=Ie(),cU=At(),lU=td(),rd=Yu();function Tae({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=Fi.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Fi.isCollection(t)||!Fi.isNode(t)&&typeof t=="object"){let O="With simple keys, collection cannot be used as a key value";throw new Error(O)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||Fi.isCollection(t)||(Fi.isScalar(t)?t.type===cU.Scalar.BLOCK_FOLDED||t.type===cU.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=lU.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=rd.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=rd.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=rd.lineComment(g,r.indent,l(f))));let b,_,x;Fi.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,x=e.comment):(b=!1,_=null,x=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&Fi.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&Fi.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let $=!1,w=lU.stringify(e,r,()=>$=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` +`:"",_){let O=l(_);R+=` +${rd.indentComment(O,r.indent)}`}w===""&&!r.inFlow?R===` `&&x&&(R=` `):R+=` -${r.indent}`}else if(!p&&Fi.isCollection(e)){let T=w[0],A=w.indexOf(` -`),N=A!==-1,k=r.inFlow??e.flow??e.items.length===0;if(N||!k){let Z=!1;if(N&&(T==="&"||T==="!")){let ne=w.indexOf(" ");T==="&"&&ne!==-1&&ne{"use strict";var l2=Le("process");function gae(t,...e){t==="debug"&&console.log(...e)}function yae(t,e){(t==="debug"||t==="warn")&&(typeof l2.emitWarning=="function"?l2.emitWarning(e):console.warn(e))}Tk.debug=gae;Tk.warn=yae});var Qh=v(Xh=>{"use strict";var Yh=Ie(),u2=Et(),Kh="<<",Jh={identify:t=>t===Kh||typeof t=="symbol"&&t.description===Kh,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new u2.Scalar(Symbol(Kh)),{addToJSMap:d2}),stringify:()=>Kh},_ae=(t,e)=>(Jh.identify(e)||Yh.isScalar(e)&&(!e.type||e.type===u2.Scalar.PLAIN)&&Jh.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Jh.tag&&r.default);function d2(t,e,r){let n=f2(t,r);if(Yh.isSeq(n))for(let i of n.items)Ik(t,e,i);else if(Array.isArray(n))for(let i of n)Ik(t,e,i);else Ik(t,e,n)}function Ik(t,e,r){let n=f2(t,r);if(!Yh.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function f2(t,e){return t&&Yh.isAlias(e)?e.resolve(t.doc,t):e}Xh.addMergeToJSMap=d2;Xh.isMergeKey=_ae;Xh.merge=Jh});var Ck=v(h2=>{"use strict";var vae=Pk(),p2=Qh(),bae=Qu(),m2=Ie(),Rk=vo();function Sae(t,e,{key:r,value:n}){if(m2.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(p2.isMergeKey(t,r))p2.addMergeToJSMap(t,e,n);else{let i=Rk.toJS(r,"",t);if(e instanceof Map)e.set(i,Rk.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=wae(r,i,t),s=Rk.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function wae(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(m2.isNode(t)&&r?.doc){let n=bae.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),vae.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}h2.addPairToJSMap=Sae});var xo=v(Dk=>{"use strict";var g2=Wu(),xae=c2(),$ae=Ck(),eg=Ie();function kae(t,e,r){let n=g2.createNode(t,void 0,r),i=g2.createNode(e,void 0,r);return new tg(n,i)}var tg=class t{constructor(e,r=null){Object.defineProperty(this,eg.NODE_TYPE,{value:eg.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return eg.isNode(r)&&(r=r.clone(e)),eg.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return $ae.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?xae.stringifyPair(this,e,r,n):JSON.stringify(this)}};Dk.Pair=tg;Dk.createPair=kae});var Nk=v(_2=>{"use strict";var Cs=Ie(),y2=Qu(),rg=Ku();function Eae(t,e,r){return(e.inFlow??t.flow?Oae:Aae)(t,e,r)}function Aae({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=rg.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;m{"use strict";var fU=Le("process");function Oae(t,...e){t==="debug"&&console.log(...e)}function Pae(t,e){(t==="debug"||t==="warn")&&(typeof fU.emitWarning=="function"?fU.emitWarning(e):console.warn(e))}Rk.debug=Oae;Rk.warn=Pae});var rg=v(tg=>{"use strict";var eg=Ie(),pU=At(),Xh="<<",Qh={identify:t=>t===Xh||typeof t=="symbol"&&t.description===Xh,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new pU.Scalar(Symbol(Xh)),{addToJSMap:mU}),stringify:()=>Xh},Iae=(t,e)=>(Qh.identify(e)||eg.isScalar(e)&&(!e.type||e.type===pU.Scalar.PLAIN)&&Qh.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Qh.tag&&r.default);function mU(t,e,r){let n=hU(t,r);if(eg.isSeq(n))for(let i of n.items)Dk(t,e,i);else if(Array.isArray(n))for(let i of n)Dk(t,e,i);else Dk(t,e,n)}function Dk(t,e,r){let n=hU(t,r);if(!eg.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function hU(t,e){return t&&eg.isAlias(e)?e.resolve(t.doc,t):e}tg.addMergeToJSMap=mU;tg.isMergeKey=Iae;tg.merge=Qh});var jk=v(_U=>{"use strict";var Rae=Ck(),gU=rg(),Cae=td(),yU=Ie(),Nk=vo();function Dae(t,e,{key:r,value:n}){if(yU.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(gU.isMergeKey(t,r))gU.addMergeToJSMap(t,e,n);else{let i=Nk.toJS(r,"",t);if(e instanceof Map)e.set(i,Nk.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Nae(r,i,t),s=Nk.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function Nae(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(yU.isNode(t)&&r?.doc){let n=Cae.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),Rae.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}_U.addPairToJSMap=Dae});var xo=v(Mk=>{"use strict";var vU=Ju(),jae=dU(),Mae=jk(),ng=Ie();function zae(t,e,r){let n=vU.createNode(t,void 0,r),i=vU.createNode(e,void 0,r);return new ig(n,i)}var ig=class t{constructor(e,r=null){Object.defineProperty(this,ng.NODE_TYPE,{value:ng.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return ng.isNode(r)&&(r=r.clone(e)),ng.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Mae.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?jae.stringifyPair(this,e,r,n):JSON.stringify(this)}};Mk.Pair=ig;Mk.createPair=zae});var zk=v(SU=>{"use strict";var Cs=Ie(),bU=td(),og=Yu();function Fae(t,e,r){return(e.inFlow??t.flow?Uae:Lae)(t,e,r)}function Lae({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=og.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;mg=null);l||(l=d.length>u||b.includes(` -`)),m0&&(l||(l=d.reduce((_,x)=>_+x.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=rg.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` +`+og.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function Uae({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;mg=null);l||(l=d.length>u||b.includes(` +`)),m0&&(l||(l=d.reduce((_,x)=>_+x.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=og.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` ${o}${i}${h}`:` `;return`${m} -${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function ng({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=rg.indentComment(e(n),t);r.push(o.trimStart())}}_2.stringifyCollection=Eae});var ko=v(Mk=>{"use strict";var Tae=Nk(),Pae=Ck(),Iae=Bh(),$o=Ie(),ig=xo(),Rae=Et();function td(t,e){let r=$o.isScalar(e)?e.value:e;for(let n of t)if($o.isPair(n)&&(n.key===e||n.key===r||$o.isScalar(n.key)&&n.key.value===r))return n}var jk=class extends Iae.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super($o.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(ig.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;$o.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new ig.Pair(e,e?.value):n=new ig.Pair(e.key,e.value);let i=td(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);$o.isScalar(i.value)&&Rae.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=td(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=td(this.items,e)?.value;return(!r&&$o.isScalar(i)?i.value:i)??void 0}has(e){return!!td(this.items,e)}set(e,r){this.add(new ig.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Pae.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!$o.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Tae.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};Mk.YAMLMap=jk;Mk.findPair=td});var ec=v(b2=>{"use strict";var Cae=Ie(),v2=ko(),Dae={collection:"map",default:!0,nodeClass:v2.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Cae.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>v2.YAMLMap.from(t,e,r)};b2.map=Dae});var Eo=v(S2=>{"use strict";var Nae=Wu(),jae=Nk(),Mae=Bh(),sg=Ie(),zae=Et(),Fae=vo(),zk=class extends Mae.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(sg.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=og(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=og(e);if(typeof n!="number")return;let i=this.items[n];return!r&&sg.isScalar(i)?i.value:i}has(e){let r=og(e);return typeof r=="number"&&r=0?e:null}S2.YAMLSeq=zk});var tc=v(x2=>{"use strict";var Lae=Ie(),w2=Eo(),Uae={collection:"seq",default:!0,nodeClass:w2.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Lae.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>w2.YAMLSeq.from(t,e,r)};x2.seq=Uae});var rd=v($2=>{"use strict";var qae=Xu(),Bae={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),qae.stringifyString(t,e,r,n)}};$2.string=Bae});var ag=v(A2=>{"use strict";var k2=Et(),E2={identify:t=>t==null,createNode:()=>new k2.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new k2.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&E2.test.test(t)?t:e.options.nullStr};A2.nullTag=E2});var Fk=v(T2=>{"use strict";var Zae=Et(),O2={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Zae.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&O2.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};T2.boolTag=O2});var rc=v(P2=>{"use strict";function Hae({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}P2.stringifyNumber=Hae});var Uk=v(cg=>{"use strict";var Gae=Et(),Lk=rc(),Vae={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Lk.stringifyNumber},Wae={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Lk.stringifyNumber(t)}},Kae={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Gae.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:Lk.stringifyNumber};cg.float=Kae;cg.floatExp=Wae;cg.floatNaN=Vae});var Bk=v(ug=>{"use strict";var I2=rc(),lg=t=>typeof t=="bigint"||Number.isInteger(t),qk=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function R2(t,e,r){let{value:n}=t;return lg(n)&&n>=0?r+n.toString(e):I2.stringifyNumber(t)}var Jae={identify:t=>lg(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>qk(t,2,8,r),stringify:t=>R2(t,8,"0o")},Yae={identify:lg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>qk(t,0,10,r),stringify:I2.stringifyNumber},Xae={identify:t=>lg(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>qk(t,2,16,r),stringify:t=>R2(t,16,"0x")};ug.int=Yae;ug.intHex=Xae;ug.intOct=Jae});var D2=v(C2=>{"use strict";var Qae=ec(),ece=ag(),tce=tc(),rce=rd(),nce=Fk(),Zk=Uk(),Hk=Bk(),ice=[Qae.map,tce.seq,rce.string,ece.nullTag,nce.boolTag,Hk.intOct,Hk.int,Hk.intHex,Zk.floatNaN,Zk.floatExp,Zk.float];C2.schema=ice});var M2=v(j2=>{"use strict";var oce=Et(),sce=ec(),ace=tc();function N2(t){return typeof t=="bigint"||Number.isInteger(t)}var dg=({value:t})=>JSON.stringify(t),cce=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:dg},{identify:t=>t==null,createNode:()=>new oce.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:dg},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:dg},{identify:N2,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>N2(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:dg}],lce={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},uce=[sce.map,ace.seq].concat(cce,lce);j2.schema=uce});var Vk=v(z2=>{"use strict";var nd=Le("buffer"),Gk=Et(),dce=Xu(),fce={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof nd.Buffer=="function")return nd.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var fg=Ie(),Wk=xo(),pce=Et(),mce=Eo();function F2(t,e){if(fg.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new Wk.Pair(new pce.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function sg({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=og.indentComment(e(n),t);r.push(o.trimStart())}}SU.stringifyCollection=Fae});var ko=v(Lk=>{"use strict";var qae=zk(),Bae=jk(),Zae=Gh(),$o=Ie(),ag=xo(),Hae=At();function nd(t,e){let r=$o.isScalar(e)?e.value:e;for(let n of t)if($o.isPair(n)&&(n.key===e||n.key===r||$o.isScalar(n.key)&&n.key.value===r))return n}var Fk=class extends Zae.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super($o.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(ag.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;$o.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new ag.Pair(e,e?.value):n=new ag.Pair(e.key,e.value);let i=nd(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);$o.isScalar(i.value)&&Hae.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=nd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=nd(this.items,e)?.value;return(!r&&$o.isScalar(i)?i.value:i)??void 0}has(e){return!!nd(this.items,e)}set(e,r){this.add(new ag.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Bae.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!$o.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),qae.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};Lk.YAMLMap=Fk;Lk.findPair=nd});var ec=v(xU=>{"use strict";var Gae=Ie(),wU=ko(),Vae={collection:"map",default:!0,nodeClass:wU.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Gae.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>wU.YAMLMap.from(t,e,r)};xU.map=Vae});var Eo=v($U=>{"use strict";var Wae=Ju(),Kae=zk(),Jae=Gh(),lg=Ie(),Yae=At(),Xae=vo(),Uk=class extends Jae.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(lg.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=cg(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=cg(e);if(typeof n!="number")return;let i=this.items[n];return!r&&lg.isScalar(i)?i.value:i}has(e){let r=cg(e);return typeof r=="number"&&r=0?e:null}$U.YAMLSeq=Uk});var tc=v(EU=>{"use strict";var Qae=Ie(),kU=Eo(),ece={collection:"seq",default:!0,nodeClass:kU.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Qae.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>kU.YAMLSeq.from(t,e,r)};EU.seq=ece});var id=v(AU=>{"use strict";var tce=ed(),rce={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),tce.stringifyString(t,e,r,n)}};AU.string=rce});var ug=v(PU=>{"use strict";var TU=At(),OU={identify:t=>t==null,createNode:()=>new TU.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new TU.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&OU.test.test(t)?t:e.options.nullStr};PU.nullTag=OU});var qk=v(RU=>{"use strict";var nce=At(),IU={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new nce.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&IU.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};RU.boolTag=IU});var rc=v(CU=>{"use strict";function ice({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}CU.stringifyNumber=ice});var Zk=v(dg=>{"use strict";var oce=At(),Bk=rc(),sce={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Bk.stringifyNumber},ace={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Bk.stringifyNumber(t)}},cce={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new oce.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:Bk.stringifyNumber};dg.float=cce;dg.floatExp=ace;dg.floatNaN=sce});var Gk=v(pg=>{"use strict";var DU=rc(),fg=t=>typeof t=="bigint"||Number.isInteger(t),Hk=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function NU(t,e,r){let{value:n}=t;return fg(n)&&n>=0?r+n.toString(e):DU.stringifyNumber(t)}var lce={identify:t=>fg(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>Hk(t,2,8,r),stringify:t=>NU(t,8,"0o")},uce={identify:fg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>Hk(t,0,10,r),stringify:DU.stringifyNumber},dce={identify:t=>fg(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>Hk(t,2,16,r),stringify:t=>NU(t,16,"0x")};pg.int=uce;pg.intHex=dce;pg.intOct=lce});var MU=v(jU=>{"use strict";var fce=ec(),pce=ug(),mce=tc(),hce=id(),gce=qk(),Vk=Zk(),Wk=Gk(),yce=[fce.map,mce.seq,hce.string,pce.nullTag,gce.boolTag,Wk.intOct,Wk.int,Wk.intHex,Vk.floatNaN,Vk.floatExp,Vk.float];jU.schema=yce});var LU=v(FU=>{"use strict";var _ce=At(),vce=ec(),bce=tc();function zU(t){return typeof t=="bigint"||Number.isInteger(t)}var mg=({value:t})=>JSON.stringify(t),Sce=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:mg},{identify:t=>t==null,createNode:()=>new _ce.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:mg},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:mg},{identify:zU,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>zU(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:mg}],wce={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},xce=[vce.map,bce.seq].concat(Sce,wce);FU.schema=xce});var Jk=v(UU=>{"use strict";var od=Le("buffer"),Kk=At(),$ce=ed(),kce={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof od.Buffer=="function")return od.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var hg=Ie(),Yk=xo(),Ece=At(),Ace=Eo();function qU(t,e){if(hg.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new Yk.Pair(new Ece.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} ${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment} -${o.comment}`:n.comment}n=i}t.items[r]=fg.isPair(n)?n:new Wk.Pair(n)}}else e("Expected a sequence for this tag");return t}function L2(t,e,r){let{replacer:n}=r,i=new mce.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(Wk.createPair(a,c,r))}return i}var hce={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:F2,createNode:L2};pg.createPairs=L2;pg.pairs=hce;pg.resolvePairs=F2});var Yk=v(Jk=>{"use strict";var U2=Ie(),Kk=vo(),id=ko(),gce=Eo(),q2=mg(),Ds=class t extends gce.YAMLSeq{constructor(){super(),this.add=id.YAMLMap.prototype.add.bind(this),this.delete=id.YAMLMap.prototype.delete.bind(this),this.get=id.YAMLMap.prototype.get.bind(this),this.has=id.YAMLMap.prototype.has.bind(this),this.set=id.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(U2.isPair(i)?(o=Kk.toJS(i.key,"",r),s=Kk.toJS(i.value,o,r)):o=Kk.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=q2.createPairs(e,r,n),o=new this;return o.items=i.items,o}};Ds.tag="tag:yaml.org,2002:omap";var yce={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ds,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=q2.resolvePairs(t,e),n=[];for(let{key:i}of r.items)U2.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Ds,r)},createNode:(t,e,r)=>Ds.from(t,e,r)};Jk.YAMLOMap=Ds;Jk.omap=yce});var V2=v(Xk=>{"use strict";var B2=Et();function Z2({value:t,source:e},r){return e&&(t?H2:G2).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var H2={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new B2.Scalar(!0),stringify:Z2},G2={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new B2.Scalar(!1),stringify:Z2};Xk.falseTag=G2;Xk.trueTag=H2});var W2=v(hg=>{"use strict";var _ce=Et(),Qk=rc(),vce={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Qk.stringifyNumber},bce={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Qk.stringifyNumber(t)}},Sce={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new _ce.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Qk.stringifyNumber};hg.float=Sce;hg.floatExp=bce;hg.floatNaN=vce});var J2=v(sd=>{"use strict";var K2=rc(),od=t=>typeof t=="bigint"||Number.isInteger(t);function gg(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function eE(t,e,r){let{value:n}=t;if(od(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return K2.stringifyNumber(t)}var wce={identify:od,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>gg(t,2,2,r),stringify:t=>eE(t,2,"0b")},xce={identify:od,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>gg(t,1,8,r),stringify:t=>eE(t,8,"0")},$ce={identify:od,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>gg(t,0,10,r),stringify:K2.stringifyNumber},kce={identify:od,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>gg(t,2,16,r),stringify:t=>eE(t,16,"0x")};sd.int=$ce;sd.intBin=wce;sd.intHex=kce;sd.intOct=xce});var rE=v(tE=>{"use strict";var vg=Ie(),yg=xo(),_g=ko(),Ns=class t extends _g.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;vg.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new yg.Pair(e.key,null):r=new yg.Pair(e,null),_g.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=_g.findPair(this.items,e);return!r&&vg.isPair(n)?vg.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=_g.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new yg.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(yg.createPair(s,null,n));return o}};Ns.tag="tag:yaml.org,2002:set";var Ece={collection:"map",identify:t=>t instanceof Set,nodeClass:Ns,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Ns.from(t,e,r),resolve(t,e){if(vg.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ns,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};tE.YAMLSet=Ns;tE.set=Ece});var iE=v(bg=>{"use strict";var Ace=rc();function nE(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function Y2(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Ace.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Oce={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>nE(t,r),stringify:Y2},Tce={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>nE(t,!1),stringify:Y2},X2={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(X2.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=nE(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};bg.floatTime=Tce;bg.intTime=Oce;bg.timestamp=X2});var tU=v(eU=>{"use strict";var Pce=ec(),Ice=ag(),Rce=tc(),Cce=rd(),Dce=Vk(),Q2=V2(),oE=W2(),Sg=J2(),Nce=Qh(),jce=Yk(),Mce=mg(),zce=rE(),sE=iE(),Fce=[Pce.map,Rce.seq,Cce.string,Ice.nullTag,Q2.trueTag,Q2.falseTag,Sg.intBin,Sg.intOct,Sg.int,Sg.intHex,oE.floatNaN,oE.floatExp,oE.float,Dce.binary,Nce.merge,jce.omap,Mce.pairs,zce.set,sE.intTime,sE.floatTime,sE.timestamp];eU.schema=Fce});var dU=v(lE=>{"use strict";var oU=ec(),Lce=ag(),sU=tc(),Uce=rd(),qce=Fk(),aE=Uk(),cE=Bk(),Bce=D2(),Zce=M2(),aU=Vk(),ad=Qh(),cU=Yk(),lU=mg(),rU=tU(),uU=rE(),wg=iE(),nU=new Map([["core",Bce.schema],["failsafe",[oU.map,sU.seq,Uce.string]],["json",Zce.schema],["yaml11",rU.schema],["yaml-1.1",rU.schema]]),iU={binary:aU.binary,bool:qce.boolTag,float:aE.float,floatExp:aE.floatExp,floatNaN:aE.floatNaN,floatTime:wg.floatTime,int:cE.int,intHex:cE.intHex,intOct:cE.intOct,intTime:wg.intTime,map:oU.map,merge:ad.merge,null:Lce.nullTag,omap:cU.omap,pairs:lU.pairs,seq:sU.seq,set:uU.set,timestamp:wg.timestamp},Hce={"tag:yaml.org,2002:binary":aU.binary,"tag:yaml.org,2002:merge":ad.merge,"tag:yaml.org,2002:omap":cU.omap,"tag:yaml.org,2002:pairs":lU.pairs,"tag:yaml.org,2002:set":uU.set,"tag:yaml.org,2002:timestamp":wg.timestamp};function Gce(t,e,r){let n=nU.get(e);if(n&&!t)return r&&!n.includes(ad.merge)?n.concat(ad.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(nU.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(ad.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?iU[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(iU).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}lE.coreKnownTags=Hce;lE.getTags=Gce});var fE=v(fU=>{"use strict";var uE=Ie(),Vce=ec(),Wce=tc(),Kce=rd(),xg=dU(),Jce=(t,e)=>t.keye.key?1:0,dE=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?xg.getTags(e,"compat"):e?xg.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?xg.coreKnownTags:{},this.tags=xg.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,uE.MAP,{value:Vce.map}),Object.defineProperty(this,uE.SCALAR,{value:Kce.string}),Object.defineProperty(this,uE.SEQ,{value:Wce.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Jce:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};fU.Schema=dE});var mU=v(pU=>{"use strict";var Yce=Ie(),pE=Qu(),cd=Ku();function Xce(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=pE.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(cd.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Yce.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(cd.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=pE.stringify(t.contents,i,()=>a=null,c);a&&(l+=cd.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(pE.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(cd.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(cd.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=hg.isPair(n)?n:new Yk.Pair(n)}}else e("Expected a sequence for this tag");return t}function BU(t,e,r){let{replacer:n}=r,i=new Ace.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(Yk.createPair(a,c,r))}return i}var Tce={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:qU,createNode:BU};gg.createPairs=BU;gg.pairs=Tce;gg.resolvePairs=qU});var eE=v(Qk=>{"use strict";var ZU=Ie(),Xk=vo(),sd=ko(),Oce=Eo(),HU=yg(),Ds=class t extends Oce.YAMLSeq{constructor(){super(),this.add=sd.YAMLMap.prototype.add.bind(this),this.delete=sd.YAMLMap.prototype.delete.bind(this),this.get=sd.YAMLMap.prototype.get.bind(this),this.has=sd.YAMLMap.prototype.has.bind(this),this.set=sd.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(ZU.isPair(i)?(o=Xk.toJS(i.key,"",r),s=Xk.toJS(i.value,o,r)):o=Xk.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=HU.createPairs(e,r,n),o=new this;return o.items=i.items,o}};Ds.tag="tag:yaml.org,2002:omap";var Pce={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ds,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=HU.resolvePairs(t,e),n=[];for(let{key:i}of r.items)ZU.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Ds,r)},createNode:(t,e,r)=>Ds.from(t,e,r)};Qk.YAMLOMap=Ds;Qk.omap=Pce});var JU=v(tE=>{"use strict";var GU=At();function VU({value:t,source:e},r){return e&&(t?WU:KU).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var WU={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new GU.Scalar(!0),stringify:VU},KU={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new GU.Scalar(!1),stringify:VU};tE.falseTag=KU;tE.trueTag=WU});var YU=v(_g=>{"use strict";var Ice=At(),rE=rc(),Rce={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:rE.stringifyNumber},Cce={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():rE.stringifyNumber(t)}},Dce={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Ice.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:rE.stringifyNumber};_g.float=Dce;_g.floatExp=Cce;_g.floatNaN=Rce});var QU=v(cd=>{"use strict";var XU=rc(),ad=t=>typeof t=="bigint"||Number.isInteger(t);function vg(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function nE(t,e,r){let{value:n}=t;if(ad(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return XU.stringifyNumber(t)}var Nce={identify:ad,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>vg(t,2,2,r),stringify:t=>nE(t,2,"0b")},jce={identify:ad,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>vg(t,1,8,r),stringify:t=>nE(t,8,"0")},Mce={identify:ad,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>vg(t,0,10,r),stringify:XU.stringifyNumber},zce={identify:ad,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>vg(t,2,16,r),stringify:t=>nE(t,16,"0x")};cd.int=Mce;cd.intBin=Nce;cd.intHex=zce;cd.intOct=jce});var oE=v(iE=>{"use strict";var wg=Ie(),bg=xo(),Sg=ko(),Ns=class t extends Sg.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;wg.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new bg.Pair(e.key,null):r=new bg.Pair(e,null),Sg.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Sg.findPair(this.items,e);return!r&&wg.isPair(n)?wg.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=Sg.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new bg.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(bg.createPair(s,null,n));return o}};Ns.tag="tag:yaml.org,2002:set";var Fce={collection:"map",identify:t=>t instanceof Set,nodeClass:Ns,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Ns.from(t,e,r),resolve(t,e){if(wg.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ns,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};iE.YAMLSet=Ns;iE.set=Fce});var aE=v(xg=>{"use strict";var Lce=rc();function sE(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function e2(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Lce.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Uce={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>sE(t,r),stringify:e2},qce={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>sE(t,!1),stringify:e2},t2={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(t2.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=sE(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};xg.floatTime=qce;xg.intTime=Uce;xg.timestamp=t2});var i2=v(n2=>{"use strict";var Bce=ec(),Zce=ug(),Hce=tc(),Gce=id(),Vce=Jk(),r2=JU(),cE=YU(),$g=QU(),Wce=rg(),Kce=eE(),Jce=yg(),Yce=oE(),lE=aE(),Xce=[Bce.map,Hce.seq,Gce.string,Zce.nullTag,r2.trueTag,r2.falseTag,$g.intBin,$g.intOct,$g.int,$g.intHex,cE.floatNaN,cE.floatExp,cE.float,Vce.binary,Wce.merge,Kce.omap,Jce.pairs,Yce.set,lE.intTime,lE.floatTime,lE.timestamp];n2.schema=Xce});var m2=v(fE=>{"use strict";var c2=ec(),Qce=ug(),l2=tc(),ele=id(),tle=qk(),uE=Zk(),dE=Gk(),rle=MU(),nle=LU(),u2=Jk(),ld=rg(),d2=eE(),f2=yg(),o2=i2(),p2=oE(),kg=aE(),s2=new Map([["core",rle.schema],["failsafe",[c2.map,l2.seq,ele.string]],["json",nle.schema],["yaml11",o2.schema],["yaml-1.1",o2.schema]]),a2={binary:u2.binary,bool:tle.boolTag,float:uE.float,floatExp:uE.floatExp,floatNaN:uE.floatNaN,floatTime:kg.floatTime,int:dE.int,intHex:dE.intHex,intOct:dE.intOct,intTime:kg.intTime,map:c2.map,merge:ld.merge,null:Qce.nullTag,omap:d2.omap,pairs:f2.pairs,seq:l2.seq,set:p2.set,timestamp:kg.timestamp},ile={"tag:yaml.org,2002:binary":u2.binary,"tag:yaml.org,2002:merge":ld.merge,"tag:yaml.org,2002:omap":d2.omap,"tag:yaml.org,2002:pairs":f2.pairs,"tag:yaml.org,2002:set":p2.set,"tag:yaml.org,2002:timestamp":kg.timestamp};function ole(t,e,r){let n=s2.get(e);if(n&&!t)return r&&!n.includes(ld.merge)?n.concat(ld.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(s2.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(ld.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?a2[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(a2).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}fE.coreKnownTags=ile;fE.getTags=ole});var hE=v(h2=>{"use strict";var pE=Ie(),sle=ec(),ale=tc(),cle=id(),Eg=m2(),lle=(t,e)=>t.keye.key?1:0,mE=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Eg.getTags(e,"compat"):e?Eg.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Eg.coreKnownTags:{},this.tags=Eg.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,pE.MAP,{value:sle.map}),Object.defineProperty(this,pE.SCALAR,{value:cle.string}),Object.defineProperty(this,pE.SEQ,{value:ale.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?lle:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};h2.Schema=mE});var y2=v(g2=>{"use strict";var ule=Ie(),gE=td(),ud=Yu();function dle(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=gE.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(ud.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(ule.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(ud.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=gE.stringify(t.contents,i,()=>a=null,c);a&&(l+=ud.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(gE.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(ud.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(ud.indentComment(o(c),"")))}return r.join(` `)+` -`}pU.stringifyDocument=Xce});var ld=v(hU=>{"use strict";var Qce=Vu(),nc=Bh(),ln=Ie(),ele=xo(),tle=vo(),rle=fE(),nle=mU(),mE=Fh(),ile=_k(),ole=Wu(),hE=yk(),gE=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ln.NODE_TYPE,{value:ln.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new hE.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[ln.NODE_TYPE]:{value:ln.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=ln.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ic(this.contents)&&this.contents.add(e)}addIn(e,r){ic(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=mE.anchorNames(this);e.anchor=!r||n.has(r)?mE.findNewAnchor(r||"a",n):r}return new Qce.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=mE.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=ole.createNode(e,u,m);return a&&ln.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new ele.Pair(i,o)}delete(e){return ic(this.contents)?this.contents.delete(e):!1}deleteIn(e){return nc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ic(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return ln.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return nc.isEmptyPath(e)?!r&&ln.isScalar(this.contents)?this.contents.value:this.contents:ln.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return ln.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return nc.isEmptyPath(e)?this.contents!==void 0:ln.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=nc.collectionFromPath(this.schema,[e],r):ic(this.contents)&&this.contents.set(e,r)}setIn(e,r){nc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=nc.collectionFromPath(this.schema,Array.from(e),r):ic(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new hE.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new hE.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new rle.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=tle.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?ile.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return nle.stringifyDocument(this,e)}};function ic(t){if(ln.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}hU.Document=gE});var fd=v(dd=>{"use strict";var ud=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},yE=class extends ud{constructor(e,r,n){super("YAMLParseError",e,r,n)}},_E=class extends ud{constructor(e,r,n){super("YAMLWarning",e,r,n)}},sle=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 +`}g2.stringifyDocument=dle});var dd=v(_2=>{"use strict";var fle=Ku(),nc=Gh(),ln=Ie(),ple=xo(),mle=vo(),hle=hE(),gle=y2(),yE=qh(),yle=Sk(),_le=Ju(),_E=bk(),vE=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ln.NODE_TYPE,{value:ln.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new _E.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[ln.NODE_TYPE]:{value:ln.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=ln.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ic(this.contents)&&this.contents.add(e)}addIn(e,r){ic(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=yE.anchorNames(this);e.anchor=!r||n.has(r)?yE.findNewAnchor(r||"a",n):r}return new fle.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=yE.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=_le.createNode(e,u,m);return a&&ln.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new ple.Pair(i,o)}delete(e){return ic(this.contents)?this.contents.delete(e):!1}deleteIn(e){return nc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ic(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return ln.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return nc.isEmptyPath(e)?!r&&ln.isScalar(this.contents)?this.contents.value:this.contents:ln.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return ln.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return nc.isEmptyPath(e)?this.contents!==void 0:ln.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=nc.collectionFromPath(this.schema,[e],r):ic(this.contents)&&this.contents.set(e,r)}setIn(e,r){nc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=nc.collectionFromPath(this.schema,Array.from(e),r):ic(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new _E.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new _E.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new hle.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=mle.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?yle.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return gle.stringifyDocument(this,e)}};function ic(t){if(ln.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}_2.Document=vE});var md=v(pd=>{"use strict";var fd=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},bE=class extends fd{constructor(e,r,n){super("YAMLParseError",e,r,n)}},SE=class extends fd{constructor(e,r,n){super("YAMLWarning",e,r,n)}},vle=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`: ${s} ${l} -`}};dd.YAMLError=ud;dd.YAMLParseError=yE;dd.YAMLWarning=_E;dd.prettifyError=sle});var pd=v(gU=>{"use strict";function ale(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,x=null,$=null,w=null;for(let A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let N=A.source.substring(1)||" ";d?d+=f+N:d=N,f="",l=!1;break}case"newline":l?d?d+=A.source:(!$||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),$&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),$=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){x&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),x=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let R=t[t.length-1],T=R?R.offset+R.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:x,found:$,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:T,start:w??T}}gU.resolveProps=ale});var $g=v(yU=>{"use strict";function vE(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` -`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(vE(e.key)||vE(e.value))return!0}return!1;default:return!0}}yU.containsNewline=vE});var bE=v(_U=>{"use strict";var cle=$g();function lle(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&cle.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}_U.flowIndentCheck=lle});var SE=v(bU=>{"use strict";var vU=Ie();function ule(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||vU.isScalar(o)&&vU.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}bU.mapIncludes=ule});var EU=v(kU=>{"use strict";var SU=xo(),dle=ko(),wU=pd(),fle=$g(),xU=bE(),ple=SE(),$U="All mapping items must start at the same column";function mle({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??dle.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=wU.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",$U)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||fle.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",$U);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&xU.flowIndentCheck(n.indent,f,i),r.atKey=!1,ple.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let x=wU.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=x.end,x.found){g&&(m?.type==="block-map"&&!x.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var hle=Eo(),gle=pd(),yle=bE();function _le({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??hle.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=gle.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&yle.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}AU.resolveBlockSeq=_le});var oc=v(TU=>{"use strict";function vle(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}TU.resolveEnd=vle});var CU=v(RU=>{"use strict";var ble=Ie(),Sle=xo(),PU=ko(),wle=Eo(),xle=oc(),IU=pd(),$le=$g(),kle=SE(),wE="Block collections are not allowed within flow collections",xE=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Ele({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?PU.YAMLMap:wle.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=xle.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` -`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}RU.resolveFlowCollection=Ele});var NU=v(DU=>{"use strict";var Ale=Ie(),Ole=Et(),Tle=ko(),Ple=Eo(),Ile=EU(),Rle=OU(),Cle=CU();function $E(t,e,r,n,i,o){let s=r.type==="block-map"?Ile.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Rle.resolveBlockSeq(t,e,r,n,o):Cle.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Dle(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),$E(t,e,r,i,s)}let l=$E(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Ale.isNode(u)?u:new Ole.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}DU.composeCollection=Dle});var EE=v(jU=>{"use strict";var kE=Et();function Nle(t,e,r){let n=e.offset,i=jle(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?kE.Scalar.BLOCK_FOLDED:kE.Scalar.BLOCK_LITERAL,s=e.source?Mle(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` +`}};pd.YAMLError=fd;pd.YAMLParseError=bE;pd.YAMLWarning=SE;pd.prettifyError=vle});var hd=v(v2=>{"use strict";function ble(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,x=null,$=null,w=null;for(let A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let N=A.source.substring(1)||" ";d?d+=f+N:d=N,f="",l=!1;break}case"newline":l?d?d+=A.source:(!$||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),$&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),$=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){x&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),x=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let R=t[t.length-1],O=R?R.offset+R.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:x,found:$,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:O,start:w??O}}v2.resolveProps=ble});var Ag=v(b2=>{"use strict";function wE(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` +`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(wE(e.key)||wE(e.value))return!0}return!1;default:return!0}}b2.containsNewline=wE});var xE=v(S2=>{"use strict";var Sle=Ag();function wle(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Sle.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}S2.flowIndentCheck=wle});var $E=v(x2=>{"use strict";var w2=Ie();function xle(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||w2.isScalar(o)&&w2.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}x2.mapIncludes=xle});var O2=v(T2=>{"use strict";var $2=xo(),$le=ko(),k2=hd(),kle=Ag(),E2=xE(),Ele=$E(),A2="All mapping items must start at the same column";function Ale({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??$le.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=k2.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",A2)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||kle.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",A2);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&E2.flowIndentCheck(n.indent,f,i),r.atKey=!1,Ele.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let x=k2.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=x.end,x.found){g&&(m?.type==="block-map"&&!x.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var Tle=Eo(),Ole=hd(),Ple=xE();function Ile({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Tle.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=Ole.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&Ple.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}P2.resolveBlockSeq=Ile});var oc=v(R2=>{"use strict";function Rle(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}R2.resolveEnd=Rle});var j2=v(N2=>{"use strict";var Cle=Ie(),Dle=xo(),C2=ko(),Nle=Eo(),jle=oc(),D2=hd(),Mle=Ag(),zle=$E(),kE="Block collections are not allowed within flow collections",EE=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Fle({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?C2.YAMLMap:Nle.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=jle.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` +`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}N2.resolveFlowCollection=Fle});var z2=v(M2=>{"use strict";var Lle=Ie(),Ule=At(),qle=ko(),Ble=Eo(),Zle=O2(),Hle=I2(),Gle=j2();function AE(t,e,r,n,i,o){let s=r.type==="block-map"?Zle.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Hle.resolveBlockSeq(t,e,r,n,o):Gle.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Vle(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),AE(t,e,r,i,s)}let l=AE(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Lle.isNode(u)?u:new Ule.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}M2.composeCollection=Vle});var OE=v(F2=>{"use strict";var TE=At();function Wle(t,e,r){let n=e.offset,i=Kle(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?TE.Scalar.BLOCK_FOLDED:TE.Scalar.BLOCK_LITERAL,s=e.source?Jle(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` `.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` `:!p&&f===` `&&(f=` @@ -112,131 +112,131 @@ ${l} `+s[h][0].slice(c);d[d.length-1]!==` `&&(d+=` `);break;default:d+=` -`}let m=n+i.length+e.source.length;return{value:d,type:o,comment:i.comment,range:[n,m,m]}}function jle({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let f=1;f{"use strict";var AE=Et(),zle=oc();function Fle(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=AE.Scalar.PLAIN,c=Lle(o,l);break;case"single-quoted-scalar":a=AE.Scalar.QUOTE_SINGLE,c=Ule(o,l);break;case"double-quoted-scalar":a=AE.Scalar.QUOTE_DOUBLE,c=qle(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=zle.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function Lle(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),MU(t)}function Ule(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),MU(t.slice(1,-1)).replace(/''/g,"'")}function MU(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var PE=At(),Yle=oc();function Xle(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=PE.Scalar.PLAIN,c=Qle(o,l);break;case"single-quoted-scalar":a=PE.Scalar.QUOTE_SINGLE,c=eue(o,l);break;case"double-quoted-scalar":a=PE.Scalar.QUOTE_DOUBLE,c=tue(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=Yle.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function Qle(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),L2(t)}function eue(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),L2(t.slice(1,-1)).replace(/''/g,"'")}function L2(t){let e,r;try{e=new RegExp(`(.*?)(?o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function Ble(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` +`)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function rue(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` `||n==="\r")&&!(n==="\r"&&t[e+2]!==` `);)n===` `&&(r+=` -`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var Zle={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Hle(t,e,r,n){let i=t.substr(e,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}zU.resolveFlowScalar=Fle});var UU=v(LU=>{"use strict";var js=Ie(),FU=Et(),Gle=EE(),Vle=OE();function Wle(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Gle.resolveBlockScalar(t,e,n):Vle.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[js.SCALAR]:c?l=Kle(t.schema,i,c,r,n):e.type==="scalar"?l=Jle(t,i,e,n):l=t.schema[js.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=js.isScalar(d)?d:new FU.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new FU.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Kle(t,e,r,n,i){if(r==="!")return t[js.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[js.SCALAR])}function Jle({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[js.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[js.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}LU.composeScalar=Wle});var BU=v(qU=>{"use strict";function Yle(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}qU.emptyScalarPosition=Yle});var GU=v(PE=>{"use strict";var Xle=Vu(),Qle=Ie(),eue=NU(),ZU=UU(),tue=oc(),rue=BU(),nue={composeNode:HU,composeEmptyNode:TE};function HU(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=iue(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=ZU.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=eue.composeCollection(nue,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=TE(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Qle.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function TE(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:rue.emptyScalarPosition(e,r,n),indent:-1,source:""},d=ZU.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function iue({options:t},{offset:e,source:r,end:n},i){let o=new Xle.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=tue.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}PE.composeEmptyNode=TE;PE.composeNode=HU});var KU=v(WU=>{"use strict";var oue=ld(),VU=GU(),sue=oc(),aue=pd();function cue(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new oue.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=aue.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?VU.composeNode(l,i,u,s):VU.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=sue.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}WU.composeDoc=cue});var RE=v(XU=>{"use strict";var lue=Le("process"),uue=yk(),due=ld(),md=fd(),JU=Ie(),fue=KU(),pue=oc();function hd(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function YU(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var js=Ie(),q2=At(),oue=OE(),sue=IE();function aue(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?oue.resolveBlockScalar(t,e,n):sue.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[js.SCALAR]:c?l=cue(t.schema,i,c,r,n):e.type==="scalar"?l=lue(t,i,e,n):l=t.schema[js.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=js.isScalar(d)?d:new q2.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new q2.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function cue(t,e,r,n,i){if(r==="!")return t[js.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[js.SCALAR])}function lue({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[js.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[js.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}B2.composeScalar=aue});var G2=v(H2=>{"use strict";function uue(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}H2.emptyScalarPosition=uue});var K2=v(CE=>{"use strict";var due=Ku(),fue=Ie(),pue=z2(),V2=Z2(),mue=oc(),hue=G2(),gue={composeNode:W2,composeEmptyNode:RE};function W2(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=yue(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=V2.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=pue.composeCollection(gue,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=RE(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!fue.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function RE(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:hue.emptyScalarPosition(e,r,n),indent:-1,source:""},d=V2.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function yue({options:t},{offset:e,source:r,end:n},i){let o=new due.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=mue.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}CE.composeEmptyNode=RE;CE.composeNode=W2});var X2=v(Y2=>{"use strict";var _ue=dd(),J2=K2(),vue=oc(),bue=hd();function Sue(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new _ue.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=bue.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?J2.composeNode(l,i,u,s):J2.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=vue.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}Y2.composeDoc=Sue});var NE=v(tq=>{"use strict";var wue=Le("process"),xue=bk(),$ue=dd(),gd=md(),Q2=Ie(),kue=X2(),Eue=oc();function yd(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function eq(t){let e="",r=!1,n=!1;for(let i=0;i{let s=hd(r);o?this.warnings.push(new md.YAMLWarning(s,n,i)):this.errors.push(new md.YAMLParseError(s,n,i))},this.directives=new uue.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=YU(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} -${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(JU.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];JU.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} +`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var DE=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=yd(r);o?this.warnings.push(new gd.YAMLWarning(s,n,i)):this.errors.push(new gd.YAMLParseError(s,n,i))},this.directives=new xue.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=eq(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} +${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(Q2.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];Q2.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} ${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n} -${s}`:n}}if(r){for(let o=0;o{let o=hd(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=fue.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new md.YAMLParseError(hd(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new md.YAMLParseError(hd(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=pue.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} -${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new md.YAMLParseError(hd(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new due.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};XU.Composer=IE});var tq=v(kg=>{"use strict";var mue=EE(),hue=OE(),gue=fd(),QU=Xu();function yue(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new gue.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return hue.resolveFlowScalar(t,e,n);case"block-scalar":return mue.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function _ue(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=QU.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` +${s}`:n}}if(r){for(let o=0;o{let o=yd(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=kue.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new gd.YAMLParseError(yd(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new gd.YAMLParseError(yd(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Eue.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} +${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new gd.YAMLParseError(yd(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new $ue.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};tq.Composer=DE});var iq=v(Tg=>{"use strict";var Aue=OE(),Tue=IE(),Oue=md(),rq=ed();function Pue(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new Oue.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Tue.resolveFlowScalar(t,e,n);case"block-scalar":return Aue.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Iue(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=rq.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` `}];switch(a[0]){case"|":case">":{let l=a.indexOf(` `),u=a.substring(0,l),d=a.substring(l+1)+` -`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return eq(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` -`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function vue(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=QU.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":bue(t,c);break;case'"':CE(t,c,"double-quoted-scalar");break;case"'":CE(t,c,"single-quoted-scalar");break;default:CE(t,c,"scalar")}}function bue(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return nq(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` +`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function Rue(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=rq.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Cue(t,c);break;case'"':jE(t,c,"double-quoted-scalar");break;case"'":jE(t,c,"single-quoted-scalar");break;default:jE(t,c,"scalar")}}function Cue(t,e){let r=e.indexOf(` `),n=e.substring(0,r),i=e.substring(r+1)+` -`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];eq(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` -`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function eq(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function CE(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` -`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}kg.createScalarToken=_ue;kg.resolveAsScalar=yue;kg.setScalarValue=vue});var nq=v(rq=>{"use strict";var Sue=t=>"type"in t?Ag(t):Eg(t);function Ag(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Ag(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Eg(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Eg(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Eg(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function Eg({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Ag(e)),r)for(let o of r)i+=o.source;return n&&(i+=Ag(n)),i}rq.stringify=Sue});var aq=v(sq=>{"use strict";var DE=Symbol("break visit"),wue=Symbol("skip children"),iq=Symbol("remove item");function Ms(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),oq(Object.freeze([]),t,e)}Ms.BREAK=DE;Ms.SKIP=wue;Ms.REMOVE=iq;Ms.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};Ms.parentCollection=(t,e)=>{let r=Ms.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function oq(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var NE=tq(),xue=nq(),$ue=aq(),jE="\uFEFF",ME="",zE="",FE="",kue=t=>!!t&&"items"in t,Eue=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Aue(t){switch(t){case jE:return"";case ME:return"";case zE:return"";case FE:return"";default:return JSON.stringify(t)}}function Oue(t){switch(t){case jE:return"byte-order-mark";case ME:return"doc-mode";case zE:return"flow-error-end";case FE:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];nq(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` +`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function nq(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function jE(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` +`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}Tg.createScalarToken=Iue;Tg.resolveAsScalar=Pue;Tg.setScalarValue=Rue});var sq=v(oq=>{"use strict";var Due=t=>"type"in t?Pg(t):Og(t);function Pg(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Pg(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Og(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Og(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Og(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function Og({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Pg(e)),r)for(let o of r)i+=o.source;return n&&(i+=Pg(n)),i}oq.stringify=Due});var uq=v(lq=>{"use strict";var ME=Symbol("break visit"),Nue=Symbol("skip children"),aq=Symbol("remove item");function Ms(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),cq(Object.freeze([]),t,e)}Ms.BREAK=ME;Ms.SKIP=Nue;Ms.REMOVE=aq;Ms.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};Ms.parentCollection=(t,e)=>{let r=Ms.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function cq(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var zE=iq(),jue=sq(),Mue=uq(),FE="\uFEFF",LE="",UE="",qE="",zue=t=>!!t&&"items"in t,Fue=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Lue(t){switch(t){case FE:return"";case LE:return"";case UE:return"";case qE:return"";default:return JSON.stringify(t)}}function Uue(t){switch(t){case FE:return"byte-order-mark";case LE:return"doc-mode";case UE:return"flow-error-end";case qE:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r -`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}xr.createScalarToken=NE.createScalarToken;xr.resolveAsScalar=NE.resolveAsScalar;xr.setScalarValue=NE.setScalarValue;xr.stringify=xue.stringify;xr.visit=$ue.visit;xr.BOM=jE;xr.DOCUMENT=ME;xr.FLOW_END=zE;xr.SCALAR=FE;xr.isCollection=kue;xr.isScalar=Eue;xr.prettyToken=Aue;xr.tokenType=Oue});var qE=v(lq=>{"use strict";var gd=Og();function In(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var cq=new Set("0123456789ABCDEFabcdef"),Tue=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Tg=new Set(",[]{}"),Pue=new Set(` ,[]{} -\r `),LE=t=>!t||Pue.has(t),UE=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}xr.createScalarToken=zE.createScalarToken;xr.resolveAsScalar=zE.resolveAsScalar;xr.setScalarValue=zE.setScalarValue;xr.stringify=jue.stringify;xr.visit=Mue.visit;xr.BOM=FE;xr.DOCUMENT=LE;xr.FLOW_END=UE;xr.SCALAR=qE;xr.isCollection=zue;xr.isScalar=Fue;xr.prettyToken=Lue;xr.tokenType=Uue});var HE=v(fq=>{"use strict";var _d=Ig();function In(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var dq=new Set("0123456789ABCDEFabcdef"),que=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Rg=new Set(",[]{}"),Bue=new Set(` ,[]{} +\r `),BE=t=>!t||Bue.has(t),ZE=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` `?!0:r==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===` `||!i&&!this.atEnd)return e+n+1}return r===` `||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&In(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!In(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&In(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(LE),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&nthis.indentValue&&!In(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&In(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(BE),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>In(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case` `:e=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===` `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(` `,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===` `;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===` -`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield gd.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(In(o)||e&&Tg.has(o))break;r=n}else if(In(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` +`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield _d.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(In(o)||e&&Rg.has(o))break;r=n}else if(In(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&Tg.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Tg.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield gd.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(LE),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(In(n)||r&&Tg.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!In(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(Tue.has(r))r=this.buffer[++e];else if(r==="%"&&cq.has(this.buffer[e+1])&&cq.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` +`,o=this.buffer[n+1]):r=n),o==="#"||e&&Rg.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Rg.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield _d.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(BE),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(In(n)||r&&Rg.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!In(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(que.has(r))r=this.buffer[++e];else if(r==="%"&&dq.has(this.buffer[e+1])&&dq.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};lq.Lexer=UE});var ZE=v(uq=>{"use strict";var BE=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var Iue=Le("process"),dq=Og(),Rue=qE();function Ao(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Ig(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&pq(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&fq(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};fq.Lexer=ZE});var VE=v(pq=>{"use strict";var GE=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var Zue=Le("process"),mq=Ig(),Hue=HE();function Ao(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Dg(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&gq(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&hq(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ao(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(mq(r.key)&&!Ao(r.sep,"newline")){let s=sc(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Ao(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=sc(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Ao(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Ao(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Ig(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Ao(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Pg(n),o=sc(i);pq(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` +`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Dg(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ao(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(yq(r.key)&&!Ao(r.sep,"newline")){let s=sc(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Ao(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=sc(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Ao(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Ao(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Dg(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Ao(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Cg(n),o=sc(i);gq(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(` -`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Pg(e),n=sc(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Pg(e),n=sc(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};hq.Parser=HE});var bq=v(_d=>{"use strict";var gq=RE(),Cue=ld(),yd=fd(),Due=Pk(),Nue=Ie(),jue=ZE(),yq=GE();function _q(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new jue.LineCounter||null,prettyErrors:e}}function Mue(t,e={}){let{lineCounter:r,prettyErrors:n}=_q(e),i=new yq.Parser(r?.addNewLine),o=new gq.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(yd.prettifyError(t,r)),a.warnings.forEach(yd.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function vq(t,e={}){let{lineCounter:r,prettyErrors:n}=_q(e),i=new yq.Parser(r?.addNewLine),o=new gq.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new yd.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(yd.prettifyError(t,r)),s.warnings.forEach(yd.prettifyError(t,r))),s}function zue(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=vq(t,r);if(!i)return null;if(i.warnings.forEach(o=>Due.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function Fue(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return Nue.isDocument(t)&&!n?t.toString(r):new Cue.Document(t,n,r).toString(r)}_d.parse=zue;_d.parseAllDocuments=Mue;_d.parseDocument=vq;_d.stringify=Fue});var tr=v(Ue=>{"use strict";var Lue=RE(),Uue=ld(),que=fE(),VE=fd(),Bue=Vu(),Oo=Ie(),Zue=xo(),Hue=Et(),Gue=ko(),Vue=Eo(),Wue=Og(),Kue=qE(),Jue=ZE(),Yue=GE(),Rg=bq(),Sq=Bu();Ue.Composer=Lue.Composer;Ue.Document=Uue.Document;Ue.Schema=que.Schema;Ue.YAMLError=VE.YAMLError;Ue.YAMLParseError=VE.YAMLParseError;Ue.YAMLWarning=VE.YAMLWarning;Ue.Alias=Bue.Alias;Ue.isAlias=Oo.isAlias;Ue.isCollection=Oo.isCollection;Ue.isDocument=Oo.isDocument;Ue.isMap=Oo.isMap;Ue.isNode=Oo.isNode;Ue.isPair=Oo.isPair;Ue.isScalar=Oo.isScalar;Ue.isSeq=Oo.isSeq;Ue.Pair=Zue.Pair;Ue.Scalar=Hue.Scalar;Ue.YAMLMap=Gue.YAMLMap;Ue.YAMLSeq=Vue.YAMLSeq;Ue.CST=Wue;Ue.Lexer=Kue.Lexer;Ue.LineCounter=Jue.LineCounter;Ue.Parser=Yue.Parser;Ue.parse=Rg.parse;Ue.parseAllDocuments=Rg.parseAllDocuments;Ue.parseDocument=Rg.parseDocument;Ue.stringify=Rg.stringify;Ue.visit=Sq.visit;Ue.visitAsync=Sq.visitAsync});import{execFileSync as Xue}from"node:child_process";import{existsSync as Que,readFileSync as ede}from"node:fs";import{join as $q}from"node:path";function cc(t,e){return Xue("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function jg(t){try{let e=cc(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function Mg(t,e){tde(t,e);let r=cc(t,["rev-parse","HEAD"]).trim(),n=rde(t,e);return{groups:nde(t,n),head:r,inventory:{after:xq(Dg(t,"spec.yaml")),before:xq(WE(t,e,"spec.yaml"))},since:e,unsharded_commits:ade(t,e)}}function KE(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function tde(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");try{cc(t,["rev-parse","--verify","--quiet",`${r}^{commit}`])}catch{throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}}function rde(t,e){let r=cc(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!wq(c)&&!wq(a)))if(s.startsWith("A")){let l=Cg(Dg(t,c));if(!l)continue;l.status==="done"?n.push(ac(l,"added-as-done")):l.status==="archived"&&n.push(ac(l,"archived"))}else if(s.startsWith("D")){let l=Cg(WE(t,e,a));l&&n.push(ac(l,"archived"))}else{let l=Cg(Dg(t,c));if(!l)continue;let d=Cg(WE(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(ac(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(ac(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(ac(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function wq(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function ac(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>KE(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function Cg(t){if(t===null)return null;let e;try{e=(0,Ng.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function Dg(t,e){let r=$q(t,e);if(!Que(r))return null;try{return ede(r,"utf8")}catch{return null}}function WE(t,e,r){try{return cc(t,["show",`${e}:${r}`])}catch{return null}}function nde(t,e){let r=ide(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function ide(t){let e=Dg(t,$q("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,Ng.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function xq(t){let e={};if(t!==null)try{let n=(0,Ng.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function ade(t,e){let r=cc(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);ode.test(a)&&(sde.test(a)||n.push({hash:s,subject:a}))}return n}var Ng,ode,sde,zg=y(()=>{"use strict";Ng=St(tr(),1);ode=/^(feat|fix)(\([^)]*\))?!?:/,sde=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{existsSync as cde}from"node:fs";import{join as lde}from"node:path";function Fg(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${ude[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` -`)}function Lg(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${fde(l,r)} |`)}return n.join(` -`)}function fde(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of dde)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${cde(lde(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function Ug(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),kq(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)kq(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function kq(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=KE(r);n&&t.push(`- ${n}`)}t.push("")}var ude,dde,JE=y(()=>{"use strict";zg();ude={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};dde=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as pde}from"node:fs";function ii(t="./spec.yaml"){let e=pde(t,"utf8");return(0,Eq.parse)(e)}var Eq,qg=y(()=>{"use strict";Eq=St(tr(),1)});var To=v(($r,eA)=>{"use strict";var YE=$r.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+Oq(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};YE.prototype.toString=function(){return this.property+" "+this.message};var Bg=$r.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};Bg.prototype.addError=function(e){var r;if(typeof e=="string")r=new YE(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new YE(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new zs(this);if(this.throwError)throw r;return r};Bg.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function mde(t,e){return e+": "+t.toString()+` -`}Bg.prototype.toString=function(e){return this.errors.map(mde).join("")};Object.defineProperty(Bg.prototype,"valid",{get:function(){return!this.errors.length}});eA.exports.ValidatorResultError=zs;function zs(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,zs),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}zs.prototype=new Error;zs.prototype.constructor=zs;zs.prototype.name="Validation Error";var Aq=$r.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};Aq.prototype=Object.create(Error.prototype,{constructor:{value:Aq,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var XE=$r.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+Oq(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};XE.prototype.resolve=function(e){return Tq(this.base,e)};XE.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=Tq(this.base,i||"");var s=new XE(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Rn=$r.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};Rn.regexp=Rn.regex;Rn.pattern=Rn.regex;Rn.ipv4=Rn["ip-address"];$r.isFormat=function(e,r,n){if(typeof e=="string"&&Rn[r]!==void 0){if(Rn[r]instanceof RegExp)return Rn[r].test(e);if(typeof Rn[r]=="function")return Rn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var Oq=$r.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};$r.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function hde(t,e,r,n){typeof r=="object"?e[n]=QE(t[n],r):t.indexOf(r)===-1&&e.push(r)}function gde(t,e,r){e[r]=t[r]}function yde(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=QE(t[n],e[n]):r[n]=e[n]}function QE(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(hde.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(gde.bind(null,t,n)),Object.keys(e).forEach(yde.bind(null,t,e,n))),n}eA.exports.deepMerge=QE;$r.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function _de(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}$r.encodePath=function(e){return e.map(_de).join("")};$r.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};$r.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var Tq=$r.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var Cq=v((tHe,Rq)=>{"use strict";var zr=To(),je=zr.ValidatorResult,Po=zr.SchemaError,tA={};tA.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Me=tA.validators={};Me.type=function(e,r,n,i){if(e===void 0)return null;var o=new je(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function rA(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}Me.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new je(e,r,n,i),s=new je(e,r,n,i);if(!Array.isArray(r.anyOf))throw new Po("anyOf must be an array");if(!r.anyOf.some(rA.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};Me.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new Po("allOf must be an array");var o=new je(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};Me.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new Po("oneOf must be an array");var o=new je(e,r,n,i),s=new je(e,r,n,i),a=r.oneOf.filter(rA.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};Me.if=function(e,r,n,i){if(e===void 0)return null;if(!zr.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=rA.call(this,e,n,i,null,r.if),s=new je(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!zr.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!zr.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function nA(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}Me.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!zr.isSchema(s))throw new Po('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(nA(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Me.properties=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new Po('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=nA(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function Pq(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}Me.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new Po('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&Pq.call(this,e,r,n,i,a,o)}return o}};Me.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new je(e,r,n,i);for(var s in e)Pq.call(this,e,r,n,i,s,o);return o}};Me.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};Me.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};Me.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new je(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};Me.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!zr.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new je(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};Me.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new je(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};Me.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new je(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};Me.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new je(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};Me.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new je(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};Me.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new je(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};Me.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new je(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function vde(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var iA=To();oA.exports.SchemaScanResult=Dq;function Dq(t,e){this.id=t,this.ref=e}oA.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=iA.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=iA.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!iA.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var Nq=Cq(),Io=To(),jq=Zg().scan,Mq=Io.ValidatorResult,bde=Io.ValidatorResultError,vd=Io.SchemaError,zq=Io.SchemaContext,Sde="/",Zt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(oi),this.attributes=Object.create(Nq.validators)};Zt.prototype.customFormats={};Zt.prototype.schemas=null;Zt.prototype.types=null;Zt.prototype.attributes=null;Zt.prototype.unresolvedRefs=null;Zt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=jq(r||Sde,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Zt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=Io.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new vd("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Zt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new vd('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var oi=Zt.prototype.types={};oi.string=function(e){return typeof e=="string"};oi.number=function(e){return typeof e=="number"&&isFinite(e)};oi.integer=function(e){return typeof e=="number"&&e%1===0};oi.boolean=function(e){return typeof e=="boolean"};oi.array=function(e){return Array.isArray(e)};oi.null=function(e){return e===null};oi.date=function(e){return e instanceof Date};oi.any=function(e){return!0};oi.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};Lq.exports=Zt});var qq=v((iHe,Li)=>{"use strict";var wde=Li.exports.Validator=Uq();Li.exports.ValidatorResult=To().ValidatorResult;Li.exports.ValidatorResultError=To().ValidatorResultError;Li.exports.ValidationError=To().ValidationError;Li.exports.SchemaError=To().SchemaError;Li.exports.SchemaScanResult=Zg().SchemaScanResult;Li.exports.scan=Zg().scan;Li.exports.validate=function(t,e,r){var n=new wde;return n.validate(t,e,r)}});import{readFileSync as xde}from"node:fs";import{dirname as $de,join as kde}from"node:path";import{fileURLToPath as Ede}from"node:url";function Ide(t){let e=Pde.validate(t,Tde);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function Zq(t){let e=Ide(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Cg(e),n=sc(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Cg(e),n=sc(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};_q.Parser=WE});var xq=v(bd=>{"use strict";var vq=NE(),Gue=dd(),vd=md(),Vue=Ck(),Wue=Ie(),Kue=VE(),bq=KE();function Sq(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Kue.LineCounter||null,prettyErrors:e}}function Jue(t,e={}){let{lineCounter:r,prettyErrors:n}=Sq(e),i=new bq.Parser(r?.addNewLine),o=new vq.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(vd.prettifyError(t,r)),a.warnings.forEach(vd.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function wq(t,e={}){let{lineCounter:r,prettyErrors:n}=Sq(e),i=new bq.Parser(r?.addNewLine),o=new vq.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new vd.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(vd.prettifyError(t,r)),s.warnings.forEach(vd.prettifyError(t,r))),s}function Yue(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=wq(t,r);if(!i)return null;if(i.warnings.forEach(o=>Vue.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function Xue(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return Wue.isDocument(t)&&!n?t.toString(r):new Gue.Document(t,n,r).toString(r)}bd.parse=Yue;bd.parseAllDocuments=Jue;bd.parseDocument=wq;bd.stringify=Xue});var tr=v(Ue=>{"use strict";var Que=NE(),ede=dd(),tde=hE(),JE=md(),rde=Ku(),To=Ie(),nde=xo(),ide=At(),ode=ko(),sde=Eo(),ade=Ig(),cde=HE(),lde=VE(),ude=KE(),Ng=xq(),$q=Hu();Ue.Composer=Que.Composer;Ue.Document=ede.Document;Ue.Schema=tde.Schema;Ue.YAMLError=JE.YAMLError;Ue.YAMLParseError=JE.YAMLParseError;Ue.YAMLWarning=JE.YAMLWarning;Ue.Alias=rde.Alias;Ue.isAlias=To.isAlias;Ue.isCollection=To.isCollection;Ue.isDocument=To.isDocument;Ue.isMap=To.isMap;Ue.isNode=To.isNode;Ue.isPair=To.isPair;Ue.isScalar=To.isScalar;Ue.isSeq=To.isSeq;Ue.Pair=nde.Pair;Ue.Scalar=ide.Scalar;Ue.YAMLMap=ode.YAMLMap;Ue.YAMLSeq=sde.YAMLSeq;Ue.CST=ade;Ue.Lexer=cde.Lexer;Ue.LineCounter=lde.LineCounter;Ue.Parser=ude.Parser;Ue.parse=Ng.parse;Ue.parseAllDocuments=Ng.parseAllDocuments;Ue.parseDocument=Ng.parseDocument;Ue.stringify=Ng.stringify;Ue.visit=$q.visit;Ue.visitAsync=$q.visitAsync});import{execFileSync as dde}from"node:child_process";import{existsSync as fde,readFileSync as pde}from"node:fs";import{join as Aq}from"node:path";function cc(t,e){return dde("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Fg(t){try{let e=cc(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function Lg(t,e){mde(t,e);let r=cc(t,["rev-parse","HEAD"]).trim(),n=hde(t,e);return{groups:gde(t,n),head:r,inventory:{after:Eq(Mg(t,"spec.yaml")),before:Eq(YE(t,e,"spec.yaml"))},since:e,unsharded_commits:bde(t,e)}}function XE(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function mde(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");try{cc(t,["rev-parse","--verify","--quiet",`${r}^{commit}`])}catch{throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}}function hde(t,e){let r=cc(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!kq(c)&&!kq(a)))if(s.startsWith("A")){let l=jg(Mg(t,c));if(!l)continue;l.status==="done"?n.push(ac(l,"added-as-done")):l.status==="archived"&&n.push(ac(l,"archived"))}else if(s.startsWith("D")){let l=jg(YE(t,e,a));l&&n.push(ac(l,"archived"))}else{let l=jg(Mg(t,c));if(!l)continue;let d=jg(YE(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(ac(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(ac(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(ac(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function kq(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function ac(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>XE(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function jg(t){if(t===null)return null;let e;try{e=(0,zg.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function Mg(t,e){let r=Aq(t,e);if(!fde(r))return null;try{return pde(r,"utf8")}catch{return null}}function YE(t,e,r){try{return cc(t,["show",`${e}:${r}`])}catch{return null}}function gde(t,e){let r=yde(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function yde(t){let e=Mg(t,Aq("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,zg.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function Eq(t){let e={};if(t!==null)try{let n=(0,zg.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function bde(t,e){let r=cc(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);_de.test(a)&&(vde.test(a)||n.push({hash:s,subject:a}))}return n}var zg,_de,vde,Ug=y(()=>{"use strict";zg=St(tr(),1);_de=/^(feat|fix)(\([^)]*\))?!?:/,vde=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{existsSync as Sde}from"node:fs";import{join as wde}from"node:path";function qg(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${xde[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` +`)}function Bg(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${kde(l,r)} |`)}return n.join(` +`)}function kde(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of $de)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Sde(wde(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function Zg(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),Tq(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)Tq(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function Tq(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=XE(r);n&&t.push(`- ${n}`)}t.push("")}var xde,$de,QE=y(()=>{"use strict";Ug();xde={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};$de=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Ede}from"node:fs";function ii(t="./spec.yaml"){let e=Ede(t,"utf8");return(0,Oq.parse)(e)}var Oq,Hg=y(()=>{"use strict";Oq=St(tr(),1)});var Oo=v(($r,nA)=>{"use strict";var eA=$r.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+Iq(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};eA.prototype.toString=function(){return this.property+" "+this.message};var Gg=$r.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};Gg.prototype.addError=function(e){var r;if(typeof e=="string")r=new eA(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new eA(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new zs(this);if(this.throwError)throw r;return r};Gg.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Ade(t,e){return e+": "+t.toString()+` +`}Gg.prototype.toString=function(e){return this.errors.map(Ade).join("")};Object.defineProperty(Gg.prototype,"valid",{get:function(){return!this.errors.length}});nA.exports.ValidatorResultError=zs;function zs(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,zs),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}zs.prototype=new Error;zs.prototype.constructor=zs;zs.prototype.name="Validation Error";var Pq=$r.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};Pq.prototype=Object.create(Error.prototype,{constructor:{value:Pq,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var tA=$r.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+Iq(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};tA.prototype.resolve=function(e){return Rq(this.base,e)};tA.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=Rq(this.base,i||"");var s=new tA(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Rn=$r.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};Rn.regexp=Rn.regex;Rn.pattern=Rn.regex;Rn.ipv4=Rn["ip-address"];$r.isFormat=function(e,r,n){if(typeof e=="string"&&Rn[r]!==void 0){if(Rn[r]instanceof RegExp)return Rn[r].test(e);if(typeof Rn[r]=="function")return Rn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var Iq=$r.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};$r.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function Tde(t,e,r,n){typeof r=="object"?e[n]=rA(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Ode(t,e,r){e[r]=t[r]}function Pde(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=rA(t[n],e[n]):r[n]=e[n]}function rA(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Tde.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Ode.bind(null,t,n)),Object.keys(e).forEach(Pde.bind(null,t,e,n))),n}nA.exports.deepMerge=rA;$r.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function Ide(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}$r.encodePath=function(e){return e.map(Ide).join("")};$r.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};$r.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var Rq=$r.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var jq=v((wHe,Nq)=>{"use strict";var zr=Oo(),je=zr.ValidatorResult,Po=zr.SchemaError,iA={};iA.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Me=iA.validators={};Me.type=function(e,r,n,i){if(e===void 0)return null;var o=new je(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function oA(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}Me.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new je(e,r,n,i),s=new je(e,r,n,i);if(!Array.isArray(r.anyOf))throw new Po("anyOf must be an array");if(!r.anyOf.some(oA.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};Me.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new Po("allOf must be an array");var o=new je(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};Me.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new Po("oneOf must be an array");var o=new je(e,r,n,i),s=new je(e,r,n,i),a=r.oneOf.filter(oA.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};Me.if=function(e,r,n,i){if(e===void 0)return null;if(!zr.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=oA.call(this,e,n,i,null,r.if),s=new je(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!zr.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!zr.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function sA(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}Me.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!zr.isSchema(s))throw new Po('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(sA(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Me.properties=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new Po('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=sA(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function Cq(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}Me.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new Po('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&Cq.call(this,e,r,n,i,a,o)}return o}};Me.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new je(e,r,n,i);for(var s in e)Cq.call(this,e,r,n,i,s,o);return o}};Me.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};Me.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};Me.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new je(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};Me.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!zr.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new je(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};Me.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new je(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};Me.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new je(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};Me.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new je(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};Me.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new je(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};Me.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new je(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};Me.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new je(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function Rde(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var aA=Oo();cA.exports.SchemaScanResult=Mq;function Mq(t,e){this.id=t,this.ref=e}cA.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=aA.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=aA.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!aA.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var zq=jq(),Io=Oo(),Fq=Vg().scan,Lq=Io.ValidatorResult,Cde=Io.ValidatorResultError,Sd=Io.SchemaError,Uq=Io.SchemaContext,Dde="/",Zt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(oi),this.attributes=Object.create(zq.validators)};Zt.prototype.customFormats={};Zt.prototype.schemas=null;Zt.prototype.types=null;Zt.prototype.attributes=null;Zt.prototype.unresolvedRefs=null;Zt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=Fq(r||Dde,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Zt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=Io.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Sd("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Zt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Sd('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var oi=Zt.prototype.types={};oi.string=function(e){return typeof e=="string"};oi.number=function(e){return typeof e=="number"&&isFinite(e)};oi.integer=function(e){return typeof e=="number"&&e%1===0};oi.boolean=function(e){return typeof e=="boolean"};oi.array=function(e){return Array.isArray(e)};oi.null=function(e){return e===null};oi.date=function(e){return e instanceof Date};oi.any=function(e){return!0};oi.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};Bq.exports=Zt});var Hq=v((kHe,Li)=>{"use strict";var Nde=Li.exports.Validator=Zq();Li.exports.ValidatorResult=Oo().ValidatorResult;Li.exports.ValidatorResultError=Oo().ValidatorResultError;Li.exports.ValidationError=Oo().ValidationError;Li.exports.SchemaError=Oo().SchemaError;Li.exports.SchemaScanResult=Vg().SchemaScanResult;Li.exports.scan=Vg().scan;Li.exports.validate=function(t,e,r){var n=new Nde;return n.validate(t,e,r)}});import{readFileSync as jde}from"node:fs";import{dirname as Mde,join as zde}from"node:path";import{fileURLToPath as Fde}from"node:url";function Zde(t){let e=Bde.validate(t,qde);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function Vq(t){let e=Zde(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var Bq,Ade,Ode,Tde,Pde,Hq=y(()=>{"use strict";Bq=St(qq(),1),Ade=$de(Ede(import.meta.url)),Ode=kde(Ade,"schema.json"),Tde=JSON.parse(xde(Ode,"utf8")),Pde=new Bq.Validator});import{existsSync as sA,readdirSync as Rde}from"node:fs";import{dirname as Cde,join as Fs,resolve as Vq}from"node:path";function Gq(t){return sA(t)?Rde(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ii(Fs(t,r))):[]}function Gg(t,e){Hg=e?{cwd:Vq(t),spec:e}:null}function se(t=".",e="spec.yaml"){return Hg&&e==="spec.yaml"&&Vq(t)===Hg.cwd?Hg.spec:Dde(t,e)}function Dde(t,e){let r=Fs(t,e),n=ii(r),i=Fs(t,Cde(e),"spec");if(!n.features||n.features.length===0){let o=Gq(Fs(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=Gq(Fs(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Fs(i,"architecture.yaml");sA(o)&&(n.architecture=ii(o))}if(!n.capabilities||n.capabilities.length===0){let o=Fs(i,"capabilities.yaml");if(sA(o)){let s=ii(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return Zq(n),n}var Hg,At=y(()=>{"use strict";qg();Hq();Hg=null});import lc from"node:process";function lA(){return!!lc.stdout.isTTY}function X(t,e,r=""){let n=Wq[t],i=r?` ${r}`:"";lA()?lc.stdout.write(`${aA[t]}${n}${cA} ${e}${i} + `)}`)}var Gq,Lde,Ude,qde,Bde,Wq=y(()=>{"use strict";Gq=St(Hq(),1),Lde=Mde(Fde(import.meta.url)),Ude=zde(Lde,"schema.json"),qde=JSON.parse(jde(Ude,"utf8")),Bde=new Gq.Validator});import{existsSync as lA,readdirSync as Hde}from"node:fs";import{dirname as Gde,join as Fs,resolve as Jq}from"node:path";function Kq(t){return lA(t)?Hde(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ii(Fs(t,r))):[]}function Kg(t,e){Wg=e?{cwd:Jq(t),spec:e}:null}function se(t=".",e="spec.yaml"){return Wg&&e==="spec.yaml"&&Jq(t)===Wg.cwd?Wg.spec:Vde(t,e)}function Vde(t,e){let r=Fs(t,e),n=ii(r),i=Fs(t,Gde(e),"spec");if(!n.features||n.features.length===0){let o=Kq(Fs(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=Kq(Fs(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Fs(i,"architecture.yaml");lA(o)&&(n.architecture=ii(o))}if(!n.capabilities||n.capabilities.length===0){let o=Fs(i,"capabilities.yaml");if(lA(o)){let s=ii(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return Vq(n),n}var Wg,Tt=y(()=>{"use strict";Hg();Wq();Wg=null});import lc from"node:process";function fA(){return!!lc.stdout.isTTY}function X(t,e,r=""){let n=Yq[t],i=r?` ${r}`:"";fA()?lc.stdout.write(`${uA[t]}${n}${dA} ${e}${i} `):lc.stdout.write(`${n} ${e}${i} -`)}function bd(t,e,r=""){if(!lA())return;let n=r?` ${r}`:"";lc.stdout.write(`${Kq}${aA.start}\xB7${cA} ${t} \xB7 ${e}${n}`)}function Ls(t,e,r=""){let n=Wq[t],i=r?` ${r}`:"";lA()?lc.stdout.write(`${Kq}${aA[t]}${n}${cA} ${e}${i} +`)}function wd(t,e,r=""){if(!fA())return;let n=r?` ${r}`:"";lc.stdout.write(`${Xq}${uA.start}\xB7${dA} ${t} \xB7 ${e}${n}`)}function Ls(t,e,r=""){let n=Yq[t],i=r?` ${r}`:"";fA()?lc.stdout.write(`${Xq}${uA[t]}${n}${dA} ${e}${i} `):lc.stdout.write(`${n} ${e}${i} -`)}var Wq,aA,cA,Kq,uc=y(()=>{"use strict";Wq={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},aA={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},cA="\x1B[0m",Kq="\r\x1B[K"});import{execFileSync as Yq}from"node:child_process";import{appendFileSync as Nde,existsSync as uA,mkdirSync as jde,readFileSync as Mde,renameSync as zde,statSync as Fde}from"node:fs";import{userInfo as Lde}from"node:os";import{dirname as Ude,join as Xq}from"node:path";function Qq(t){return Xq(t,qde,Bde)}function Fr(t,e){let r=Qq(t),n=Ude(r);uA(n)||jde(n,{recursive:!0});try{uA(r)&&Fde(r).size>Hde&&zde(r,Xq(n,Zde))}catch{}Nde(r,`${JSON.stringify(e)} -`,"utf8")}function Sd(t){let e=Qq(t);if(!uA(e))return[];let r=Mde(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}function Lr(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function Gde(t){let e;try{e=Yq("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Lde().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Vde(t){try{return Yq("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function dA(t,e){try{let r=Sd(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function qi(t,e,r){try{let n=Vde(t),i=Gde(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=dA(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Fr(t,Lr(e,o))}catch{}}var qde,Bde,Zde,Hde,si=y(()=>{"use strict";qde=".cladding",Bde="events.log.jsonl",Zde="events.log.1.jsonl",Hde=5*1024*1024});import{createHash as Wde}from"node:crypto";import{existsSync as Kde,readFileSync as e4,writeFileSync as Jde}from"node:fs";import{join as fA}from"node:path";function wd(t,e){let r=Wde("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(e4(fA(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function dc(t){let e=fA(t,...t4);if(!Kde(e))return null;let r=new Map;try{for(let n of e4(e,"utf8").split(` -`)){let i=n.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);i&&r.set(i[1],i[2])}}catch{return null}return r}function r4(t,e){let r=(e.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return!1;let i=`# Cladding \xB7 Tier C \u2014 verification attestation (GREEN strict pre-push gate). Do not edit by hand. +`)}var Yq,uA,dA,Xq,uc=y(()=>{"use strict";Yq={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},uA={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},dA="\x1B[0m",Xq="\r\x1B[K"});import{execFileSync as e4}from"node:child_process";import{appendFileSync as Wde,existsSync as pA,mkdirSync as Kde,readFileSync as Jde,renameSync as Yde,statSync as Xde}from"node:fs";import{userInfo as Qde}from"node:os";import{dirname as efe,join as t4}from"node:path";function r4(t){return t4(t,tfe,rfe)}function Fr(t,e){let r=r4(t),n=efe(r);pA(n)||Kde(n,{recursive:!0});try{pA(r)&&Xde(r).size>ife&&Yde(r,t4(n,nfe))}catch{}Wde(r,`${JSON.stringify(e)} +`,"utf8")}function xd(t){let e=r4(t);if(!pA(e))return[];let r=Jde(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}function Lr(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function ofe(t){let e;try{e=e4("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Qde().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function sfe(t){try{return e4("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function mA(t,e){try{let r=xd(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function qi(t,e,r){try{let n=sfe(t),i=ofe(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=mA(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Fr(t,Lr(e,o))}catch{}}var tfe,rfe,nfe,ife,si=y(()=>{"use strict";tfe=".cladding",rfe="events.log.jsonl",nfe="events.log.1.jsonl",ife=5*1024*1024});import{createHash as afe}from"node:crypto";import{existsSync as cfe,readFileSync as n4,writeFileSync as lfe}from"node:fs";import{join as hA}from"node:path";function $d(t,e){let r=afe("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(n4(hA(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function dc(t){let e=hA(t,...i4);if(!cfe(e))return null;let r=new Map;try{for(let n of n4(e,"utf8").split(` +`)){let i=n.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);i&&r.set(i[1],i[2])}}catch{return null}return r}function o4(t,e){let r=(e.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return!1;let i=`# Cladding \xB7 Tier C \u2014 verification attestation (GREEN strict pre-push gate). Do not edit by hand. # One line per done feature: sha256 tree-hash of its modules at the last # attested verification. STALE_ATTESTATION compares; \`clad check # --tier=pre-push --strict\` GREEN refreshes. Content-anchored: survives # fresh clones and squash/rebase (suggested .gitattributes: merge=union). attested: -`+r.map(o=>` ${o.id}: ${wd(t,o.modules??[])}`).sort().join(` +`+r.map(o=>` ${o.id}: ${$d(t,o.modules??[])}`).sort().join(` `)+` -`;return Jde(fA(t,...t4),i,"utf8"),!0}var t4,xd=y(()=>{"use strict";t4=["spec","attestation.yaml"]});function wt(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var Bi=y(()=>{});import{fileURLToPath as sfe}from"node:url";var fc,afe,hA,gA,pc=y(()=>{fc=(t,e)=>{let r=gA(afe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},afe=t=>hA(t)?t.toString():t,hA=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,gA=t=>t instanceof URL?sfe(t):t});var Wg,yA=y(()=>{Bi();pc();Wg=(t,e=[],r={})=>{let n=fc(t,"First argument"),[i,o]=wt(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!wt(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as cfe}from"node:string_decoder";var l4,u4,Nt,Zi,lfe,d4,ufe,Kg,f4,dfe,$d,ffe,_A,pfe,Ur=y(()=>{({toString:l4}=Object.prototype),u4=t=>l4.call(t)==="[object ArrayBuffer]",Nt=t=>l4.call(t)==="[object Uint8Array]",Zi=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),lfe=new TextEncoder,d4=t=>lfe.encode(t),ufe=new TextDecoder,Kg=t=>ufe.decode(t),f4=(t,e)=>dfe(t,e).join(""),dfe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new cfe(e),n=t.map(o=>typeof o=="string"?d4(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},$d=t=>t.length===1&&Nt(t[0])?t[0]:_A(ffe(t)),ffe=t=>t.map(e=>typeof e=="string"?d4(e):e),_A=t=>{let e=new Uint8Array(pfe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},pfe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as mfe}from"node:child_process";var g4,y4,hfe,gfe,p4,yfe,m4,h4,_fe,_4=y(()=>{Bi();Ur();g4=t=>Array.isArray(t)&&Array.isArray(t.raw),y4=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=hfe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},hfe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=gfe(i,t.raw[n]),c=m4(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>h4(d)):[h4(l)];return m4(c,u,a)},gfe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=p4.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],h4=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(wt(t)&&("stdout"in t||"isMaxBuffer"in t))return _fe(t);throw t instanceof mfe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},_fe=({stdout:t})=>{if(typeof t=="string")return t;if(Nt(t))return Kg(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import vA from"node:process";var Cn,Jg,un,Yg,Hi=y(()=>{Cn=t=>Jg.includes(t),Jg=[vA.stdin,vA.stdout,vA.stderr],un=["stdin","stdout","stderr"],Yg=t=>un[t]??`stdio[${t}]`});import{debuglog as vfe}from"node:util";var b4,bA,bfe,Sfe,wfe,xfe,v4,$fe,SA,kfe,Efe,Afe,Ofe,wA,Gi,Vi=y(()=>{Bi();Hi();b4=t=>{let e={...t};for(let r of wA)e[r]=bA(t,r);return e},bA=(t,e)=>{let r=Array.from({length:bfe(t)+1}),n=Sfe(t[e],r,e);return Efe(n,e)},bfe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,un.length):un.length,Sfe=(t,e,r)=>wt(t)?wfe(t,e,r):e.fill(t),wfe=(t,e,r)=>{for(let n of Object.keys(t).sort(xfe))for(let i of $fe(n,r,e))e[i]=t[n];return e},xfe=(t,e)=>v4(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,$fe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=SA(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`;return lfe(hA(t,...i4),i,"utf8"),!0}var i4,kd=y(()=>{"use strict";i4=["spec","attestation.yaml"]});function wt(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var Bi=y(()=>{});import{fileURLToPath as vfe}from"node:url";var fc,bfe,_A,vA,pc=y(()=>{fc=(t,e)=>{let r=vA(bfe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},bfe=t=>_A(t)?t.toString():t,_A=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,vA=t=>t instanceof URL?vfe(t):t});var Yg,bA=y(()=>{Bi();pc();Yg=(t,e=[],r={})=>{let n=fc(t,"First argument"),[i,o]=wt(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!wt(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as Sfe}from"node:string_decoder";var f4,p4,Nt,Zi,wfe,m4,xfe,Xg,h4,$fe,Ed,kfe,SA,Efe,Ur=y(()=>{({toString:f4}=Object.prototype),p4=t=>f4.call(t)==="[object ArrayBuffer]",Nt=t=>f4.call(t)==="[object Uint8Array]",Zi=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),wfe=new TextEncoder,m4=t=>wfe.encode(t),xfe=new TextDecoder,Xg=t=>xfe.decode(t),h4=(t,e)=>$fe(t,e).join(""),$fe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Sfe(e),n=t.map(o=>typeof o=="string"?m4(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Ed=t=>t.length===1&&Nt(t[0])?t[0]:SA(kfe(t)),kfe=t=>t.map(e=>typeof e=="string"?m4(e):e),SA=t=>{let e=new Uint8Array(Efe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Efe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Afe}from"node:child_process";var v4,b4,Tfe,Ofe,g4,Pfe,y4,_4,Ife,S4=y(()=>{Bi();Ur();v4=t=>Array.isArray(t)&&Array.isArray(t.raw),b4=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Tfe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},Tfe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=Ofe(i,t.raw[n]),c=y4(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>_4(d)):[_4(l)];return y4(c,u,a)},Ofe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=g4.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],_4=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(wt(t)&&("stdout"in t||"isMaxBuffer"in t))return Ife(t);throw t instanceof Afe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},Ife=({stdout:t})=>{if(typeof t=="string")return t;if(Nt(t))return Xg(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import wA from"node:process";var Cn,Qg,un,ey,Hi=y(()=>{Cn=t=>Qg.includes(t),Qg=[wA.stdin,wA.stdout,wA.stderr],un=["stdin","stdout","stderr"],ey=t=>un[t]??`stdio[${t}]`});import{debuglog as Rfe}from"node:util";var x4,xA,Cfe,Dfe,Nfe,jfe,w4,Mfe,$A,zfe,Ffe,Lfe,Ufe,kA,Gi,Vi=y(()=>{Bi();Hi();x4=t=>{let e={...t};for(let r of kA)e[r]=xA(t,r);return e},xA=(t,e)=>{let r=Array.from({length:Cfe(t)+1}),n=Dfe(t[e],r,e);return Ffe(n,e)},Cfe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,un.length):un.length,Dfe=(t,e,r)=>wt(t)?Nfe(t,e,r):e.fill(t),Nfe=(t,e,r)=>{for(let n of Object.keys(t).sort(jfe))for(let i of Mfe(n,r,e))e[i]=t[n];return e},jfe=(t,e)=>w4(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,Mfe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=$A(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},SA=t=>{if(t==="all")return t;if(un.includes(t))return un.indexOf(t);let e=kfe.exec(t);if(e!==null)return Number(e[1])},kfe=/^fd(\d+)$/,Efe=(t,e)=>t.map(r=>r===void 0?Ofe[e]:r),Afe=vfe("execa").enabled?"full":"none",Ofe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Afe,stripFinalNewline:!0},wA=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Gi=(t,e)=>e==="ipc"?t.at(-1):t[e]});var mc,hc,S4,xA,Tfe,Xg,Qg,Ro=y(()=>{Vi();mc=({verbose:t},e)=>xA(t,e)!=="none",hc=({verbose:t},e)=>!["none","short"].includes(xA(t,e)),S4=({verbose:t},e)=>{let r=xA(t,e);return Xg(r)?r:void 0},xA=(t,e)=>e===void 0?Tfe(t):Gi(t,e),Tfe=t=>t.find(e=>Xg(e))??Qg.findLast(e=>t.includes(e)),Xg=t=>typeof t=="function",Qg=["none","short","full"]});import{platform as Pfe}from"node:process";import{stripVTControlCharacters as Ife}from"node:util";var w4,kd,x4,Rfe,Cfe,Dfe,Nfe,jfe,Mfe,zfe,ey=y(()=>{w4=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Mfe(x4(o))).join(" ");return{command:n,escapedCommand:i}},kd=t=>Ife(t).split(` -`).map(e=>x4(e)).join(` -`),x4=t=>t.replaceAll(Dfe,e=>Rfe(e)),Rfe=t=>{let e=Nfe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=jfe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Cfe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Dfe=Cfe(),Nfe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},jfe=65535,Mfe=t=>zfe.test(t)?t:Pfe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,zfe=/^[\w./-]+$/});import $4 from"node:process";function $A(){let{env:t}=$4,{TERM:e,TERM_PROGRAM:r}=t;return $4.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var k4=y(()=>{});var E4,A4,Ffe,Lfe,Ufe,qfe,Bfe,ty,yGe,O4=y(()=>{k4();E4={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},A4={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Ffe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Lfe={...E4,...A4},Ufe={...E4,...Ffe},qfe=$A(),Bfe=qfe?Lfe:Ufe,ty=Bfe,yGe=Object.entries(A4)});import Zfe from"node:tty";var Hfe,he,bGe,T4,SGe,wGe,xGe,$Ge,kGe,EGe,AGe,OGe,TGe,PGe,IGe,RGe,CGe,DGe,NGe,ry,jGe,MGe,zGe,FGe,LGe,UGe,qGe,BGe,ZGe,P4,HGe,I4,GGe,VGe,WGe,KGe,JGe,YGe,XGe,QGe,e9e,t9e,r9e,kA=y(()=>{Hfe=Zfe?.WriteStream?.prototype?.hasColors?.()??!1,he=(t,e)=>{if(!Hfe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},bGe=he(0,0),T4=he(1,22),SGe=he(2,22),wGe=he(3,23),xGe=he(4,24),$Ge=he(53,55),kGe=he(7,27),EGe=he(8,28),AGe=he(9,29),OGe=he(30,39),TGe=he(31,39),PGe=he(32,39),IGe=he(33,39),RGe=he(34,39),CGe=he(35,39),DGe=he(36,39),NGe=he(37,39),ry=he(90,39),jGe=he(40,49),MGe=he(41,49),zGe=he(42,49),FGe=he(43,49),LGe=he(44,49),UGe=he(45,49),qGe=he(46,49),BGe=he(47,49),ZGe=he(100,49),P4=he(91,39),HGe=he(92,39),I4=he(93,39),GGe=he(94,39),VGe=he(95,39),WGe=he(96,39),KGe=he(97,39),JGe=he(101,49),YGe=he(102,49),XGe=he(103,49),QGe=he(104,49),e9e=he(105,49),t9e=he(106,49),r9e=he(107,49)});var R4=y(()=>{kA();kA()});var N4,Vfe,ny,C4,Wfe,D4,Kfe,j4=y(()=>{O4();R4();N4=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Vfe(r),c=Wfe[t]({failed:o,reject:s,piped:n}),l=Kfe[t]({reject:s});return`${ry(`[${a}]`)} ${ry(`[${i}]`)} ${l(c)} ${l(e)}`},Vfe=t=>`${ny(t.getHours(),2)}:${ny(t.getMinutes(),2)}:${ny(t.getSeconds(),2)}.${ny(t.getMilliseconds(),3)}`,ny=(t,e)=>String(t).padStart(e,"0"),C4=({failed:t,reject:e})=>t?e?ty.cross:ty.warning:ty.tick,Wfe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:C4,duration:C4},D4=t=>t,Kfe={command:()=>T4,output:()=>D4,ipc:()=>D4,error:({reject:t})=>t?P4:I4,duration:()=>ry}});var M4,Jfe,Yfe,z4=y(()=>{Ro();M4=(t,e,r)=>{let n=S4(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Jfe(i,o,n)).filter(i=>i!==void 0).map(i=>Yfe(i)).join("")},Jfe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Yfe=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},$A=t=>{if(t==="all")return t;if(un.includes(t))return un.indexOf(t);let e=zfe.exec(t);if(e!==null)return Number(e[1])},zfe=/^fd(\d+)$/,Ffe=(t,e)=>t.map(r=>r===void 0?Ufe[e]:r),Lfe=Rfe("execa").enabled?"full":"none",Ufe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Lfe,stripFinalNewline:!0},kA=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Gi=(t,e)=>e==="ipc"?t.at(-1):t[e]});var mc,hc,$4,EA,qfe,ty,ry,Ro=y(()=>{Vi();mc=({verbose:t},e)=>EA(t,e)!=="none",hc=({verbose:t},e)=>!["none","short"].includes(EA(t,e)),$4=({verbose:t},e)=>{let r=EA(t,e);return ty(r)?r:void 0},EA=(t,e)=>e===void 0?qfe(t):Gi(t,e),qfe=t=>t.find(e=>ty(e))??ry.findLast(e=>t.includes(e)),ty=t=>typeof t=="function",ry=["none","short","full"]});import{platform as Bfe}from"node:process";import{stripVTControlCharacters as Zfe}from"node:util";var k4,Ad,E4,Hfe,Gfe,Vfe,Wfe,Kfe,Jfe,Yfe,ny=y(()=>{k4=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Jfe(E4(o))).join(" ");return{command:n,escapedCommand:i}},Ad=t=>Zfe(t).split(` +`).map(e=>E4(e)).join(` +`),E4=t=>t.replaceAll(Vfe,e=>Hfe(e)),Hfe=t=>{let e=Wfe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Kfe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Gfe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Vfe=Gfe(),Wfe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Kfe=65535,Jfe=t=>Yfe.test(t)?t:Bfe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Yfe=/^[\w./-]+$/});import A4 from"node:process";function AA(){let{env:t}=A4,{TERM:e,TERM_PROGRAM:r}=t;return A4.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var T4=y(()=>{});var O4,P4,Xfe,Qfe,epe,tpe,rpe,iy,zGe,I4=y(()=>{T4();O4={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},P4={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Xfe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Qfe={...O4,...P4},epe={...O4,...Xfe},tpe=AA(),rpe=tpe?Qfe:epe,iy=rpe,zGe=Object.entries(P4)});import npe from"node:tty";var ipe,he,UGe,R4,qGe,BGe,ZGe,HGe,GGe,VGe,WGe,KGe,JGe,YGe,XGe,QGe,e9e,t9e,r9e,oy,n9e,i9e,o9e,s9e,a9e,c9e,l9e,u9e,d9e,C4,f9e,D4,p9e,m9e,h9e,g9e,y9e,_9e,v9e,b9e,S9e,w9e,x9e,TA=y(()=>{ipe=npe?.WriteStream?.prototype?.hasColors?.()??!1,he=(t,e)=>{if(!ipe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},UGe=he(0,0),R4=he(1,22),qGe=he(2,22),BGe=he(3,23),ZGe=he(4,24),HGe=he(53,55),GGe=he(7,27),VGe=he(8,28),WGe=he(9,29),KGe=he(30,39),JGe=he(31,39),YGe=he(32,39),XGe=he(33,39),QGe=he(34,39),e9e=he(35,39),t9e=he(36,39),r9e=he(37,39),oy=he(90,39),n9e=he(40,49),i9e=he(41,49),o9e=he(42,49),s9e=he(43,49),a9e=he(44,49),c9e=he(45,49),l9e=he(46,49),u9e=he(47,49),d9e=he(100,49),C4=he(91,39),f9e=he(92,39),D4=he(93,39),p9e=he(94,39),m9e=he(95,39),h9e=he(96,39),g9e=he(97,39),y9e=he(101,49),_9e=he(102,49),v9e=he(103,49),b9e=he(104,49),S9e=he(105,49),w9e=he(106,49),x9e=he(107,49)});var N4=y(()=>{TA();TA()});var z4,spe,sy,j4,ape,M4,cpe,F4=y(()=>{I4();N4();z4=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=spe(r),c=ape[t]({failed:o,reject:s,piped:n}),l=cpe[t]({reject:s});return`${oy(`[${a}]`)} ${oy(`[${i}]`)} ${l(c)} ${l(e)}`},spe=t=>`${sy(t.getHours(),2)}:${sy(t.getMinutes(),2)}:${sy(t.getSeconds(),2)}.${sy(t.getMilliseconds(),3)}`,sy=(t,e)=>String(t).padStart(e,"0"),j4=({failed:t,reject:e})=>t?e?iy.cross:iy.warning:iy.tick,ape={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:j4,duration:j4},M4=t=>t,cpe={command:()=>R4,output:()=>M4,ipc:()=>M4,error:({reject:t})=>t?C4:D4,duration:()=>oy}});var L4,lpe,upe,U4=y(()=>{Ro();L4=(t,e,r)=>{let n=$4(e,r);return t.map(({verboseLine:i,verboseObject:o})=>lpe(i,o,n)).filter(i=>i!==void 0).map(i=>upe(i)).join("")},lpe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},upe=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as Xfe}from"node:util";var ai,Qfe,epe,tpe,iy,rpe,gc=y(()=>{ey();j4();z4();ai=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Qfe({type:t,result:i,verboseInfo:n}),s=epe(e,o),a=M4(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Qfe=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),epe=(t,e)=>t.split(` -`).map(r=>tpe({...e,message:r})),tpe=t=>({verboseLine:N4(t),verboseObject:t}),iy=t=>{let e=typeof t=="string"?t:Xfe(t);return kd(e).replaceAll(" "," ".repeat(rpe))},rpe=2});var F4,L4=y(()=>{Ro();gc();F4=(t,e)=>{mc(e)&&ai({type:"command",verboseMessage:t,verboseInfo:e})}});var U4,npe,ipe,ope,q4=y(()=>{Ro();U4=(t,e,r)=>{ope(t);let n=npe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},npe=t=>mc({verbose:t})?ipe++:void 0,ipe=0n,ope=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!Qg.includes(e)&&!Xg(e)){let r=Qg.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as B4}from"node:process";var oy,EA,sy=y(()=>{oy=()=>B4.bigint(),EA=t=>Number(B4.bigint()-t)/1e6});var ay,AA=y(()=>{L4();q4();sy();ey();Vi();ay=(t,e,r)=>{let n=oy(),{command:i,escapedCommand:o}=w4(t,e),s=bA(r,"verbose"),a=U4(s,o,{...r});return F4(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var W4=v((O9e,V4)=>{V4.exports=G4;G4.sync=ape;var Z4=Le("fs");function spe(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{X4.exports=J4;J4.sync=cpe;var K4=Le("fs");function J4(t,e,r){K4.stat(t,function(n,i){r(n,n?!1:Y4(i,e))})}function cpe(t,e){return Y4(K4.statSync(t),e)}function Y4(t,e){return t.isFile()&&lpe(t,e)}function lpe(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var t6=v((I9e,e6)=>{var P9e=Le("fs"),cy;process.platform==="win32"||global.TESTING_WINDOWS?cy=W4():cy=Q4();e6.exports=OA;OA.sync=upe;function OA(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){OA(t,e||{},function(o,s){o?i(o):n(s)})})}cy(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function upe(t,e){try{return cy.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var c6=v((R9e,a6)=>{var yc=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",r6=Le("path"),dpe=yc?";":":",n6=t6(),i6=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),o6=(t,e)=>{let r=e.colon||dpe,n=t.match(/\//)||yc&&t.match(/\\/)?[""]:[...yc?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=yc?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=yc?i.split(r):[""];return yc&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},s6=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=o6(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(i6(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=r6.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];n6(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},fpe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=o6(t,e),o=[];for(let s=0;s{"use strict";var l6=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};TA.exports=l6;TA.exports.default=l6});var m6=v((D9e,p6)=>{"use strict";var d6=Le("path"),ppe=c6(),mpe=u6();function f6(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=ppe.sync(t.command,{path:r[mpe({env:r})],pathExt:e?d6.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=d6.resolve(i?t.options.cwd:"",s)),s}function hpe(t){return f6(t)||f6(t,!0)}p6.exports=hpe});var h6=v((N9e,IA)=>{"use strict";var PA=/([()\][%!^"`<>&|;, *?])/g;function gpe(t){return t=t.replace(PA,"^$1"),t}function ype(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(PA,"^$1"),e&&(t=t.replace(PA,"^$1")),t}IA.exports.command=gpe;IA.exports.argument=ype});var y6=v((j9e,g6)=>{"use strict";g6.exports=/^#!(.*)/});var v6=v((M9e,_6)=>{"use strict";var _pe=y6();_6.exports=(t="")=>{let e=t.match(_pe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var S6=v((z9e,b6)=>{"use strict";var RA=Le("fs"),vpe=v6();function bpe(t){let r=Buffer.alloc(150),n;try{n=RA.openSync(t,"r"),RA.readSync(n,r,0,150,0),RA.closeSync(n)}catch{}return vpe(r.toString())}b6.exports=bpe});var k6=v((F9e,$6)=>{"use strict";var Spe=Le("path"),w6=m6(),x6=h6(),wpe=S6(),xpe=process.platform==="win32",$pe=/\.(?:com|exe)$/i,kpe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Epe(t){t.file=w6(t);let e=t.file&&wpe(t.file);return e?(t.args.unshift(t.file),t.command=e,w6(t)):t.file}function Ape(t){if(!xpe)return t;let e=Epe(t),r=!$pe.test(e);if(t.options.forceShell||r){let n=kpe.test(e);t.command=Spe.normalize(t.command),t.command=x6.command(t.command),t.args=t.args.map(o=>x6.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Ope(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Ape(n)}$6.exports=Ope});var O6=v((L9e,A6)=>{"use strict";var CA=process.platform==="win32";function DA(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function Tpe(t,e){if(!CA)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=E6(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function E6(t,e){return CA&&t===1&&!e.file?DA(e.original,"spawn"):null}function Ppe(t,e){return CA&&t===1&&!e.file?DA(e.original,"spawnSync"):null}A6.exports={hookChildProcess:Tpe,verifyENOENT:E6,verifyENOENTSync:Ppe,notFoundError:DA}});var I6=v((U9e,_c)=>{"use strict";var T6=Le("child_process"),NA=k6(),jA=O6();function P6(t,e,r){let n=NA(t,e,r),i=T6.spawn(n.command,n.args,n.options);return jA.hookChildProcess(i,n),i}function Ipe(t,e,r){let n=NA(t,e,r),i=T6.spawnSync(n.command,n.args,n.options);return i.error=i.error||jA.verifyENOENTSync(i.status,n),i}_c.exports=P6;_c.exports.spawn=P6;_c.exports.sync=Ipe;_c.exports._parse=NA;_c.exports._enoent=jA});function ly(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var R6=y(()=>{});var C6=y(()=>{});import{promisify as Rpe}from"node:util";import{execFile as Cpe,execFileSync as G9e}from"node:child_process";import D6 from"node:path";import{fileURLToPath as Dpe}from"node:url";function uy(t){return t instanceof URL?Dpe(t):t}function N6(t){return{*[Symbol.iterator](){let e=D6.resolve(uy(t)),r;for(;r!==e;)yield e,r=e,e=D6.resolve(e,"..")}}}var K9e,J9e,j6=y(()=>{C6();K9e=Rpe(Cpe);J9e=10*1024*1024});import dy from"node:process";import Us from"node:path";var Npe,jpe,Mpe,M6,z6=y(()=>{R6();j6();Npe=({cwd:t=dy.cwd(),path:e=dy.env[ly()],preferLocal:r=!0,execPath:n=dy.execPath,addExecPath:i=!0}={})=>{let o=Us.resolve(uy(t)),s=[],a=e.split(Us.delimiter);return r&&jpe(s,a,o),i&&Mpe(s,a,n,o),e===""||e===Us.delimiter?`${s.join(Us.delimiter)}${e}`:[...s,e].join(Us.delimiter)},jpe=(t,e,r)=>{for(let n of N6(r)){let i=Us.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Mpe=(t,e,r,n)=>{let i=Us.resolve(n,uy(r),"..");e.includes(i)||t.push(i)},M6=({env:t=dy.env,...e}={})=>{t={...t};let r=ly({env:t});return e.path=t[r],t[r]=Npe(e),t}});var F6,Dn,L6,U6,q6,fy,Ed,Ad,qs=y(()=>{F6=(t,e,r)=>{let n=r?Ad:Ed,i=t instanceof Dn?{}:{cause:t};return new n(e,i)},Dn=class extends Error{},L6=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,q6,{value:!0,writable:!1,enumerable:!1,configurable:!1})},U6=t=>fy(t)&&q6 in t,q6=Symbol("isExecaError"),fy=t=>Object.prototype.toString.call(t)==="[object Error]",Ed=class extends Error{};L6(Ed,Ed.name);Ad=class extends Error{};L6(Ad,Ad.name)});var B6,zpe,Z6,H6,G6=y(()=>{B6=()=>{let t=H6-Z6+1;return Array.from({length:t},zpe)},zpe=(t,e)=>({name:`SIGRT${e+1}`,number:Z6+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Z6=34,H6=64});var V6,W6=y(()=>{V6=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as Fpe}from"node:os";var MA,Lpe,K6=y(()=>{W6();G6();MA=()=>{let t=B6();return[...V6,...t].map(Lpe)},Lpe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Fpe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Upe}from"node:os";var qpe,Bpe,J6,Zpe,Hpe,Gpe,pVe,Y6=y(()=>{K6();qpe=()=>{let t=MA();return Object.fromEntries(t.map(Bpe))},Bpe=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],J6=qpe(),Zpe=()=>{let t=MA(),e=65,r=Array.from({length:e},(n,i)=>Hpe(i,t));return Object.assign({},...r)},Hpe=(t,e)=>{let r=Gpe(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},Gpe=(t,e)=>{let r=e.find(({name:n})=>Upe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},pVe=Zpe()});import{constants as Od}from"node:os";var Q6,eB,tB,Vpe,Wpe,X6,Kpe,zA,Jpe,Ype,py,Td=y(()=>{Y6();Q6=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return tB(t,e)},eB=t=>t===0?t:tB(t,"`subprocess.kill()`'s argument"),tB=(t,e)=>{if(Number.isInteger(t))return Vpe(t,e);if(typeof t=="string")return Kpe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${zA()}`)},Vpe=(t,e)=>{if(X6.has(t))return X6.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${zA()}`)},Wpe=()=>new Map(Object.entries(Od.signals).reverse().map(([t,e])=>[e,t])),X6=Wpe(),Kpe=(t,e)=>{if(t in Od.signals)return t;throw t.toUpperCase()in Od.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${zA()}`)},zA=()=>`Available signal names: ${Jpe()}. -Available signal numbers: ${Ype()}.`,Jpe=()=>Object.keys(Od.signals).sort().map(t=>`'${t}'`).join(", "),Ype=()=>[...new Set(Object.values(Od.signals).sort((t,e)=>t-e))].join(", "),py=t=>J6[t].description});import{setTimeout as Xpe}from"node:timers/promises";var rB,Qpe,nB,eme,tme,rme,FA,my=y(()=>{qs();Td();rB=t=>{if(t===!1)return t;if(t===!0)return Qpe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},Qpe=1e3*5,nB=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=eme(s,a,r);tme(l,n);let u=t(c);return rme({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},eme=(t,e,r)=>{let[n=r,i]=fy(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!fy(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:eB(n),error:i}},tme=(t,e)=>{t!==void 0&&e.reject(t)},rme=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&FA({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},FA=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Xpe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as nme}from"node:events";var hy,LA=y(()=>{hy=async(t,e)=>{t.aborted||await nme(t,"abort",{signal:e})}});var iB,oB,ime,UA=y(()=>{LA();iB=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},oB=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[ime(t,e,n,i)],ime=async(t,e,r,{signal:n})=>{throw await hy(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var vc,ome,qA,sB,aB,gy,cB,lB,uB,dB,fB,pB,sme,ame,cme,Nn,lme,Co,bc,Sc=y(()=>{vc=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{ome(t,e,r),qA(t,e,n)},ome=(t,e,r)=>{if(!r)throw new Error(`${Nn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},qA=(t,e,r)=>{if(!r)throw new Error(`${Nn(t,e)} cannot be used: the ${Co(e)} has already exited or disconnected.`)},sB=t=>{throw new Error(`${Nn("getOneMessage",t)} could not complete: the ${Co(t)} exited or disconnected.`)},aB=t=>{throw new Error(`${Nn("sendMessage",t)} failed: the ${Co(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as dpe}from"node:util";var ai,fpe,ppe,mpe,ay,hpe,gc=y(()=>{ny();F4();U4();ai=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=fpe({type:t,result:i,verboseInfo:n}),s=ppe(e,o),a=L4(s,n,r);a!==""&&console.warn(a.slice(0,-1))},fpe=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),ppe=(t,e)=>t.split(` +`).map(r=>mpe({...e,message:r})),mpe=t=>({verboseLine:z4(t),verboseObject:t}),ay=t=>{let e=typeof t=="string"?t:dpe(t);return Ad(e).replaceAll(" "," ".repeat(hpe))},hpe=2});var q4,B4=y(()=>{Ro();gc();q4=(t,e)=>{mc(e)&&ai({type:"command",verboseMessage:t,verboseInfo:e})}});var Z4,gpe,ype,_pe,H4=y(()=>{Ro();Z4=(t,e,r)=>{_pe(t);let n=gpe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},gpe=t=>mc({verbose:t})?ype++:void 0,ype=0n,_pe=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!ry.includes(e)&&!ty(e)){let r=ry.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as G4}from"node:process";var cy,OA,ly=y(()=>{cy=()=>G4.bigint(),OA=t=>Number(G4.bigint()-t)/1e6});var uy,PA=y(()=>{B4();H4();ly();ny();Vi();uy=(t,e,r)=>{let n=cy(),{command:i,escapedCommand:o}=k4(t,e),s=xA(r,"verbose"),a=Z4(s,o,{...r});return q4(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var Y4=v((K9e,J4)=>{J4.exports=K4;K4.sync=bpe;var V4=Le("fs");function vpe(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{t6.exports=Q4;Q4.sync=Spe;var X4=Le("fs");function Q4(t,e,r){X4.stat(t,function(n,i){r(n,n?!1:e6(i,e))})}function Spe(t,e){return e6(X4.statSync(t),e)}function e6(t,e){return t.isFile()&&wpe(t,e)}function wpe(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var i6=v((X9e,n6)=>{var Y9e=Le("fs"),dy;process.platform==="win32"||global.TESTING_WINDOWS?dy=Y4():dy=r6();n6.exports=IA;IA.sync=xpe;function IA(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){IA(t,e||{},function(o,s){o?i(o):n(s)})})}dy(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function xpe(t,e){try{return dy.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var d6=v((Q9e,u6)=>{var yc=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",o6=Le("path"),$pe=yc?";":":",s6=i6(),a6=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),c6=(t,e)=>{let r=e.colon||$pe,n=t.match(/\//)||yc&&t.match(/\\/)?[""]:[...yc?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=yc?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=yc?i.split(r):[""];return yc&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},l6=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=c6(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(a6(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=o6.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];s6(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},kpe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=c6(t,e),o=[];for(let s=0;s{"use strict";var f6=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};RA.exports=f6;RA.exports.default=f6});var y6=v((tVe,g6)=>{"use strict";var m6=Le("path"),Epe=d6(),Ape=p6();function h6(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=Epe.sync(t.command,{path:r[Ape({env:r})],pathExt:e?m6.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=m6.resolve(i?t.options.cwd:"",s)),s}function Tpe(t){return h6(t)||h6(t,!0)}g6.exports=Tpe});var _6=v((rVe,DA)=>{"use strict";var CA=/([()\][%!^"`<>&|;, *?])/g;function Ope(t){return t=t.replace(CA,"^$1"),t}function Ppe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(CA,"^$1"),e&&(t=t.replace(CA,"^$1")),t}DA.exports.command=Ope;DA.exports.argument=Ppe});var b6=v((nVe,v6)=>{"use strict";v6.exports=/^#!(.*)/});var w6=v((iVe,S6)=>{"use strict";var Ipe=b6();S6.exports=(t="")=>{let e=t.match(Ipe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var $6=v((oVe,x6)=>{"use strict";var NA=Le("fs"),Rpe=w6();function Cpe(t){let r=Buffer.alloc(150),n;try{n=NA.openSync(t,"r"),NA.readSync(n,r,0,150,0),NA.closeSync(n)}catch{}return Rpe(r.toString())}x6.exports=Cpe});var T6=v((sVe,A6)=>{"use strict";var Dpe=Le("path"),k6=y6(),E6=_6(),Npe=$6(),jpe=process.platform==="win32",Mpe=/\.(?:com|exe)$/i,zpe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Fpe(t){t.file=k6(t);let e=t.file&&Npe(t.file);return e?(t.args.unshift(t.file),t.command=e,k6(t)):t.file}function Lpe(t){if(!jpe)return t;let e=Fpe(t),r=!Mpe.test(e);if(t.options.forceShell||r){let n=zpe.test(e);t.command=Dpe.normalize(t.command),t.command=E6.command(t.command),t.args=t.args.map(o=>E6.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Upe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Lpe(n)}A6.exports=Upe});var I6=v((aVe,P6)=>{"use strict";var jA=process.platform==="win32";function MA(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function qpe(t,e){if(!jA)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=O6(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function O6(t,e){return jA&&t===1&&!e.file?MA(e.original,"spawn"):null}function Bpe(t,e){return jA&&t===1&&!e.file?MA(e.original,"spawnSync"):null}P6.exports={hookChildProcess:qpe,verifyENOENT:O6,verifyENOENTSync:Bpe,notFoundError:MA}});var D6=v((cVe,_c)=>{"use strict";var R6=Le("child_process"),zA=T6(),FA=I6();function C6(t,e,r){let n=zA(t,e,r),i=R6.spawn(n.command,n.args,n.options);return FA.hookChildProcess(i,n),i}function Zpe(t,e,r){let n=zA(t,e,r),i=R6.spawnSync(n.command,n.args,n.options);return i.error=i.error||FA.verifyENOENTSync(i.status,n),i}_c.exports=C6;_c.exports.spawn=C6;_c.exports.sync=Zpe;_c.exports._parse=zA;_c.exports._enoent=FA});function fy(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var N6=y(()=>{});var j6=y(()=>{});import{promisify as Hpe}from"node:util";import{execFile as Gpe,execFileSync as pVe}from"node:child_process";import M6 from"node:path";import{fileURLToPath as Vpe}from"node:url";function py(t){return t instanceof URL?Vpe(t):t}function z6(t){return{*[Symbol.iterator](){let e=M6.resolve(py(t)),r;for(;r!==e;)yield e,r=e,e=M6.resolve(e,"..")}}}var gVe,yVe,F6=y(()=>{j6();gVe=Hpe(Gpe);yVe=10*1024*1024});import my from"node:process";import Us from"node:path";var Wpe,Kpe,Jpe,L6,U6=y(()=>{N6();F6();Wpe=({cwd:t=my.cwd(),path:e=my.env[fy()],preferLocal:r=!0,execPath:n=my.execPath,addExecPath:i=!0}={})=>{let o=Us.resolve(py(t)),s=[],a=e.split(Us.delimiter);return r&&Kpe(s,a,o),i&&Jpe(s,a,n,o),e===""||e===Us.delimiter?`${s.join(Us.delimiter)}${e}`:[...s,e].join(Us.delimiter)},Kpe=(t,e,r)=>{for(let n of z6(r)){let i=Us.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Jpe=(t,e,r,n)=>{let i=Us.resolve(n,py(r),"..");e.includes(i)||t.push(i)},L6=({env:t=my.env,...e}={})=>{t={...t};let r=fy({env:t});return e.path=t[r],t[r]=Wpe(e),t}});var q6,Dn,B6,Z6,H6,hy,Td,Od,qs=y(()=>{q6=(t,e,r)=>{let n=r?Od:Td,i=t instanceof Dn?{}:{cause:t};return new n(e,i)},Dn=class extends Error{},B6=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,H6,{value:!0,writable:!1,enumerable:!1,configurable:!1})},Z6=t=>hy(t)&&H6 in t,H6=Symbol("isExecaError"),hy=t=>Object.prototype.toString.call(t)==="[object Error]",Td=class extends Error{};B6(Td,Td.name);Od=class extends Error{};B6(Od,Od.name)});var G6,Ype,V6,W6,K6=y(()=>{G6=()=>{let t=W6-V6+1;return Array.from({length:t},Ype)},Ype=(t,e)=>({name:`SIGRT${e+1}`,number:V6+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),V6=34,W6=64});var J6,Y6=y(()=>{J6=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as Xpe}from"node:os";var LA,Qpe,X6=y(()=>{Y6();K6();LA=()=>{let t=G6();return[...J6,...t].map(Qpe)},Qpe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Xpe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as eme}from"node:os";var tme,rme,Q6,nme,ime,ome,DVe,eB=y(()=>{X6();tme=()=>{let t=LA();return Object.fromEntries(t.map(rme))},rme=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],Q6=tme(),nme=()=>{let t=LA(),e=65,r=Array.from({length:e},(n,i)=>ime(i,t));return Object.assign({},...r)},ime=(t,e)=>{let r=ome(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},ome=(t,e)=>{let r=e.find(({name:n})=>eme.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},DVe=nme()});import{constants as Pd}from"node:os";var rB,nB,iB,sme,ame,tB,cme,UA,lme,ume,gy,Id=y(()=>{eB();rB=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return iB(t,e)},nB=t=>t===0?t:iB(t,"`subprocess.kill()`'s argument"),iB=(t,e)=>{if(Number.isInteger(t))return sme(t,e);if(typeof t=="string")return cme(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${UA()}`)},sme=(t,e)=>{if(tB.has(t))return tB.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${UA()}`)},ame=()=>new Map(Object.entries(Pd.signals).reverse().map(([t,e])=>[e,t])),tB=ame(),cme=(t,e)=>{if(t in Pd.signals)return t;throw t.toUpperCase()in Pd.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${UA()}`)},UA=()=>`Available signal names: ${lme()}. +Available signal numbers: ${ume()}.`,lme=()=>Object.keys(Pd.signals).sort().map(t=>`'${t}'`).join(", "),ume=()=>[...new Set(Object.values(Pd.signals).sort((t,e)=>t-e))].join(", "),gy=t=>Q6[t].description});import{setTimeout as dme}from"node:timers/promises";var oB,fme,sB,pme,mme,hme,qA,yy=y(()=>{qs();Id();oB=t=>{if(t===!1)return t;if(t===!0)return fme;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},fme=1e3*5,sB=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=pme(s,a,r);mme(l,n);let u=t(c);return hme({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},pme=(t,e,r)=>{let[n=r,i]=hy(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!hy(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:nB(n),error:i}},mme=(t,e)=>{t!==void 0&&e.reject(t)},hme=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&qA({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},qA=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await dme(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as gme}from"node:events";var _y,BA=y(()=>{_y=async(t,e)=>{t.aborted||await gme(t,"abort",{signal:e})}});var aB,cB,yme,ZA=y(()=>{BA();aB=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},cB=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[yme(t,e,n,i)],yme=async(t,e,r,{signal:n})=>{throw await _y(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var vc,_me,HA,lB,uB,vy,dB,fB,pB,mB,hB,gB,vme,bme,Sme,Nn,wme,Co,bc,Sc=y(()=>{vc=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{_me(t,e,r),HA(t,e,n)},_me=(t,e,r)=>{if(!r)throw new Error(`${Nn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},HA=(t,e,r)=>{if(!r)throw new Error(`${Nn(t,e)} cannot be used: the ${Co(e)} has already exited or disconnected.`)},lB=t=>{throw new Error(`${Nn("getOneMessage",t)} could not complete: the ${Co(t)} exited or disconnected.`)},uB=t=>{throw new Error(`${Nn("sendMessage",t)} failed: the ${Co(t)} is sending a message too, instead of listening to incoming messages. This can be fixed by both sending a message and listening to incoming messages at the same time: const [receivedMessage] = await Promise.all([ ${Nn("getOneMessage",t)}, ${Nn("sendMessage",t,"message, {strict: true}")}, -]);`)},gy=(t,e)=>new Error(`${Nn("sendMessage",e)} failed when sending an acknowledgment response to the ${Co(e)}.`,{cause:t}),cB=t=>{throw new Error(`${Nn("sendMessage",t)} failed: the ${Co(t)} is not listening to incoming messages.`)},lB=t=>{throw new Error(`${Nn("sendMessage",t)} failed: the ${Co(t)} exited without listening to incoming messages.`)},uB=()=>new Error(`\`cancelSignal\` aborted: the ${Co(!0)} disconnected.`),dB=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},fB=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Nn(e,r)} cannot be used: the ${Co(r)} is disconnecting.`,{cause:t})},pB=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(sme(t))throw new Error(`${Nn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},sme=({code:t,message:e})=>ame.has(t)||cme.some(r=>e.includes(r)),ame=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),cme=["could not be cloned","circular structure","call stack size exceeded"],Nn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${lme(e)}${t}(${r})`,lme=t=>t?"":"subprocess.",Co=t=>t?"parent process":"subprocess",bc=t=>{t.connected&&t.disconnect()}});var ci,wc=y(()=>{ci=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var _y,xc,li,mB,ume,dme,hB,fme,gB,Pd,yy,Do=y(()=>{Vi();_y=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=li.get(t),o=mB(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(hB(o,e,n,!0));return s},xc=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=li.get(t),o=mB(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(hB(o,e,n,!1));return s},li=new WeakMap,mB=(t,e,r)=>{let n=ume(e,r);return dme(n,e,r,t),n},ume=(t,e)=>{let r=SA(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Pd(e)}" must not be "${t}". +]);`)},vy=(t,e)=>new Error(`${Nn("sendMessage",e)} failed when sending an acknowledgment response to the ${Co(e)}.`,{cause:t}),dB=t=>{throw new Error(`${Nn("sendMessage",t)} failed: the ${Co(t)} is not listening to incoming messages.`)},fB=t=>{throw new Error(`${Nn("sendMessage",t)} failed: the ${Co(t)} exited without listening to incoming messages.`)},pB=()=>new Error(`\`cancelSignal\` aborted: the ${Co(!0)} disconnected.`),mB=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},hB=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Nn(e,r)} cannot be used: the ${Co(r)} is disconnecting.`,{cause:t})},gB=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(vme(t))throw new Error(`${Nn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},vme=({code:t,message:e})=>bme.has(t)||Sme.some(r=>e.includes(r)),bme=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Sme=["could not be cloned","circular structure","call stack size exceeded"],Nn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${wme(e)}${t}(${r})`,wme=t=>t?"":"subprocess.",Co=t=>t?"parent process":"subprocess",bc=t=>{t.connected&&t.disconnect()}});var ci,wc=y(()=>{ci=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var Sy,xc,li,yB,xme,$me,_B,kme,vB,Rd,by,Do=y(()=>{Vi();Sy=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=li.get(t),o=yB(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(_B(o,e,n,!0));return s},xc=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=li.get(t),o=yB(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(_B(o,e,n,!1));return s},li=new WeakMap,yB=(t,e,r)=>{let n=xme(e,r);return $me(n,e,r,t),n},xme=(t,e)=>{let r=$A(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Rd(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},dme=(t,e,r,n)=>{let i=n[gB(t)];if(i===void 0)throw new TypeError(`"${Pd(r)}" must not be ${e}. That file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${Pd(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Pd(r)}" must not be ${e}. It must be a writable stream, not readable.`)},hB=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=fme(t,r);return`The "${i}: ${yy(o)}" option is incompatible with using "${Pd(n)}: ${yy(e)}". -Please set this option with "pipe" instead.`},fme=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=gB(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},gB=t=>t==="all"?1:t,Pd=t=>t?"to":"from",yy=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as pme}from"node:events";var Bs,vy=y(()=>{Bs=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),pme(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var by,BA,Sy,ZA,yB,_B,Id=y(()=>{by=(t,e)=>{e&&BA(t)},BA=t=>{t.refCounted()},Sy=(t,e)=>{e&&ZA(t)},ZA=t=>{t.unrefCounted()},yB=(t,e)=>{e&&(ZA(t),ZA(t))},_B=(t,e)=>{e&&(BA(t),BA(t))}});import{once as mme}from"node:events";import{scheduler as hme}from"node:timers/promises";var vB,bB,wy,SB=y(()=>{$y();Id();xy();ky();vB=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(xB(i)||kB(i))return;wy.has(t)||wy.set(t,[]);let o=wy.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await $B(t,n,i),await hme.yield();let s=await wB({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},bB=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{HA();let o=wy.get(t);for(;o?.length>0;)await mme(n,"message:done");t.removeListener("message",i),_B(e,r),n.connected=!1,n.emit("disconnect")},wy=new WeakMap});import{EventEmitter as gme}from"node:events";var No,Ey,yme,Ay,Rd=y(()=>{SB();Id();No=(t,e,r)=>{if(Ey.has(t))return Ey.get(t);let n=new gme;return n.connected=!0,Ey.set(t,n),yme({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Ey=new WeakMap,yme=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=vB.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",bB.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),yB(r,n)},Ay=t=>{let e=Ey.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as _me}from"node:events";var EB,vme,AB,wB,xB,OB,Oy,bme,Ty,TB,xy=y(()=>{wc();vy();Ry();Sc();Rd();$y();EB=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=No(t,e,r),s=Py(t,o);return{id:vme++,type:Ty,message:n,hasListeners:s}},vme=0n,AB=(t,e)=>{if(!(e?.type!==Ty||e.hasListeners))for(let{id:r}of t)r!==void 0&&Oy[r].resolve({isDeadlock:!0,hasListeners:!1})},wB=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Ty||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:TB,message:Py(e,i)};try{await Iy({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},xB=t=>{if(t?.type!==TB)return!1;let{id:e,message:r}=t;return Oy[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},OB=async(t,e,r)=>{if(t?.type!==Ty)return;let n=ci();Oy[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,bme(e,r,i)]);o&&aB(r),s||cB(r)}finally{i.abort(),delete Oy[t.id]}},Oy={},bme=async(t,e,{signal:r})=>{Bs(t,1,r),await _me(t,"disconnect",{signal:r}),lB(e)},Ty="execa:ipc:request",TB="execa:ipc:response"});var PB,IB,$B,Cd,Py,Sme,$y=y(()=>{wc();Vi();Do();xy();PB=(t,e,r)=>{Cd.has(t)||Cd.set(t,new Set);let n=Cd.get(t),i=ci(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},IB=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},$B=async(t,e,r)=>{for(;!Py(t,e)&&Cd.get(t)?.size>0;){let n=[...Cd.get(t)];AB(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Cd=new WeakMap,Py=(t,e)=>e.listenerCount("message")>Sme(t),Sme=t=>li.has(t)&&!Gi(li.get(t).options.buffer,"ipc")?1:0});import{promisify as wme}from"node:util";var Iy,xme,VA,$me,GA,Ry=y(()=>{Sc();$y();xy();Iy=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return vc({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),xme({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},xme=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=EB({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=PB(t,s,o);try{await VA({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw bc(t),c}finally{IB(a)}},VA=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=$me(t);try{await Promise.all([OB(n,t,r),o(n)])}catch(s){throw fB({error:s,methodName:e,isSubprocess:r}),pB({error:s,methodName:e,isSubprocess:r,message:i}),s}},$me=t=>{if(GA.has(t))return GA.get(t);let e=wme(t.send.bind(t));return GA.set(t,e),e},GA=new WeakMap});import{scheduler as kme}from"node:timers/promises";var CB,DB,Eme,RB,kB,NB,HA,WA,ky=y(()=>{Ry();Rd();Sc();CB=(t,e)=>{let r="cancelSignal";return qA(r,!1,t.connected),VA({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:NB,message:e},message:e})},DB=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Eme({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),WA.signal),Eme=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!RB){if(RB=!0,!n){dB();return}if(e===null){HA();return}No(t,e,r),await kme.yield()}},RB=!1,kB=t=>t?.type!==NB?!1:(WA.abort(t.message),!0),NB="execa:ipc:cancel",HA=()=>{WA.abort(uB())},WA=new AbortController});var jB,MB,Ame,Ome,KA=y(()=>{LA();ky();my();jB=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},MB=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Ame({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Ame=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await hy(e,i);let o=Ome(e);throw await CB(t,o),FA({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Ome=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as Tme}from"node:timers/promises";var zB,FB,Pme,JA=y(()=>{qs();zB=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},FB=(t,e,r,n)=>e===0||e===void 0?[]:[Pme(t,e,r,n)],Pme=async(t,e,r,{signal:n})=>{throw await Tme(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Dn}});import{execPath as Ime,execArgv as Rme}from"node:process";import LB from"node:path";var UB,qB,YA=y(()=>{pc();UB=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},qB=(t,e,{node:r=!1,nodePath:n=Ime,nodeOptions:i=Rme.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=fc(n,'The "nodePath" option'),l=LB.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(LB.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as Cme}from"node:v8";var BB,Dme,Nme,jme,ZB,XA=y(()=>{BB=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");jme[r](t)}},Dme=t=>{try{Cme(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},Nme=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},jme={advanced:Dme,json:Nme},ZB=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var GB,Mme,qr,QA,zme,HB,Cy,Zs=y(()=>{GB=({encoding:t})=>{if(QA.has(t))return;let e=zme(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Cy(t)}\`. -Please rename it to ${Cy(e)}.`);let r=[...QA].map(n=>Cy(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Cy(t)}\`. -Please rename it to one of: ${r}.`)},Mme=new Set(["utf8","utf16le"]),qr=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),QA=new Set([...Mme,...qr]),zme=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in HB)return HB[e];if(QA.has(e))return e},HB={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Cy=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as Fme}from"node:fs";import Lme from"node:path";import Ume from"node:process";var VB,WB,KB,eO=y(()=>{pc();VB=(t=WB())=>{let e=fc(t,'The "cwd" option');return Lme.resolve(e)},WB=()=>{try{return Ume.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},KB=(t,e)=>{if(e===WB())return t;let r;try{r=Fme(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},$me=(t,e,r,n)=>{let i=n[vB(t)];if(i===void 0)throw new TypeError(`"${Rd(r)}" must not be ${e}. That file descriptor does not exist. +Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${Rd(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Rd(r)}" must not be ${e}. It must be a writable stream, not readable.`)},_B=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=kme(t,r);return`The "${i}: ${by(o)}" option is incompatible with using "${Rd(n)}: ${by(e)}". +Please set this option with "pipe" instead.`},kme=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=vB(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},vB=t=>t==="all"?1:t,Rd=t=>t?"to":"from",by=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Eme}from"node:events";var Bs,wy=y(()=>{Bs=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Eme(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var xy,GA,$y,VA,bB,SB,Cd=y(()=>{xy=(t,e)=>{e&&GA(t)},GA=t=>{t.refCounted()},$y=(t,e)=>{e&&VA(t)},VA=t=>{t.unrefCounted()},bB=(t,e)=>{e&&(VA(t),VA(t))},SB=(t,e)=>{e&&(GA(t),GA(t))}});import{once as Ame}from"node:events";import{scheduler as Tme}from"node:timers/promises";var wB,xB,ky,$B=y(()=>{Ay();Cd();Ey();Ty();wB=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(EB(i)||TB(i))return;ky.has(t)||ky.set(t,[]);let o=ky.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await AB(t,n,i),await Tme.yield();let s=await kB({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},xB=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{WA();let o=ky.get(t);for(;o?.length>0;)await Ame(n,"message:done");t.removeListener("message",i),SB(e,r),n.connected=!1,n.emit("disconnect")},ky=new WeakMap});import{EventEmitter as Ome}from"node:events";var No,Oy,Pme,Py,Dd=y(()=>{$B();Cd();No=(t,e,r)=>{if(Oy.has(t))return Oy.get(t);let n=new Ome;return n.connected=!0,Oy.set(t,n),Pme({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Oy=new WeakMap,Pme=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=wB.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",xB.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),bB(r,n)},Py=t=>{let e=Oy.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Ime}from"node:events";var OB,Rme,PB,kB,EB,IB,Iy,Cme,Ry,RB,Ey=y(()=>{wc();wy();Ny();Sc();Dd();Ay();OB=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=No(t,e,r),s=Cy(t,o);return{id:Rme++,type:Ry,message:n,hasListeners:s}},Rme=0n,PB=(t,e)=>{if(!(e?.type!==Ry||e.hasListeners))for(let{id:r}of t)r!==void 0&&Iy[r].resolve({isDeadlock:!0,hasListeners:!1})},kB=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Ry||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:RB,message:Cy(e,i)};try{await Dy({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},EB=t=>{if(t?.type!==RB)return!1;let{id:e,message:r}=t;return Iy[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},IB=async(t,e,r)=>{if(t?.type!==Ry)return;let n=ci();Iy[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,Cme(e,r,i)]);o&&uB(r),s||dB(r)}finally{i.abort(),delete Iy[t.id]}},Iy={},Cme=async(t,e,{signal:r})=>{Bs(t,1,r),await Ime(t,"disconnect",{signal:r}),fB(e)},Ry="execa:ipc:request",RB="execa:ipc:response"});var CB,DB,AB,Nd,Cy,Dme,Ay=y(()=>{wc();Vi();Do();Ey();CB=(t,e,r)=>{Nd.has(t)||Nd.set(t,new Set);let n=Nd.get(t),i=ci(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},DB=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},AB=async(t,e,r)=>{for(;!Cy(t,e)&&Nd.get(t)?.size>0;){let n=[...Nd.get(t)];PB(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Nd=new WeakMap,Cy=(t,e)=>e.listenerCount("message")>Dme(t),Dme=t=>li.has(t)&&!Gi(li.get(t).options.buffer,"ipc")?1:0});import{promisify as Nme}from"node:util";var Dy,jme,JA,Mme,KA,Ny=y(()=>{Sc();Ay();Ey();Dy=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return vc({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),jme({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},jme=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=OB({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=CB(t,s,o);try{await JA({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw bc(t),c}finally{DB(a)}},JA=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Mme(t);try{await Promise.all([IB(n,t,r),o(n)])}catch(s){throw hB({error:s,methodName:e,isSubprocess:r}),gB({error:s,methodName:e,isSubprocess:r,message:i}),s}},Mme=t=>{if(KA.has(t))return KA.get(t);let e=Nme(t.send.bind(t));return KA.set(t,e),e},KA=new WeakMap});import{scheduler as zme}from"node:timers/promises";var jB,MB,Fme,NB,TB,zB,WA,YA,Ty=y(()=>{Ny();Dd();Sc();jB=(t,e)=>{let r="cancelSignal";return HA(r,!1,t.connected),JA({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:zB,message:e},message:e})},MB=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Fme({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),YA.signal),Fme=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!NB){if(NB=!0,!n){mB();return}if(e===null){WA();return}No(t,e,r),await zme.yield()}},NB=!1,TB=t=>t?.type!==zB?!1:(YA.abort(t.message),!0),zB="execa:ipc:cancel",WA=()=>{YA.abort(pB())},YA=new AbortController});var FB,LB,Lme,Ume,XA=y(()=>{BA();Ty();yy();FB=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},LB=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Lme({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Lme=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await _y(e,i);let o=Ume(e);throw await jB(t,o),qA({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Ume=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as qme}from"node:timers/promises";var UB,qB,Bme,QA=y(()=>{qs();UB=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},qB=(t,e,r,n)=>e===0||e===void 0?[]:[Bme(t,e,r,n)],Bme=async(t,e,r,{signal:n})=>{throw await qme(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Dn}});import{execPath as Zme,execArgv as Hme}from"node:process";import BB from"node:path";var ZB,HB,eT=y(()=>{pc();ZB=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},HB=(t,e,{node:r=!1,nodePath:n=Zme,nodeOptions:i=Hme.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=fc(n,'The "nodePath" option'),l=BB.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(BB.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as Gme}from"node:v8";var GB,Vme,Wme,Kme,VB,tT=y(()=>{GB=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");Kme[r](t)}},Vme=t=>{try{Gme(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},Wme=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},Kme={advanced:Vme,json:Wme},VB=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var KB,Jme,qr,rT,Yme,WB,jy,Zs=y(()=>{KB=({encoding:t})=>{if(rT.has(t))return;let e=Yme(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${jy(t)}\`. +Please rename it to ${jy(e)}.`);let r=[...rT].map(n=>jy(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${jy(t)}\`. +Please rename it to one of: ${r}.`)},Jme=new Set(["utf8","utf16le"]),qr=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),rT=new Set([...Jme,...qr]),Yme=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in WB)return WB[e];if(rT.has(e))return e},WB={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},jy=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as Xme}from"node:fs";import Qme from"node:path";import ehe from"node:process";var JB,YB,XB,nT=y(()=>{pc();JB=(t=YB())=>{let e=fc(t,'The "cwd" option');return Qme.resolve(e)},YB=()=>{try{return ehe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},XB=(t,e)=>{if(e===YB())return t;let r;try{r=Xme(e)}catch(n){return`The "cwd" option is invalid: ${e}. ${n.message} ${t}`}return r.isDirectory()?t:`The "cwd" option is not a directory: ${e}. -${t}`}});import qme from"node:path";import JB from"node:process";var YB,Dy,Bme,Zme,tO=y(()=>{YB=St(I6(),1);z6();my();Td();UA();KA();JA();YA();XA();Zs();eO();pc();Vi();Dy=(t,e,r)=>{r.cwd=VB(r.cwd);let[n,i,o]=qB(t,e,r),{command:s,args:a,options:c}=YB.default._parse(n,i,o),l=b4(c),u=Bme(l);return zB(u),GB(u),BB(u),iB(u),jB(u),u.shell=gA(u.shell),u.env=Zme(u),u.killSignal=Q6(u.killSignal),u.forceKillAfterDelay=rB(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!qr.has(u.encoding)&&u.buffer[f]),JB.platform==="win32"&&qme.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},Bme=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),Zme=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...JB.env,...t}:t;return r||n?M6({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Ny,rO=y(()=>{Ny=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function $c(t){if(typeof t=="string")return Hme(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Gme(t)}var Hme,Gme,XB,Vme,QB,Wme,nO=y(()=>{Hme=t=>t.at(-1)===XB?t.slice(0,t.at(-2)===QB?-2:-1):t,Gme=t=>t.at(-1)===Vme?t.subarray(0,t.at(-2)===Wme?-2:-1):t,XB=` -`,Vme=XB.codePointAt(0),QB="\r",Wme=QB.codePointAt(0)});function jn(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function iO(t,{checkOpen:e=!0}={}){return jn(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Hs(t,{checkOpen:e=!0}={}){return jn(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function oO(t,e){return iO(t,e)&&Hs(t,e)}var Gs=y(()=>{});function eZ(){return this[aO].next()}function tZ(t){return this[aO].return(t)}function cO({preventCancel:t=!1}={}){let e=this.getReader(),r=new sO(e,t),n=Object.create(Jme);return n[aO]=r,n}var Kme,sO,aO,Jme,rZ=y(()=>{Kme=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),sO=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},aO=Symbol();Object.defineProperty(eZ,"name",{value:"next"});Object.defineProperty(tZ,"name",{value:"return"});Jme=Object.create(Kme,{next:{enumerable:!0,configurable:!0,writable:!0,value:eZ},return:{enumerable:!0,configurable:!0,writable:!0,value:tZ}})});var nZ=y(()=>{});var iZ=y(()=>{rZ();nZ()});var oZ,Yme,Xme,Qme,Dd,lO=y(()=>{Gs();iZ();oZ=t=>{if(Hs(t,{checkOpen:!1})&&Dd.on!==void 0)return Xme(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Yme.call(t)==="[object ReadableStream]")return cO.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Yme}=Object.prototype,Xme=async function*(t){let e=new AbortController,r={};Qme(t,e,r);try{for await(let[n]of Dd.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},Qme=async(t,e,r)=>{try{await Dd.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Dd={}});var kc,ehe,cZ,sZ,the,aZ,ui,Nd=y(()=>{lO();kc=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=oZ(t),u=e();u.length=0;try{for await(let d of l){let f=the(d),p=r[f](d,u);cZ({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return ehe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},ehe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&cZ({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},cZ=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){sZ(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&sZ(c,e,i,o),new ui},sZ=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},the=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=aZ.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&aZ.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:aZ}=Object.prototype,ui=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var Wi,jd,jy,My,zy,Fy=y(()=>{Wi=t=>t,jd=()=>{},jy=({contents:t})=>t,My=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},zy=t=>t.length});async function Ly(t,e){return kc(t,ohe,e)}var rhe,nhe,ihe,ohe,lZ=y(()=>{Nd();Fy();rhe=()=>({contents:[]}),nhe=()=>1,ihe=(t,{contents:e})=>(e.push(t),e),ohe={init:rhe,convertChunk:{string:Wi,buffer:Wi,arrayBuffer:Wi,dataView:Wi,typedArray:Wi,others:Wi},getSize:nhe,truncateChunk:jd,addChunk:ihe,getFinalChunk:jd,finalize:jy}});async function Uy(t,e){return kc(t,mhe,e)}var she,ahe,che,uZ,dZ,lhe,uhe,dhe,fhe,pZ,fZ,phe,mZ,mhe,hZ=y(()=>{Nd();Fy();she=()=>({contents:new ArrayBuffer(0)}),ahe=t=>che.encode(t),che=new TextEncoder,uZ=t=>new Uint8Array(t),dZ=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),lhe=(t,e)=>t.slice(0,e),uhe=(t,{contents:e,length:r},n)=>{let i=mZ()?fhe(e,n):dhe(e,n);return new Uint8Array(i).set(t,r),i},dhe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(pZ(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},fhe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:pZ(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},pZ=t=>fZ**Math.ceil(Math.log(t)/Math.log(fZ)),fZ=2,phe=({contents:t,length:e})=>mZ()?t:t.slice(0,e),mZ=()=>"resize"in ArrayBuffer.prototype,mhe={init:she,convertChunk:{string:ahe,buffer:uZ,arrayBuffer:uZ,dataView:dZ,typedArray:dZ,others:My},getSize:zy,truncateChunk:lhe,addChunk:uhe,getFinalChunk:jd,finalize:phe}});async function By(t,e){return kc(t,vhe,e)}var hhe,qy,ghe,yhe,_he,vhe,gZ=y(()=>{Nd();Fy();hhe=()=>({contents:"",textDecoder:new TextDecoder}),qy=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),ghe=(t,{contents:e})=>e+t,yhe=(t,e)=>t.slice(0,e),_he=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},vhe={init:hhe,convertChunk:{string:Wi,buffer:qy,arrayBuffer:qy,dataView:qy,typedArray:qy,others:My},getSize:zy,truncateChunk:yhe,addChunk:ghe,getFinalChunk:_he,finalize:jy}});var yZ=y(()=>{lZ();hZ();gZ();Nd()});import{on as bhe}from"node:events";import{finished as She}from"node:stream/promises";var Zy=y(()=>{lO();yZ();Object.assign(Dd,{on:bhe,finished:She})});var _Z,whe,vZ,bZ,xhe,SZ,wZ,Hy,Vs=y(()=>{Zy();Hi();Vi();_Z=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof ui))throw t;if(o==="all")return t;let s=whe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},whe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",vZ=(t,e,r)=>{if(e.length!==r)return;let n=new ui;throw n.maxBufferInfo={fdNumber:"ipc"},n},bZ=(t,e)=>{let{streamName:r,threshold:n,unit:i}=xhe(t,e);return`Command's ${r} was larger than ${n} ${i}`},xhe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=Gi(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:Yg(r),threshold:i,unit:n}},SZ=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Hy(r)),wZ=(t,e,r)=>{if(!e)return t;let n=Hy(r);return t.length>n?t.slice(0,n):t},Hy=([,t])=>t});import{inspect as $he}from"node:util";var $Z,khe,Ehe,Ahe,Ohe,The,xZ,kZ=y(()=>{nO();Ur();eO();ey();Vs();Td();qs();$Z=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,x=khe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),$=Ahe(n,b),w=$===void 0?"":` -${$}`,R=`${x}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[R,...T,...t.slice(3),r.map(N=>Ohe(N)).join(` -`)].map(N=>kd($c(The(N)))).filter(Boolean).join(` - -`);return{originalMessage:$,shortMessage:R,message:A}},khe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Ehe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${bZ(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${py(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Ehe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Ahe=(t,e)=>{if(t instanceof Dn)return;let r=U6(t)?t.originalMessage:String(t?.message??t),n=kd(KB(r,e));return n===""?void 0:n},Ohe=t=>typeof t=="string"?t:$he(t),The=t=>Array.isArray(t)?t.map(e=>$c(xZ(e))).filter(Boolean).join(` -`):xZ(t),xZ=t=>typeof t=="string"?t:Nt(t)?Kg(t):""});var Gy,Ec,Md,Phe,EZ,Ihe,zd=y(()=>{Td();sy();qs();kZ();Gy=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>EZ({command:t,escapedCommand:e,cwd:o,durationMs:EA(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Ec=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Md({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),Md=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:x},isSync:$})=>{let{exitCode:w,signal:R,signalDescription:T}=Ihe(l,u),{originalMessage:A,shortMessage:N,message:k}=$Z({stdio:d,all:f,ipcOutput:p,originalError:t,signal:R,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:x,timeout:h,cwd:_}),Z=F6(t,k,$);return Object.assign(Z,Phe({error:Z,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:R,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:N})),Z},Phe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>EZ({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:EA(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),EZ=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Ihe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:py(e);return{exitCode:r,signal:n,signalDescription:i}}});function Rhe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(AZ(t*1e3)%1e3),nanoseconds:Math.trunc(AZ(t*1e6)%1e3)}}function Che(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function uO(t){switch(typeof t){case"number":{if(Number.isFinite(t))return Rhe(t);break}case"bigint":return Che(t)}throw new TypeError("Expected a finite number or bigint")}var AZ,OZ=y(()=>{AZ=t=>Number.isFinite(t)?t:0});function dO(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+jhe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&Dhe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+Nhe(d,u):f;i.push(p)}},a=uO(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%Mhe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var Dhe,Nhe,jhe,Mhe,TZ=y(()=>{OZ();Dhe=t=>t===0||t===0n,Nhe=(t,e)=>e===1||e===1n?t:`${t}s`,jhe=1e-7,Mhe=24n*60n*60n*1000n});var PZ,IZ=y(()=>{gc();PZ=(t,e)=>{t.failed&&ai({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var RZ,zhe,CZ=y(()=>{TZ();Ro();gc();IZ();RZ=(t,e)=>{mc(e)&&(PZ(t,e),zhe(t,e))},zhe=(t,e)=>{let r=`(done in ${dO(t.durationMs)})`;ai({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ac,Vy=y(()=>{CZ();Ac=(t,e,{reject:r})=>{if(RZ(t,e),t.failed&&r)throw t;return t}});var jZ,Fhe,Lhe,MZ,zZ,DZ,Uhe,fO,NZ,Ws,FZ,qhe,Wy,LZ,Bhe,Zhe,pO,UZ,Hhe,qZ,Ky,Ghe,mO,Vhe,Whe,BZ,dn,Jy,hO,ZZ,HZ,jo,ur=y(()=>{Gs();Bi();Ur();jZ=(t,e)=>Ws(t)?"asyncGenerator":FZ(t)?"generator":Wy(t)?"fileUrl":Bhe(t)?"filePath":Ghe(t)?"webStream":jn(t,{checkOpen:!1})?"native":Nt(t)?"uint8Array":Vhe(t)?"asyncIterable":Whe(t)?"iterable":mO(t)?MZ({transform:t},e):qhe(t)?Fhe(t,e):"native",Fhe=(t,e)=>oO(t.transform,{checkOpen:!1})?Lhe(t,e):mO(t.transform)?MZ(t,e):Uhe(t,e),Lhe=(t,e)=>(zZ(t,e,"Duplex stream"),"duplex"),MZ=(t,e)=>(zZ(t,e,"web TransformStream"),"webTransform"),zZ=({final:t,binary:e,objectMode:r},n,i)=>{DZ(t,`${n}.final`,i),DZ(e,`${n}.binary`,i),fO(r,`${n}.objectMode`)},DZ=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Uhe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!NZ(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(oO(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(mO(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!NZ(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return fO(r,`${i}.binary`),fO(n,`${i}.objectMode`),Ws(t)||Ws(e)?"asyncGenerator":"generator"},fO=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},NZ=t=>Ws(t)||FZ(t),Ws=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",FZ=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",qhe=t=>wt(t)&&(t.transform!==void 0||t.final!==void 0),Wy=t=>Object.prototype.toString.call(t)==="[object URL]",LZ=t=>Wy(t)&&t.protocol!=="file:",Bhe=t=>wt(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Zhe.has(e))&&pO(t.file),Zhe=new Set(["file","append"]),pO=t=>typeof t=="string",UZ=(t,e)=>t==="native"&&typeof e=="string"&&!Hhe.has(e),Hhe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),qZ=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Ky=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Ghe=t=>qZ(t)||Ky(t),mO=t=>qZ(t?.readable)&&Ky(t?.writable),Vhe=t=>BZ(t)&&typeof t[Symbol.asyncIterator]=="function",Whe=t=>BZ(t)&&typeof t[Symbol.iterator]=="function",BZ=t=>typeof t=="object"&&t!==null,dn=new Set(["generator","asyncGenerator","duplex","webTransform"]),Jy=new Set(["fileUrl","filePath","fileNumber"]),hO=new Set(["fileUrl","filePath"]),ZZ=new Set([...hO,"webStream","nodeStream"]),HZ=new Set(["webTransform","duplex"]),jo={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var gO,Khe,Jhe,GZ,yO=y(()=>{ur();gO=(t,e,r,n)=>n==="output"?Khe(t,e,r):Jhe(t,e,r),Khe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Jhe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},GZ=(t,e)=>{let r=t.findLast(({type:n})=>dn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var VZ,Yhe,Xhe,Qhe,ege,tge,rge,WZ=y(()=>{Bi();Zs();ur();yO();VZ=(t,e,r,n)=>[...t.filter(({type:i})=>!dn.has(i)),...Yhe(t,e,r,n)],Yhe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>dn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Xhe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return rge(o,r)},Xhe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Qhe({stdioItem:t,optionName:i}):e==="webTransform"?ege({stdioItem:t,index:r,newTransforms:n,direction:o}):tge({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Qhe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},ege=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=wt(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=gO(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},tge=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=wt(e)?e:{transform:e},d=c||qr.has(o),{writableObjectMode:f,readableObjectMode:p}=gO(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},rge=(t,e)=>e==="input"?t.reverse():t});import _O from"node:process";var KZ,nge,ige,Oc,vO,JZ,oge,sge,YZ=y(()=>{Gs();ur();KZ=(t,e,r)=>{let n=t.map(i=>nge(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??sge},nge=({type:t,value:e},r)=>ige[r]??JZ[t](e),ige=["input","output","output"],Oc=()=>{},vO=()=>"input",JZ={generator:Oc,asyncGenerator:Oc,fileUrl:Oc,filePath:Oc,iterable:vO,asyncIterable:vO,uint8Array:vO,webStream:t=>Ky(t)?"output":"input",nodeStream(t){return Hs(t,{checkOpen:!1})?iO(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Oc,duplex:Oc,native(t){let e=oge(t);if(e!==void 0)return e;if(jn(t,{checkOpen:!1}))return JZ.nodeStream(t)}},oge=t=>{if([0,_O.stdin].includes(t))return"input";if([1,2,_O.stdout,_O.stderr].includes(t))return"output"},sge="output"});var XZ,QZ=y(()=>{XZ=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var eH,age,cge,tH,lge,uge,rH=y(()=>{Hi();QZ();Ro();eH=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=age(t,n).map((a,c)=>tH(a,c));return o?lge(s,r,i):XZ(s,e)},age=(t,e)=>{if(t===void 0)return un.map(n=>e[n]);if(cge(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${un.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,un.length);return Array.from({length:r},(n,i)=>t[i])},cge=t=>un.some(e=>t[e]!==void 0),tH=(t,e)=>Array.isArray(t)?t.map(r=>tH(r,e)):t??(e>=un.length?"ignore":"pipe"),lge=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!hc(r,i)&&uge(n)?"ignore":n),uge=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as dge}from"node:fs";import fge from"node:tty";var iH,pge,mge,hge,gge,nH,oH=y(()=>{Gs();Hi();Ur();Do();iH=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?pge({stdioItem:t,fdNumber:n,direction:i}):gge({stdioItem:t,fdNumber:n}),pge=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=mge({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(jn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},mge=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=hge(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(fge.isatty(i))throw new TypeError(`The \`${e}: ${yy(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Zi(dge(i)),optionName:e}}},hge=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=Jg.indexOf(t);if(r!==-1)return r},gge=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:nH(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:nH(e,e,r),optionName:r}:jn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,nH=(t,e,r)=>{let n=Jg[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var sH,yge,_ge,vge,bge,aH=y(()=>{Gs();Ur();ur();sH=({input:t,inputFile:e},r)=>r===0?[...yge(t),...vge(e)]:[],yge=t=>t===void 0?[]:[{type:_ge(t),value:t,optionName:"input"}],_ge=t=>{if(Hs(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Nt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},vge=t=>t===void 0?[]:[{...bge(t),optionName:"inputFile"}],bge=t=>{if(Wy(t))return{type:"fileUrl",value:t};if(pO(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var cH,lH,Sge,wge,uH,xge,$ge,dH,fH=y(()=>{ur();cH=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),lH=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Sge(i,t);if(s.length!==0){if(o){wge({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(ZZ.has(t))return uH({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});HZ.has(t)&&$ge({otherStdioItems:s,type:t,value:e,optionName:r})}},Sge=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),wge=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{hO.has(e)&&uH({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},uH=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>xge(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return dH(s,n,e),i==="output"?o[0].stream:void 0},xge=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,$ge=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);dH(i,n,e)},dH=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${jo[r]} that is the same.`)}});var Yy,kge,Ege,Age,Oge,Tge,Pge,Ige,Rge,Cge,Dge,Nge,bO,jge,Xy=y(()=>{Hi();WZ();yO();ur();YZ();rH();oH();aH();fH();Yy=(t,e,r,n)=>{let o=eH(e,r,n).map((a,c)=>kge({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Cge({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>jge(a)),s},kge=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=Yg(e),{stdioItems:o,isStdioArray:s}=Ege({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=KZ(o,e,i),c=o.map(d=>iH({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=VZ(c,i,a,r),u=GZ(l,a);return Rge(l,u),{direction:a,objectMode:u,stdioItems:l}},Ege=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Age(c,n)),...sH(r,e)],s=cH(o),a=s.length>1;return Oge(s,a,n),Pge(s),{stdioItems:s,isStdioArray:a}},Age=(t,e)=>({type:jZ(t,e),value:t,optionName:e}),Oge=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(Tge.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Tge=new Set(["ignore","ipc"]),Pge=t=>{for(let e of t)Ige(e)},Ige=({type:t,value:e,optionName:r})=>{if(LZ(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. -For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(UZ(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Rge=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Jy.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Cge=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(Dge({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw bO(i),o}},Dge=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Nge({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Nge=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=lH({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},bO=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Cn(r)&&r.destroy()},jge=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as pH}from"node:fs";var hH,di,Mge,gH,mH,zge,yH=y(()=>{Ur();Xy();ur();hH=(t,e)=>Yy(zge,t,e,!0),di=({type:t,optionName:e})=>{gH(e,jo[t])},Mge=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&gH(t,`"${e}"`),{}),gH=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},mH={generator(){},asyncGenerator:di,webStream:di,nodeStream:di,webTransform:di,duplex:di,asyncIterable:di,native:Mge},zge={input:{...mH,fileUrl:({value:t})=>({contents:[Zi(pH(t))]}),filePath:({value:{file:t}})=>({contents:[Zi(pH(t))]}),fileNumber:di,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...mH,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:di,string:di,uint8Array:di}}});var Ki,SO,Fd=y(()=>{nO();Ki=(t,{stripFinalNewline:e},r)=>SO(e,r)&&t!==void 0&&!Array.isArray(t)?$c(t):t,SO=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Qy,xO,_H,vH,Fge,Lge,Uge,bH,qge,wO,Bge,Zge,Hge,e_=y(()=>{Qy=(t,e,r,n)=>t||r?void 0:vH(e,n),xO=(t,e,r)=>r?t.flatMap(n=>_H(n,e)):_H(t,e),_H=(t,e)=>{let{transform:r,final:n}=vH(e,{});return[...r(t),...n()]},vH=(t,e)=>(e.previousChunks="",{transform:Fge.bind(void 0,e,t),final:Uge.bind(void 0,e)}),Fge=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=wO(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=wO(n,r.slice(i+1))),t.previousChunks=n},Lge=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Uge=function*({previousChunks:t}){t.length>0&&(yield t)},bH=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:qge.bind(void 0,n)},qge=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Bge:Hge;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},wO=(t,e)=>`${t}${e}`,Bge={windowsNewline:`\r +${t}`}});import the from"node:path";import QB from"node:process";var eZ,My,rhe,nhe,iT=y(()=>{eZ=St(D6(),1);U6();yy();Id();ZA();XA();QA();eT();tT();Zs();nT();pc();Vi();My=(t,e,r)=>{r.cwd=JB(r.cwd);let[n,i,o]=HB(t,e,r),{command:s,args:a,options:c}=eZ.default._parse(n,i,o),l=x4(c),u=rhe(l);return UB(u),KB(u),GB(u),aB(u),FB(u),u.shell=vA(u.shell),u.env=nhe(u),u.killSignal=rB(u.killSignal),u.forceKillAfterDelay=oB(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!qr.has(u.encoding)&&u.buffer[f]),QB.platform==="win32"&&the.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},rhe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),nhe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...QB.env,...t}:t;return r||n?L6({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var zy,oT=y(()=>{zy=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function $c(t){if(typeof t=="string")return ihe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return ohe(t)}var ihe,ohe,tZ,she,rZ,ahe,sT=y(()=>{ihe=t=>t.at(-1)===tZ?t.slice(0,t.at(-2)===rZ?-2:-1):t,ohe=t=>t.at(-1)===she?t.subarray(0,t.at(-2)===ahe?-2:-1):t,tZ=` +`,she=tZ.codePointAt(0),rZ="\r",ahe=rZ.codePointAt(0)});function jn(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function aT(t,{checkOpen:e=!0}={}){return jn(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Hs(t,{checkOpen:e=!0}={}){return jn(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function cT(t,e){return aT(t,e)&&Hs(t,e)}var Gs=y(()=>{});function nZ(){return this[uT].next()}function iZ(t){return this[uT].return(t)}function dT({preventCancel:t=!1}={}){let e=this.getReader(),r=new lT(e,t),n=Object.create(lhe);return n[uT]=r,n}var che,lT,uT,lhe,oZ=y(()=>{che=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),lT=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},uT=Symbol();Object.defineProperty(nZ,"name",{value:"next"});Object.defineProperty(iZ,"name",{value:"return"});lhe=Object.create(che,{next:{enumerable:!0,configurable:!0,writable:!0,value:nZ},return:{enumerable:!0,configurable:!0,writable:!0,value:iZ}})});var sZ=y(()=>{});var aZ=y(()=>{oZ();sZ()});var cZ,uhe,dhe,fhe,jd,fT=y(()=>{Gs();aZ();cZ=t=>{if(Hs(t,{checkOpen:!1})&&jd.on!==void 0)return dhe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(uhe.call(t)==="[object ReadableStream]")return dT.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:uhe}=Object.prototype,dhe=async function*(t){let e=new AbortController,r={};fhe(t,e,r);try{for await(let[n]of jd.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},fhe=async(t,e,r)=>{try{await jd.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},jd={}});var kc,phe,dZ,lZ,mhe,uZ,ui,Md=y(()=>{fT();kc=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=cZ(t),u=e();u.length=0;try{for await(let d of l){let f=mhe(d),p=r[f](d,u);dZ({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return phe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},phe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&dZ({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},dZ=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){lZ(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&lZ(c,e,i,o),new ui},lZ=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},mhe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=uZ.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&uZ.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:uZ}=Object.prototype,ui=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var Wi,zd,Fy,Ly,Uy,qy=y(()=>{Wi=t=>t,zd=()=>{},Fy=({contents:t})=>t,Ly=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Uy=t=>t.length});async function By(t,e){return kc(t,_he,e)}var hhe,ghe,yhe,_he,fZ=y(()=>{Md();qy();hhe=()=>({contents:[]}),ghe=()=>1,yhe=(t,{contents:e})=>(e.push(t),e),_he={init:hhe,convertChunk:{string:Wi,buffer:Wi,arrayBuffer:Wi,dataView:Wi,typedArray:Wi,others:Wi},getSize:ghe,truncateChunk:zd,addChunk:yhe,getFinalChunk:zd,finalize:Fy}});async function Zy(t,e){return kc(t,Ahe,e)}var vhe,bhe,She,pZ,mZ,whe,xhe,$he,khe,gZ,hZ,Ehe,yZ,Ahe,_Z=y(()=>{Md();qy();vhe=()=>({contents:new ArrayBuffer(0)}),bhe=t=>She.encode(t),She=new TextEncoder,pZ=t=>new Uint8Array(t),mZ=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),whe=(t,e)=>t.slice(0,e),xhe=(t,{contents:e,length:r},n)=>{let i=yZ()?khe(e,n):$he(e,n);return new Uint8Array(i).set(t,r),i},$he=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(gZ(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},khe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:gZ(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},gZ=t=>hZ**Math.ceil(Math.log(t)/Math.log(hZ)),hZ=2,Ehe=({contents:t,length:e})=>yZ()?t:t.slice(0,e),yZ=()=>"resize"in ArrayBuffer.prototype,Ahe={init:vhe,convertChunk:{string:bhe,buffer:pZ,arrayBuffer:pZ,dataView:mZ,typedArray:mZ,others:Ly},getSize:Uy,truncateChunk:whe,addChunk:xhe,getFinalChunk:zd,finalize:Ehe}});async function Gy(t,e){return kc(t,Rhe,e)}var The,Hy,Ohe,Phe,Ihe,Rhe,vZ=y(()=>{Md();qy();The=()=>({contents:"",textDecoder:new TextDecoder}),Hy=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Ohe=(t,{contents:e})=>e+t,Phe=(t,e)=>t.slice(0,e),Ihe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Rhe={init:The,convertChunk:{string:Wi,buffer:Hy,arrayBuffer:Hy,dataView:Hy,typedArray:Hy,others:Ly},getSize:Uy,truncateChunk:Phe,addChunk:Ohe,getFinalChunk:Ihe,finalize:Fy}});var bZ=y(()=>{fZ();_Z();vZ();Md()});import{on as Che}from"node:events";import{finished as Dhe}from"node:stream/promises";var Vy=y(()=>{fT();bZ();Object.assign(jd,{on:Che,finished:Dhe})});var SZ,Nhe,wZ,xZ,jhe,$Z,kZ,Wy,Vs=y(()=>{Vy();Hi();Vi();SZ=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof ui))throw t;if(o==="all")return t;let s=Nhe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Nhe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",wZ=(t,e,r)=>{if(e.length!==r)return;let n=new ui;throw n.maxBufferInfo={fdNumber:"ipc"},n},xZ=(t,e)=>{let{streamName:r,threshold:n,unit:i}=jhe(t,e);return`Command's ${r} was larger than ${n} ${i}`},jhe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=Gi(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:ey(r),threshold:i,unit:n}},$Z=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Wy(r)),kZ=(t,e,r)=>{if(!e)return t;let n=Wy(r);return t.length>n?t.slice(0,n):t},Wy=([,t])=>t});import{inspect as Mhe}from"node:util";var AZ,zhe,Fhe,Lhe,Uhe,qhe,EZ,TZ=y(()=>{sT();Ur();nT();ny();Vs();Id();qs();AZ=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,x=zhe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),$=Lhe(n,b),w=$===void 0?"":` +${$}`,R=`${x}: ${a}${w}`,O=e===void 0?[t[2],t[1]]:[e],A=[R,...O,...t.slice(3),r.map(N=>Uhe(N)).join(` +`)].map(N=>Ad($c(qhe(N)))).filter(Boolean).join(` + +`);return{originalMessage:$,shortMessage:R,message:A}},zhe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Fhe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${xZ(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${gy(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Fhe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Lhe=(t,e)=>{if(t instanceof Dn)return;let r=Z6(t)?t.originalMessage:String(t?.message??t),n=Ad(XB(r,e));return n===""?void 0:n},Uhe=t=>typeof t=="string"?t:Mhe(t),qhe=t=>Array.isArray(t)?t.map(e=>$c(EZ(e))).filter(Boolean).join(` +`):EZ(t),EZ=t=>typeof t=="string"?t:Nt(t)?Xg(t):""});var Ky,Ec,Fd,Bhe,OZ,Zhe,Ld=y(()=>{Id();ly();qs();TZ();Ky=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>OZ({command:t,escapedCommand:e,cwd:o,durationMs:OA(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Ec=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Fd({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),Fd=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:x},isSync:$})=>{let{exitCode:w,signal:R,signalDescription:O}=Zhe(l,u),{originalMessage:A,shortMessage:N,message:k}=AZ({stdio:d,all:f,ipcOutput:p,originalError:t,signal:R,signalDescription:O,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:x,timeout:h,cwd:_}),Z=q6(t,k,$);return Object.assign(Z,Bhe({error:Z,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:R,signalDescription:O,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:N})),Z},Bhe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>OZ({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:OA(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),OZ=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Zhe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:gy(e);return{exitCode:r,signal:n,signalDescription:i}}});function Hhe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(PZ(t*1e3)%1e3),nanoseconds:Math.trunc(PZ(t*1e6)%1e3)}}function Ghe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function pT(t){switch(typeof t){case"number":{if(Number.isFinite(t))return Hhe(t);break}case"bigint":return Ghe(t)}throw new TypeError("Expected a finite number or bigint")}var PZ,IZ=y(()=>{PZ=t=>Number.isFinite(t)?t:0});function mT(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+Khe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&Vhe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+Whe(d,u):f;i.push(p)}},a=pT(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%Jhe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var Vhe,Whe,Khe,Jhe,RZ=y(()=>{IZ();Vhe=t=>t===0||t===0n,Whe=(t,e)=>e===1||e===1n?t:`${t}s`,Khe=1e-7,Jhe=24n*60n*60n*1000n});var CZ,DZ=y(()=>{gc();CZ=(t,e)=>{t.failed&&ai({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var NZ,Yhe,jZ=y(()=>{RZ();Ro();gc();DZ();NZ=(t,e)=>{mc(e)&&(CZ(t,e),Yhe(t,e))},Yhe=(t,e)=>{let r=`(done in ${mT(t.durationMs)})`;ai({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ac,Jy=y(()=>{jZ();Ac=(t,e,{reject:r})=>{if(NZ(t,e),t.failed&&r)throw t;return t}});var FZ,Xhe,Qhe,LZ,UZ,MZ,ege,hT,zZ,Ws,qZ,tge,Yy,BZ,rge,nge,gT,ZZ,ige,HZ,Xy,oge,yT,sge,age,GZ,dn,Qy,_T,VZ,WZ,jo,ur=y(()=>{Gs();Bi();Ur();FZ=(t,e)=>Ws(t)?"asyncGenerator":qZ(t)?"generator":Yy(t)?"fileUrl":rge(t)?"filePath":oge(t)?"webStream":jn(t,{checkOpen:!1})?"native":Nt(t)?"uint8Array":sge(t)?"asyncIterable":age(t)?"iterable":yT(t)?LZ({transform:t},e):tge(t)?Xhe(t,e):"native",Xhe=(t,e)=>cT(t.transform,{checkOpen:!1})?Qhe(t,e):yT(t.transform)?LZ(t,e):ege(t,e),Qhe=(t,e)=>(UZ(t,e,"Duplex stream"),"duplex"),LZ=(t,e)=>(UZ(t,e,"web TransformStream"),"webTransform"),UZ=({final:t,binary:e,objectMode:r},n,i)=>{MZ(t,`${n}.final`,i),MZ(e,`${n}.binary`,i),hT(r,`${n}.objectMode`)},MZ=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},ege=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!zZ(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(cT(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(yT(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!zZ(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return hT(r,`${i}.binary`),hT(n,`${i}.objectMode`),Ws(t)||Ws(e)?"asyncGenerator":"generator"},hT=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},zZ=t=>Ws(t)||qZ(t),Ws=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",qZ=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",tge=t=>wt(t)&&(t.transform!==void 0||t.final!==void 0),Yy=t=>Object.prototype.toString.call(t)==="[object URL]",BZ=t=>Yy(t)&&t.protocol!=="file:",rge=t=>wt(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>nge.has(e))&&gT(t.file),nge=new Set(["file","append"]),gT=t=>typeof t=="string",ZZ=(t,e)=>t==="native"&&typeof e=="string"&&!ige.has(e),ige=new Set(["ipc","ignore","inherit","overlapped","pipe"]),HZ=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Xy=t=>Object.prototype.toString.call(t)==="[object WritableStream]",oge=t=>HZ(t)||Xy(t),yT=t=>HZ(t?.readable)&&Xy(t?.writable),sge=t=>GZ(t)&&typeof t[Symbol.asyncIterator]=="function",age=t=>GZ(t)&&typeof t[Symbol.iterator]=="function",GZ=t=>typeof t=="object"&&t!==null,dn=new Set(["generator","asyncGenerator","duplex","webTransform"]),Qy=new Set(["fileUrl","filePath","fileNumber"]),_T=new Set(["fileUrl","filePath"]),VZ=new Set([..._T,"webStream","nodeStream"]),WZ=new Set(["webTransform","duplex"]),jo={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var vT,cge,lge,KZ,bT=y(()=>{ur();vT=(t,e,r,n)=>n==="output"?cge(t,e,r):lge(t,e,r),cge=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},lge=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},KZ=(t,e)=>{let r=t.findLast(({type:n})=>dn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var JZ,uge,dge,fge,pge,mge,hge,YZ=y(()=>{Bi();Zs();ur();bT();JZ=(t,e,r,n)=>[...t.filter(({type:i})=>!dn.has(i)),...uge(t,e,r,n)],uge=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>dn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=dge({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return hge(o,r)},dge=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?fge({stdioItem:t,optionName:i}):e==="webTransform"?pge({stdioItem:t,index:r,newTransforms:n,direction:o}):mge({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),fge=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},pge=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=wt(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=vT(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},mge=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=wt(e)?e:{transform:e},d=c||qr.has(o),{writableObjectMode:f,readableObjectMode:p}=vT(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},hge=(t,e)=>e==="input"?t.reverse():t});import ST from"node:process";var XZ,gge,yge,Tc,wT,QZ,_ge,vge,eH=y(()=>{Gs();ur();XZ=(t,e,r)=>{let n=t.map(i=>gge(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??vge},gge=({type:t,value:e},r)=>yge[r]??QZ[t](e),yge=["input","output","output"],Tc=()=>{},wT=()=>"input",QZ={generator:Tc,asyncGenerator:Tc,fileUrl:Tc,filePath:Tc,iterable:wT,asyncIterable:wT,uint8Array:wT,webStream:t=>Xy(t)?"output":"input",nodeStream(t){return Hs(t,{checkOpen:!1})?aT(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Tc,duplex:Tc,native(t){let e=_ge(t);if(e!==void 0)return e;if(jn(t,{checkOpen:!1}))return QZ.nodeStream(t)}},_ge=t=>{if([0,ST.stdin].includes(t))return"input";if([1,2,ST.stdout,ST.stderr].includes(t))return"output"},vge="output"});var tH,rH=y(()=>{tH=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var nH,bge,Sge,iH,wge,xge,oH=y(()=>{Hi();rH();Ro();nH=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=bge(t,n).map((a,c)=>iH(a,c));return o?wge(s,r,i):tH(s,e)},bge=(t,e)=>{if(t===void 0)return un.map(n=>e[n]);if(Sge(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${un.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,un.length);return Array.from({length:r},(n,i)=>t[i])},Sge=t=>un.some(e=>t[e]!==void 0),iH=(t,e)=>Array.isArray(t)?t.map(r=>iH(r,e)):t??(e>=un.length?"ignore":"pipe"),wge=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!hc(r,i)&&xge(n)?"ignore":n),xge=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as $ge}from"node:fs";import kge from"node:tty";var aH,Ege,Age,Tge,Oge,sH,cH=y(()=>{Gs();Hi();Ur();Do();aH=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Ege({stdioItem:t,fdNumber:n,direction:i}):Oge({stdioItem:t,fdNumber:n}),Ege=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Age({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(jn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Age=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Tge(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(kge.isatty(i))throw new TypeError(`The \`${e}: ${by(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Zi($ge(i)),optionName:e}}},Tge=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=Qg.indexOf(t);if(r!==-1)return r},Oge=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:sH(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:sH(e,e,r),optionName:r}:jn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,sH=(t,e,r)=>{let n=Qg[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var lH,Pge,Ige,Rge,Cge,uH=y(()=>{Gs();Ur();ur();lH=({input:t,inputFile:e},r)=>r===0?[...Pge(t),...Rge(e)]:[],Pge=t=>t===void 0?[]:[{type:Ige(t),value:t,optionName:"input"}],Ige=t=>{if(Hs(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Nt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Rge=t=>t===void 0?[]:[{...Cge(t),optionName:"inputFile"}],Cge=t=>{if(Yy(t))return{type:"fileUrl",value:t};if(gT(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var dH,fH,Dge,Nge,pH,jge,Mge,mH,hH=y(()=>{ur();dH=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),fH=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Dge(i,t);if(s.length!==0){if(o){Nge({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(VZ.has(t))return pH({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});WZ.has(t)&&Mge({otherStdioItems:s,type:t,value:e,optionName:r})}},Dge=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Nge=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{_T.has(e)&&pH({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},pH=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>jge(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return mH(s,n,e),i==="output"?o[0].stream:void 0},jge=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Mge=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);mH(i,n,e)},mH=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${jo[r]} that is the same.`)}});var e_,zge,Fge,Lge,Uge,qge,Bge,Zge,Hge,Gge,Vge,Wge,xT,Kge,t_=y(()=>{Hi();YZ();bT();ur();eH();oH();cH();uH();hH();e_=(t,e,r,n)=>{let o=nH(e,r,n).map((a,c)=>zge({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Gge({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Kge(a)),s},zge=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=ey(e),{stdioItems:o,isStdioArray:s}=Fge({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=XZ(o,e,i),c=o.map(d=>aH({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=JZ(c,i,a,r),u=KZ(l,a);return Hge(l,u),{direction:a,objectMode:u,stdioItems:l}},Fge=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Lge(c,n)),...lH(r,e)],s=dH(o),a=s.length>1;return Uge(s,a,n),Bge(s),{stdioItems:s,isStdioArray:a}},Lge=(t,e)=>({type:FZ(t,e),value:t,optionName:e}),Uge=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(qge.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},qge=new Set(["ignore","ipc"]),Bge=t=>{for(let e of t)Zge(e)},Zge=({type:t,value:e,optionName:r})=>{if(BZ(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. +For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(ZZ(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Hge=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Qy.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Gge=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(Vge({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw xT(i),o}},Vge=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Wge({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Wge=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=fH({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},xT=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Cn(r)&&r.destroy()},Kge=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as gH}from"node:fs";var _H,di,Jge,vH,yH,Yge,bH=y(()=>{Ur();t_();ur();_H=(t,e)=>e_(Yge,t,e,!0),di=({type:t,optionName:e})=>{vH(e,jo[t])},Jge=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&vH(t,`"${e}"`),{}),vH=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},yH={generator(){},asyncGenerator:di,webStream:di,nodeStream:di,webTransform:di,duplex:di,asyncIterable:di,native:Jge},Yge={input:{...yH,fileUrl:({value:t})=>({contents:[Zi(gH(t))]}),filePath:({value:{file:t}})=>({contents:[Zi(gH(t))]}),fileNumber:di,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...yH,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:di,string:di,uint8Array:di}}});var Ki,$T,Ud=y(()=>{sT();Ki=(t,{stripFinalNewline:e},r)=>$T(e,r)&&t!==void 0&&!Array.isArray(t)?$c(t):t,$T=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var r_,ET,SH,wH,Xge,Qge,eye,xH,tye,kT,rye,nye,iye,n_=y(()=>{r_=(t,e,r,n)=>t||r?void 0:wH(e,n),ET=(t,e,r)=>r?t.flatMap(n=>SH(n,e)):SH(t,e),SH=(t,e)=>{let{transform:r,final:n}=wH(e,{});return[...r(t),...n()]},wH=(t,e)=>(e.previousChunks="",{transform:Xge.bind(void 0,e,t),final:eye.bind(void 0,e)}),Xge=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=kT(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=kT(n,r.slice(i+1))),t.previousChunks=n},Qge=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),eye=function*({previousChunks:t}){t.length>0&&(yield t)},xH=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:tye.bind(void 0,n)},tye=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?rye:iye;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},kT=(t,e)=>`${t}${e}`,rye={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:wO},Zge=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Hge={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Zge}});import{Buffer as Gge}from"node:buffer";var SH,Vge,wH,Wge,Kge,xH,$H=y(()=>{Ur();SH=(t,e)=>t?void 0:Vge.bind(void 0,e),Vge=function*(t,e){if(typeof e!="string"&&!Nt(e)&&!Gge.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},wH=(t,e)=>t?Wge.bind(void 0,e):Kge.bind(void 0,e),Wge=function*(t,e){xH(t,e),yield e},Kge=function*(t,e){if(xH(t,e),typeof e!="string"&&!Nt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},xH=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:kT},nye=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},iye={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:nye}});import{Buffer as oye}from"node:buffer";var $H,sye,kH,aye,cye,EH,AH=y(()=>{Ur();$H=(t,e)=>t?void 0:sye.bind(void 0,e),sye=function*(t,e){if(typeof e!="string"&&!Nt(e)&&!oye.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},kH=(t,e)=>t?aye.bind(void 0,e):cye.bind(void 0,e),aye=function*(t,e){EH(t,e),yield e},cye=function*(t,e){if(EH(t,e),typeof e!="string"&&!Nt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},EH=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. Instead, \`yield\` should either be called with a value, or not be called at all. For example: - if (condition) { yield value; }`)}});import{Buffer as Jge}from"node:buffer";import{StringDecoder as Yge}from"node:string_decoder";var t_,Xge,Qge,eye,$O=y(()=>{Ur();t_=(t,e,r)=>{if(r)return;if(t)return{transform:Xge.bind(void 0,new TextEncoder)};let n=new Yge(e);return{transform:Qge.bind(void 0,n),final:eye.bind(void 0,n)}},Xge=function*(t,e){Jge.isBuffer(e)?yield Zi(e):typeof e=="string"?yield t.encode(e):yield e},Qge=function*(t,e){yield Nt(e)?t.write(e):e},eye=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as kH}from"node:util";var kO,r_,EH,tye,AH,rye,OH=y(()=>{kO=kH(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),r_=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=rye}=e[r];for await(let i of n(t))yield*r_(i,e,r+1)},EH=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*tye(r,Number(e),t)},tye=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*r_(n,r,e+1)},AH=kH(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),rye=function*(t){yield t}});var EO,TH,Ks,Ld,nye,iye,AO=y(()=>{EO=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},TH=(t,e)=>[...e.flatMap(r=>[...Ks(r,t,0)]),...Ld(t)],Ks=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=iye}=e[r];for(let i of n(t))yield*Ks(i,e,r+1)},Ld=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*nye(r,Number(e),t)},nye=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ks(n,r,e+1)},iye=function*(t){yield t}});import{Transform as oye,getDefaultHighWaterMark as PH}from"node:stream";var OO,n_,IH,i_=y(()=>{ur();e_();$H();$O();OH();AO();OO=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=IH(t,s,o),l=Ws(e),u=Ws(r),d=l?kO.bind(void 0,r_,a):EO.bind(void 0,Ks),f=l||u?kO.bind(void 0,EH,a):EO.bind(void 0,Ld),p=l||u?AH.bind(void 0,a):void 0;return{stream:new oye({writableObjectMode:n,writableHighWaterMark:PH(n),readableObjectMode:i,readableHighWaterMark:PH(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},n_=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=IH(s,r,a);t=TH(c,t)}return t},IH=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:SH(n,a)},t_(r,s,n),Qy(r,o,n,c),{transform:t,final:e},{transform:wH(i,a)},bH({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var RH,sye,aye,cye,lye,CH=y(()=>{i_();Ur();ur();RH=(t,e)=>{for(let r of sye(t))aye(t,r,e)},sye=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),aye=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${jo[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>cye(a,n));r.input=$d(s)},cye=(t,e)=>{let r=n_(t,e,"utf8",!0);return lye(r),$d(r)},lye=t=>{let e=t.find(r=>typeof r!="string"&&!Nt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var o_,uye,dye,DH,NH,fye,jH,TO=y(()=>{Zs();ur();gc();Ro();o_=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&hc(r,n)&&!qr.has(e)&&uye(n)&&(t.some(({type:i,value:o})=>i==="native"&&dye.has(o))||t.every(({type:i})=>dn.has(i))),uye=t=>t===1||t===2,dye=new Set(["pipe","overlapped"]),DH=async(t,e,r,n)=>{for await(let i of t)fye(e)||jH(i,r,n)},NH=(t,e,r)=>{for(let n of t)jH(n,e,r)},fye=t=>t._readableState.pipes.length>0,jH=(t,e,r)=>{let n=iy(t);ai({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as pye,appendFileSync as mye}from"node:fs";var MH,hye,gye,yye,_ye,vye,zH=y(()=>{TO();i_();e_();Ur();ur();Vs();MH=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>hye({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},hye=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=wZ(t,o,d),p=Zi(f),{stdioItems:m,objectMode:h}=e[r],g=gye([p],m,c,n),{serializedResult:b,finalResult:_=b}=yye({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});_ye({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let x=a[r]?_:void 0;try{return n.error===void 0&&vye(b,m,i),x}catch($){return n.error=$,x}},gye=(t,e,r,n)=>{try{return n_(t,e,r,!1)}catch(i){return n.error=i,t}},yye=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:$d(t)};let s=f4(t,r);return n[o]?{serializedResult:s,finalResult:xO(s,!i[o],e)}:{serializedResult:s}},_ye=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!o_({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=xO(t,!1,s);try{NH(a,e,n)}catch(c){r.error??=c}},vye=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Jy.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?mye(n,t):(r.add(o),pye(n,t))}}});var FH,LH=y(()=>{Ur();Fd();FH=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Ki(e,r,"all")]:Array.isArray(e)?[Ki(t,r,"all"),...e]:Nt(t)&&Nt(e)?_A([t,e]):`${t}${e}`}});import{once as PO}from"node:events";var UH,bye,qH,BH,Sye,IO,RO=y(()=>{qs();UH=async(t,e)=>{let[r,n]=await bye(t);return e.isForcefullyTerminated??=!1,[r,n]},bye=async t=>{let[e,r]=await Promise.allSettled([PO(t,"spawn"),PO(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?qH(t):r.value},qH=async t=>{try{return await PO(t,"exit")}catch{return qH(t)}},BH=async t=>{let[e,r]=await t;if(!Sye(e,r)&&IO(e,r))throw new Dn;return[e,r]},Sye=(t,e)=>t===void 0&&e===void 0,IO=(t,e)=>t!==0||e!==null});var ZH,wye,HH=y(()=>{qs();Vs();RO();ZH=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=wye(t,e,r),s=o?.code==="ETIMEDOUT",a=SZ(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},wye=(t,e,r)=>t!==void 0?t:IO(e,r)?new Dn:void 0});import{spawnSync as xye}from"node:child_process";var GH,$ye,kye,Eye,s_,Aye,Oye,Tye,Pye,VH=y(()=>{AA();tO();rO();zd();Vy();yH();Fd();CH();zH();Vs();LH();HH();GH=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=$ye(t,e,r),d=Aye({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ac(d,c,l)},$ye=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ay(t,e,r),a=kye(r),{file:c,commandArguments:l,options:u}=Dy(t,e,a);Eye(u);let d=hH(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},kye=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Eye=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&s_("ipcInput"),t&&s_("ipc: true"),r&&s_("detached: true"),n&&s_("cancelSignal")},s_=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Aye=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Oye({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=ZH(c,r),{output:m,error:h=l}=MH({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,x)=>Ki(_,r,x)),b=Ki(FH(m,r),r,"all");return Pye({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Oye=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{RH(o,r);let a=Tye(r);return xye(...Ny(t,e,a))}catch(a){return Ec({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},Tye=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Hy(e)}),Pye=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Gy({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Md({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as CO,on as Iye}from"node:events";var WH,Rye,Cye,Dye,Nye,KH=y(()=>{Sc();Rd();Id();WH=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(vc({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Ay(t)}),Rye({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Rye=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{by(e,i);let o=No(t,e,r),s=new AbortController;try{return await Promise.race([Cye(o,n,s),Dye(o,r,s),Nye(o,r,s)])}catch(a){throw bc(t),a}finally{s.abort(),Sy(e,i)}},Cye=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await CO(t,"message",{signal:r});return n}for await(let[n]of Iye(t,"message",{signal:r}))if(e(n))return n},Dye=async(t,e,{signal:r})=>{await CO(t,"disconnect",{signal:r}),sB(e)},Nye=async(t,e,{signal:r})=>{let[n]=await CO(t,"strict:error",{signal:r});throw gy(n,e)}});import{once as YH,on as jye}from"node:events";var XH,DO,Mye,zye,Fye,JH,NO=y(()=>{Sc();Rd();Id();XH=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>DO({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),DO=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{vc({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Ay(t)}),by(e,o);let s=No(t,e,r),a=new AbortController,c={};return Mye(t,s,a),zye({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Fye({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Mye=async(t,e,r)=>{try{await YH(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},zye=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await YH(t,"strict:error",{signal:r.signal});n.error=gy(i,e),r.abort()}catch{}},Fye=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of jye(r,"message",{signal:o.signal}))JH(s),yield c}catch{JH(s)}finally{o.abort(),Sy(e,a),n||bc(t),i&&await t}},JH=({error:t})=>{if(t)throw t}});import QH from"node:process";var eG,tG,rG,jO=y(()=>{Ry();KH();NO();ky();eG=(t,{ipc:e})=>{Object.assign(t,rG(t,!1,e))},tG=()=>{let t=QH,e=!0,r=QH.channel!==void 0;return{...rG(t,e,r),getCancelSignal:DB.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},rG=(t,e,r)=>({sendMessage:Iy.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:WH.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:XH.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as Lye}from"node:child_process";import{PassThrough as Uye,Readable as qye,Writable as Bye,Duplex as Zye}from"node:stream";var nG,Hye,Ud,Gye,Vye,Wye,Kye,iG=y(()=>{Xy();zd();Vy();nG=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{bO(n);let a=new Lye;Hye(a,n),Object.assign(a,{readable:Gye,writable:Vye,duplex:Wye});let c=Ec({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=Kye(c,s,i);return{subprocess:a,promise:l}},Hye=(t,e)=>{let r=Ud(),n=Ud(),i=Ud(),o=Array.from({length:e.length-3},Ud),s=Ud(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Ud=()=>{let t=new Uye;return t.end(),t},Gye=()=>new qye({read(){}}),Vye=()=>new Bye({write(){}}),Wye=()=>new Zye({read(){},write(){}}),Kye=async(t,e,r)=>Ac(t,e,r)});import{createReadStream as oG,createWriteStream as sG}from"node:fs";import{Buffer as Jye}from"node:buffer";import{Readable as qd,Writable as Yye,Duplex as Xye}from"node:stream";var cG,Bd,aG,Qye,lG=y(()=>{i_();Xy();ur();cG=(t,e)=>Yy(Qye,t,e,!1),Bd=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${jo[t]}.`)},aG={fileNumber:Bd,generator:OO,asyncGenerator:OO,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Xye.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Qye={input:{...aG,fileUrl:({value:t})=>({stream:oG(t)}),filePath:({value:{file:t}})=>({stream:oG(t)}),webStream:({value:t})=>({stream:qd.fromWeb(t)}),iterable:({value:t})=>({stream:qd.from(t)}),asyncIterable:({value:t})=>({stream:qd.from(t)}),string:({value:t})=>({stream:qd.from(t)}),uint8Array:({value:t})=>({stream:qd.from(Jye.from(t))})},output:{...aG,fileUrl:({value:t})=>({stream:sG(t)}),filePath:({value:{file:t,append:e}})=>({stream:sG(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Yye.fromWeb(t)}),iterable:Bd,asyncIterable:Bd,string:Bd,uint8Array:Bd}}});import{on as e_e,once as uG}from"node:events";import{PassThrough as t_e,getDefaultHighWaterMark as r_e}from"node:stream";import{finished as pG}from"node:stream/promises";function Js(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)zO(i);let e=t.some(({readableObjectMode:i})=>i),r=n_e(t,e),n=new MO({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var n_e,MO,i_e,o_e,s_e,zO,a_e,c_e,l_e,u_e,d_e,mG,hG,FO,gG,f_e,a_,dG,fG,c_=y(()=>{n_e=(t,e)=>{if(t.length===0)return r_e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},MO=class extends t_e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(zO(e),this.#t.has(e))return;this.#t.add(e),this.#n??=i_e(this,this.#t,this.#o);let r=a_e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(zO(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},i_e=async(t,e,r)=>{a_(t,dG);let n=new AbortController;try{await Promise.race([o_e(t,n),s_e(t,e,r,n)])}finally{n.abort(),a_(t,-dG)}},o_e=async(t,{signal:e})=>{try{await pG(t,{signal:e,cleanup:!0})}catch(r){throw mG(t,r),r}},s_e=async(t,e,r,{signal:n})=>{for await(let[i]of e_e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},zO=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},a_e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{a_(t,fG);let a=new AbortController;try{await Promise.race([c_e(o,e,a),l_e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),u_e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),a_(t,-fG)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?FO(t):d_e(t))},c_e=async(t,e,{signal:r})=>{try{await t,r.aborted||FO(e)}catch(n){r.aborted||mG(e,n)}},l_e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await pG(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;hG(s)?i.add(e):gG(t,s)}},u_e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await uG(t,i,{signal:o}),!t.readable)return uG(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},d_e=t=>{t.writable&&t.end()},mG=(t,e)=>{hG(e)?FO(t):gG(t,e)},hG=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",FO=t=>{(t.readable||t.writable)&&t.destroy()},gG=(t,e)=>{t.destroyed||(t.once("error",f_e),t.destroy(e))},f_e=()=>{},a_=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},dG=2,fG=1});import{finished as yG}from"node:stream/promises";var Tc,p_e,LO,m_e,UO,l_=y(()=>{Hi();Tc=(t,e)=>{t.pipe(e),p_e(t,e),m_e(t,e)},p_e=async(t,e)=>{if(!(Cn(t)||Cn(e))){try{await yG(t,{cleanup:!0,readable:!0,writable:!1})}catch{}LO(e)}},LO=t=>{t.writable&&t.end()},m_e=async(t,e)=>{if(!(Cn(t)||Cn(e))){try{await yG(e,{cleanup:!0,readable:!1,writable:!0})}catch{}UO(t)}},UO=t=>{t.readable&&t.destroy()}});var _G,h_e,g_e,y_e,__e,v_e,vG=y(()=>{c_();Hi();vy();ur();l_();_G=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>dn.has(c)))h_e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!dn.has(c)))y_e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Js(o);Tc(s,i)}},h_e=(t,e,r,n)=>{r==="output"?Tc(t.stdio[n],e):Tc(e,t.stdio[n]);let i=g_e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},g_e=["stdin","stdout","stderr"],y_e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;__e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},__e=(t,{signal:e})=>{Cn(t)&&Bs(t,v_e,e)},v_e=2});var Ys,bG=y(()=>{Ys=[];Ys.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ys.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ys.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var u_,qO,BO,b_e,ZO,d_,S_e,HO,GO,VO,SG,J5e,Y5e,wG=y(()=>{bG();u_=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",qO=Symbol.for("signal-exit emitter"),BO=globalThis,b_e=Object.defineProperty.bind(Object),ZO=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(BO[qO])return BO[qO];b_e(BO,qO,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},d_=class{},S_e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),HO=class extends d_{onExit(){return()=>{}}load(){}unload(){}},GO=class extends d_{#t=VO.platform==="win32"?"SIGINT":"SIGHUP";#r=new ZO;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ys)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!u_(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Ys)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Ys.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return u_(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&u_(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},VO=globalThis.process,{onExit:SG,load:J5e,unload:Y5e}=S_e(u_(VO)?new GO(VO):new HO)});import{addAbortListener as w_e}from"node:events";var xG,$G=y(()=>{wG();xG=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=SG(()=>{t.kill()});w_e(n,()=>{i()})}});var EG,x_e,$_e,kG,k_e,AG=y(()=>{yA();sy();Do();pc();EG=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=oy(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=x_e(r,n,i),{sourceStream:d,sourceError:f}=k_e(t,l),{options:p,fileDescriptors:m}=li.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},x_e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=$_e(t,e,...r),a=_y(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},$_e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(kG,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||hA(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=Wg(r,...n);return{destination:e(kG)(i,o,s),pipeOptions:s}}if(li.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},kG=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),k_e=(t,e)=>{try{return{sourceStream:xc(t,e)}}catch(r){return{sourceError:r}}}});var TG,E_e,WO,OG,KO=y(()=>{zd();l_();TG=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=E_e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw WO({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},E_e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return UO(t),n;if(e!==void 0)return LO(r),e},WO=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Ec({error:t,command:OG,escapedCommand:OG,fileDescriptors:e,options:r,startTime:n,isSync:!1}),OG="source.pipe(destination)"});var PG,IG=y(()=>{PG=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as A_e}from"node:stream/promises";var RG,O_e,T_e,P_e,f_,I_e,R_e,CG=y(()=>{c_();vy();l_();RG=(t,e,r)=>{let n=f_.has(e)?T_e(t,e):O_e(t,e);return Bs(t,I_e,r.signal),Bs(e,R_e,r.signal),P_e(e),n},O_e=(t,e)=>{let r=Js([t]);return Tc(r,e),f_.set(e,r),r},T_e=(t,e)=>{let r=f_.get(e);return r.add(t),r},P_e=async t=>{try{await A_e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}f_.delete(t)},f_=new WeakMap,I_e=2,R_e=1});import{aborted as C_e}from"node:util";var DG,D_e,NG=y(()=>{KO();DG=(t,e)=>t===void 0?[]:[D_e(t,e)],D_e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await C_e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw WO({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var p_,N_e,j_e,jG=y(()=>{Bi();AG();KO();IG();CG();NG();p_=(t,...e)=>{if(wt(e[0]))return p_.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=EG(t,...e),i=N_e({...n,destination:r});return i.pipe=p_.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},N_e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=j_e(t,i);TG({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=RG(e,o,d);return await Promise.race([PG(u),...DG(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},j_e=(t,e)=>Promise.allSettled([t,e])});import{on as M_e}from"node:events";import{getDefaultHighWaterMark as z_e}from"node:stream";var m_,F_e,JO,L_e,zG,YO,MG,U_e,q_e,h_=y(()=>{$O();e_();AO();m_=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return F_e(e,s),zG({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},F_e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},JO=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;L_e(e,s,t);let a=t.readableObjectMode&&!o;return zG({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},L_e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},zG=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=M_e(t,"data",{signal:e.signal,highWaterMark:MG,highWatermark:MG});return U_e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},YO=z_e(!0),MG=YO,U_e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=q_e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ks(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Ld(a)}},q_e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[t_(t,r,!e),Qy(t,i,!n,{})].filter(Boolean)});import{setImmediate as B_e}from"node:timers/promises";var FG,Z_e,H_e,G_e,XO,LG,QO=y(()=>{Zy();Ur();TO();h_();Vs();Fd();FG=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=Z_e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([H_e(t),d]);return}let f=SO(c,r),p=JO({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([G_e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Z_e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!o_({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=JO({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await DH(a,t,r,o)},H_e=async t=>{await B_e(),t.readableFlowing===null&&t.resume()},G_e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Ly(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Uy(r,{maxBuffer:o})):await By(r,{maxBuffer:o})}catch(a){return LG(_Z({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},XO=async t=>{try{return await t}catch(e){return LG(e)}},LG=({bufferedData:t})=>u4(t)?new Uint8Array(t):t});import{finished as V_e}from"node:stream/promises";var Zd,W_e,K_e,J_e,Y_e,X_e,eT,g_,UG,y_=y(()=>{Zd=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=W_e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],V_e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Y_e(a,e,r,n)}finally{s.abort()}},W_e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&K_e(t,r,n),n},K_e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{J_e(e,r),n.call(t,...i)}},J_e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Y_e=(t,e,r,n)=>{if(!X_e(t,e,r,n))throw t},X_e=(t,e,r,n=!0)=>r.propagating?UG(t)||g_(t):(r.propagating=!0,eT(r,e)===n?UG(t):g_(t)),eT=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",g_=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",UG=t=>t?.code==="EPIPE"});var qG,tT,rT=y(()=>{QO();y_();qG=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>tT({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),tT=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=Zd(t,e,l);if(eT(l,e)){await u;return}let[d]=await Promise.all([FG({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var BG,ZG,Q_e,eve,nT=y(()=>{c_();rT();BG=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Js([t,e].filter(Boolean)):void 0,ZG=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>tT({...Q_e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:eve(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Q_e=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},eve=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var HG,GG,VG=y(()=>{gc();Ro();HG=t=>hc(t,"ipc"),GG=(t,e)=>{let r=iy(t);ai({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var WG,KG,JG=y(()=>{Vs();VG();Vi();NO();WG=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=HG(o),a=Gi(e,"ipc"),c=Gi(r,"ipc");for await(let l of DO({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(vZ(t,i,c),i.push(l)),s&&GG(l,o);return i},KG=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as tve}from"node:events";var YG,rve,nve,ive,XG=y(()=>{Gs();JA();UA();KA();Hi();ur();QO();JG();XA();nT();rT();RO();y_();YG=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=UH(t,f),x={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},$=qG({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:x}),w=ZG({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:x}),R=[],T=WG({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),A=rve(h,t,x),N=nve(m,x);try{return await Promise.race([Promise.all([{},BH(_),Promise.all($),w,T,ZB(t,d),...A,...N]),g,ive(t,b),...FB(t,o,f,b),...oB({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...MB({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all($.map(Z=>XO(Z))),XO(w),KG(T,R),Promise.allSettled(A),Promise.allSettled(N)])}},rve=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Zd(n,i,r)),nve=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>jn(o,{checkOpen:!1})&&!Cn(o)).map(({type:i,value:o,stream:s=o})=>Zd(s,n,e,{isSameDirection:dn.has(i),stopOnExit:i==="native"}))),ive=async(t,{signal:e})=>{let[r]=await tve(t,"error",{signal:e});throw r}});var QG,Hd,Pc,__=y(()=>{wc();QG=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Hd=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=ci();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Pc=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as e9}from"node:stream/promises";var iT,t9,oT,sT,v_,b_,aT=y(()=>{y_();iT=async t=>{if(t!==void 0)try{await oT(t)}catch{}},t9=async t=>{if(t!==void 0)try{await sT(t)}catch{}},oT=async t=>{await e9(t,{cleanup:!0,readable:!1,writable:!0})},sT=async t=>{await e9(t,{cleanup:!0,readable:!0,writable:!1})},v_=async(t,e)=>{if(await t,e)throw e},b_=(t,e,r)=>{r&&!g_(r)?t.destroy(r):e&&t.destroy()}});import{Readable as ove}from"node:stream";import{callbackify as sve}from"node:util";var r9,cT,lT,uT,ave,dT,fT,n9,pT=y(()=>{Zs();Do();h_();wc();__();aT();r9=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||qr.has(r),{subprocessStdout:a,waitReadableDestroy:c}=cT(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=lT(a,s),{read:f,onStdoutDataDone:p}=uT({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new ove({read:f,destroy:sve(fT.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return dT({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},cT=(t,e,r)=>{let n=xc(t,e),i=Hd(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},lT=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:YO},uT=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=ci(),s=m_({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){ave(this,s,o)},onStdoutDataDone:o}},ave=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},dT=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await sT(t),await n,await iT(i),await e,r.readable&&r.push(null)}catch(o){await iT(i),n9(r,o)}},fT=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Pc(r,e)&&(n9(t,n),await v_(e,n))},n9=(t,e)=>{b_(t,t.readable,e)}});import{Writable as cve}from"node:stream";import{callbackify as i9}from"node:util";var o9,mT,hT,lve,uve,gT,yT,s9,_T=y(()=>{Do();__();aT();o9=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=mT(t,r,e),s=new cve({...hT(n,t,i),destroy:i9(yT.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return gT(n,s),s},mT=(t,e,r)=>{let n=_y(t,e),i=Hd(r,n,"writableFinal"),o=Hd(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},hT=(t,e,r)=>({write:lve.bind(void 0,t),final:i9(uve.bind(void 0,t,e,r))}),lve=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},uve=async(t,e,r)=>{await Pc(r,e)&&(t.writable&&t.end(),await e)},gT=async(t,e,r)=>{try{await oT(t),e.writable&&e.end()}catch(n){await t9(r),s9(e,n)}},yT=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Pc(r,e),await Pc(n,e)&&(s9(t,i),await v_(e,i))},s9=(t,e)=>{b_(t,t.writable,e)}});import{Duplex as dve}from"node:stream";import{callbackify as fve}from"node:util";var a9,pve,c9=y(()=>{Zs();pT();_T();a9=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||qr.has(r),{subprocessStdout:c,waitReadableDestroy:l}=cT(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=mT(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=lT(c,a),{read:g,onStdoutDataDone:b}=uT({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new dve({read:g,...hT(u,t,d),destroy:fve(pve.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return dT({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),gT(u,_,c),_},pve=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([fT({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),yT({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var vT,mve,l9=y(()=>{Zs();Do();h_();vT=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||qr.has(e),s=xc(t,r),a=m_({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return mve(a,s,t)},mve=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var u9,d9=y(()=>{__();pT();_T();c9();l9();u9=(t,{encoding:e})=>{let r=QG();t.readable=r9.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=o9.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=a9.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=vT.bind(void 0,t,e),t[Symbol.asyncIterator]=vT.bind(void 0,t,e,{})}});var f9,hve,gve,p9=y(()=>{f9=(t,e)=>{for(let[r,n]of gve){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},hve=(async()=>{})().constructor.prototype,gve=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(hve,t)])});import{setMaxListeners as yve}from"node:events";import{spawn as _ve}from"node:child_process";var m9,vve,bve,Sve,wve,xve,h9=y(()=>{Zy();AA();tO();Do();rO();jO();zd();Vy();iG();lG();Fd();vG();my();$G();jG();nT();XG();d9();wc();p9();m9=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=vve(t,e,r),{subprocess:f,promise:p}=Sve({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=p_.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),f9(f,p),li.set(f,{options:u,fileDescriptors:d}),f},vve=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ay(t,e,r),{file:a,commandArguments:c,options:l}=Dy(t,e,r),u=bve(l),d=cG(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},bve=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Sve=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=_ve(...Ny(t,e,r))}catch(m){return nG({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;yve(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_G(c,a,l),xG(c,r,l);let d={},f=ci();c.kill=nB.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=BG(c,r),u9(c,r),eG(c,r);let p=wve({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},wve=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await YG({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map(($,w)=>Ki($,e,w)),_=Ki(h,e,"all"),x=xve({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ac(x,n,e)},xve=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Md({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ui,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Gy({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var S_,$ve,kve,g9=y(()=>{Bi();Vi();S_=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,$ve(n,t[n],i)]));return{...t,...r}},$ve=(t,e,r)=>kve.has(t)&&wt(e)&&wt(r)?{...e,...r}:r,kve=new Set(["env",...wA])});var Mo,Eve,Ave,y9=y(()=>{Bi();yA();_4();VH();h9();g9();Mo=(t,e,r,n)=>{let i=(s,a,c)=>Mo(s,a,r,c),o=(...s)=>Eve({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Eve=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(wt(o))return i(t,S_(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Ave({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?GH(a,c,l):m9(a,c,l,i)},Ave=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=g4(e)?y4(e,r):[e,...r],[s,a,c]=Wg(...o),l=S_(S_(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var _9,v9,b9,Ove,Tve,S9=y(()=>{_9=({file:t,commandArguments:e})=>b9(t,e),v9=({file:t,commandArguments:e})=>({...b9(t,e),isSync:!0}),b9=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=Ove(t);return{file:r,commandArguments:n}},Ove=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(Tve)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},Tve=/ +/g});var w9,x9,Pve,$9,Ive,k9,E9=y(()=>{w9=(t,e,r)=>{t.sync=e(Pve,r),t.s=t.sync},x9=({options:t})=>$9(t),Pve=({options:t})=>({...$9(t),isSync:!0}),$9=t=>({options:{...Ive(t),...t}}),Ive=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},k9={preferLocal:!0}});var LXe,Xe,UXe,qXe,BXe,ZXe,HXe,GXe,VXe,WXe,kr=y(()=>{y9();S9();YA();E9();jO();LXe=Mo(()=>({})),Xe=Mo(()=>({isSync:!0})),UXe=Mo(_9),qXe=Mo(v9),BXe=Mo(UB),ZXe=Mo(x9,{},k9,w9),{sendMessage:HXe,getOneMessage:GXe,getEachMessage:VXe,getCancelSignal:WXe}=tG()});import{existsSync as w_,statSync as Rve}from"node:fs";import{dirname as bT,extname as Cve,isAbsolute as A9,join as ST,relative as wT,resolve as x_,sep as Dve}from"node:path";function $_(t){return t==="./gradlew"||t==="gradle"}function Nve(t){return(w_(ST(t,"build.gradle.kts"))||w_(ST(t,"build.gradle")))&&w_(ST(t,"gradle.properties"))}function jve(t,e){let n=wT(t,e).split(Dve).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function zo(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Mve(t,e){let r=x_(t,e),n=r;w_(r)?Rve(r).isFile()&&(n=bT(r)):Cve(r)!==""&&(n=bT(r));let i=wT(t,n);if(i.startsWith("..")||A9(i))return null;let o=n;for(;;){if(Nve(o))return o;if(x_(o)===x_(t))return null;let s=bT(o);if(s===o)return null;let a=wT(t,s);if(a.startsWith("..")||A9(a))return null;o=s}}function k_(t,e){let r=x_(t),n=new Map,i=[];for(let o of e){let s=Mve(r,o);if(!s){i.push(o);continue}let a=jve(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var E_=y(()=>{"use strict"});import{existsSync as zve,readFileSync as Fve}from"node:fs";import{join as Lve}from"node:path";function A_(t="."){let e=Lve(t,".cladding","config.yaml");if(!zve(e))return xT;try{let n=(0,O9.parse)(Fve(e,"utf8"))?.gate;if(!n)return xT;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s={};if(n.commands&&typeof n.commands=="object")for(let c of Uve){let l=n.commands[c];Array.isArray(l)&&l.every(u=>typeof u=="string")&&(s[c]=l)}let a={scope:i};return Object.keys(s).length>0&&(a.commands=s),o&&(a.coverage=o),a}catch{return xT}}function T9(t,e){let r=[],n=!1;for(let i of t){let o=qve.exec(i);if(o){n=!0;for(let s of e)r.push(zo(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var O9,Uve,xT,qve,$T=y(()=>{"use strict";O9=St(tr(),1);E_();Uve=["type","lint","test","coverage"],xT={scope:"feature"};qve=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as ET,readFileSync as P9,readdirSync as Bve,statSync as Zve}from"node:fs";import{join as O_}from"node:path";function TT(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=O_(t,e);if(ET(r))try{if(I9.test(P9(r,"utf8")))return!0}catch{}}return!1}function R9(t){try{return ET(t)&&I9.test(P9(t,"utf8"))}catch{return!1}}function C9(t,e=0){if(e>4||!ET(t))return!1;let r;try{r=Bve(t)}catch{return!1}for(let n of r){let i=O_(t,n),o=!1;try{o=Zve(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(C9(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&R9(i))return!0}return!1}function Vve(t){if(TT(t))return!0;for(let e of Hve)if(R9(O_(t,e)))return!0;for(let e of Gve)if(C9(O_(t,e)))return!0;return!1}function D9(t="."){let e=A_(t).coverage;return e||(Vve(t)?"kover":"jacoco")}function N9(t="."){return AT[D9(t)]}function j9(t="."){return kT[D9(t)]}var AT,kT,OT,I9,Hve,Gve,T_=y(()=>{"use strict";$T();AT={kover:"koverXmlReport",jacoco:"jacocoTestReport"},kT={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},OT=[kT.kover,kT.jacoco],I9=/kover/i;Hve=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Gve=["buildSrc","build-logic"]});import{existsSync as PT,readdirSync as M9}from"node:fs";import{join as P_}from"node:path";function IT(t){return PT(P_(t,"gradlew"))?"./gradlew":"gradle"}function Wve(t){let e=IT(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[N9(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Jve(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function Qve(t,e){for(let r of e)if(PT(P_(t,r)))return r}function ebe(t,e){try{return M9(t).find(n=>n.endsWith(e))}catch{return}}function rbe(t,e){for(let r of tbe)if(r.configs.some(n=>PT(P_(t,n))))return r.gate;return e}function dt(t="."){for(let e of Yve){let r;for(let o of e.manifests)if(o.startsWith(".")?r=ebe(t,o):r=Qve(t,[o]),r)break;if(!r||e.requiresSource&&!Jve(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"&&n.lint?{...n,lint:rbe(t,n.lint)}:n;return{language:e.language,manifest:r,gates:i}}return Xve}var Kve,Yve,Xve,tbe,fn=y(()=>{"use strict";T_();Kve=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);Yve=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","madge","--circular","--extensions","ts","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:Wve},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}],Xve={language:"unknown",manifest:"",gates:{}};tbe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}]});import{existsSync as nbe,readFileSync as ibe}from"node:fs";import{join as obe}from"node:path";function Gd(t){return t.code==="ENOENT"}function I_(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return z9.test(o)||z9.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function jt(t,e,r){return Gd(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function rr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Ic(t,e){let r=obe(t,"package.json");if(!nbe(r))return!1;try{return!!JSON.parse(ibe(r,"utf8")).scripts?.[e]}catch{return!1}}var z9,pn=y(()=>{"use strict";z9=/config (is |file )?not found|no such file|ENOENT|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function sbe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:R_,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Xe(n.cmd,[...n.args],{cwd:e,reject:!1});return Gd(i)?[{detector:R_,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:I_(i,R_,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var R_,C_,RT=y(()=>{"use strict";kr();fn();pn();R_="ARCHITECTURE_VIOLATION";C_={name:R_,run:sbe}});import F9 from"node:process";function Xs(t={}){let r=C_.run(t).filter(o=>o.severity==="error"),n=r.length===0,i={stage:abe,pass:n,exitCode:n?0:1};return n?i:{...i,stderr:r.map(o=>o.message).join(` -`)}}var abe,cbe,D_=y(()=>{"use strict";RT();abe="stage_1.5";cbe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${F9.argv[1]}`;if(cbe){let t=Xs();console.log(JSON.stringify(t)),F9.exit(t.exitCode)}});import{existsSync as CT,readdirSync as L9}from"node:fs";import{join as N_}from"node:path";function ube(t,e){let r=N_(t,e.path);if(!CT(r))return!0;if(e.isDirectory)try{return L9(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function dbe(t){let{cwd:e="."}=t,r=[];for(let i of lbe)ube(e,i)&&r.push({detector:Vd,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=N_(e,"spec.yaml");if(CT(n)){let i=mbe(n),o=i?null:fbe(e);if(i)r.push({detector:Vd,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:Vd,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=pbe(e);s&&r.push({detector:Vd,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function fbe(t){for(let e of["spec/features","spec/scenarios"]){let r=N_(t,e);if(!CT(r))continue;let n;try{n=L9(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ii(N_(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function pbe(t){try{return se(t),null}catch(e){return e.message}}function mbe(t){let e;try{e=ii(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Vd,lbe,U9,q9=y(()=>{"use strict";At();qg();Vd="ABSENCE_OF_GOVERNANCE",lbe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];U9={name:Vd,run:dbe}});function B9(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function DT(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;let n=hbe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:B9(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${B9(r)}'`:null}function gbe(t,e){let r=DT(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function Z9(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...gbe(r,n));return e}var hbe,NT=y(()=>{"use strict";hbe={event:"when",state:"while",optional:"where",unwanted:"if"}});function xe(t,e,r){let n;try{n=se(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var Ot=y(()=>{"use strict";At()});function ybe(t){let{cwd:e="."}=t;return xe(e,j_,_be)}function _be(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:j_,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of Z9(t.features))e.push({detector:j_,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var j_,H9,G9=y(()=>{"use strict";NT();Ot();j_="AC_DRIFT";H9={name:j_,run:ybe}});function fi(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return wbe[n]??V9}var vbe,bbe,V9,Sbe,wbe,Rc=y(()=>{"use strict";fn();vbe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,bbe=/^[ \t]*import\s+([\w.]+)/gm,V9={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:vbe,importStyle:"relative"},Sbe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:bbe,importStyle:"dotted"},wbe={typescript:V9,kotlin:Sbe}});import{existsSync as xbe,readFileSync as $be,readdirSync as kbe,statSync as Ebe}from"node:fs";import{join as K9,relative as W9}from"node:path";function Abe(t,e){if(!xbe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=kbe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=K9(i,s),c;try{c=Ebe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function Obe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function Pbe(t){return Tbe.test(t)}function Ibe(t){let{cwd:e="."}=t,r;try{r=se(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=fi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Abe(K9(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=$be(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";At();Rc();J9="AI_HINTS_FORBIDDEN_PATTERN";Tbe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;Y9={name:J9,run:Ibe}});function Rbe(t){let{cwd:e="."}=t,r;try{r=se(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:Q9,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var Q9,eV,tV=y(()=>{"use strict";At();Q9="AC_DUPLICATE_WITHIN_FEATURE";eV={name:Q9,run:Rbe}});import{createRequire as Cbe}from"module";import{basename as Dbe,dirname as MT,normalize as Nbe,relative as jbe,resolve as Mbe,sep as iV}from"path";import*as zbe from"fs";function Fbe(t){let e=Nbe(t);return e.length>1&&e[e.length-1]===iV&&(e=e.substring(0,e.length-1)),e}function oV(t,e){return t.replace(Lbe,e)}function qbe(t){return t==="/"||Ube.test(t)}function jT(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=Mbe(t)),(n||o)&&(t=Fbe(t)),t===".")return"";let s=t[t.length-1]!==i;return oV(s?t+i:t,i)}function sV(t,e){return e+t}function Bbe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:oV(jbe(t,n),e.pathSeparator)+e.pathSeparator+r}}function Zbe(t){return t}function Hbe(t,e,r){return e+t+r}function Gbe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?Bbe(t,e):n?sV:Zbe}function Vbe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function Wbe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function Xbe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?Wbe(t):Vbe(t):n&&n.length?Jbe:Kbe:Ybe}function iSe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?nSe:r&&r.length?n?Qbe:eSe:n?tSe:rSe}function aSe(t){return t.group?sSe:oSe}function uSe(t){return t.group?cSe:lSe}function pSe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?fSe:dSe}function aV(t,e,r){if(r.options.useRealPaths)return mSe(e,r);let n=MT(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=MT(n)}return r.symlinks.set(t,e),i>1}function mSe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function M_(t,e,r,n){e(t&&!n?t:null,r)}function xSe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?hSe:vSe:n?e?gSe:wSe:i?e?_Se:SSe:e?ySe:bSe}function ESe(t){return t?kSe:$Se}function PSe(t,e){return new Promise((r,n)=>{uV(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function uV(t,e,r){new lV(t,e,r).start()}function ISe(t,e){return new lV(t,e).start()}var rV,Lbe,Ube,Kbe,Jbe,Ybe,Qbe,eSe,tSe,rSe,nSe,oSe,sSe,cSe,lSe,dSe,fSe,hSe,gSe,ySe,_Se,vSe,bSe,SSe,wSe,cV,$Se,kSe,ASe,OSe,TSe,lV,nV,dV,fV,pV=y(()=>{rV=Cbe(import.meta.url);Lbe=/[\\/]/g;Ube=/^[a-z]:[\\/]$/i;Kbe=(t,e)=>{e.push(t||".")},Jbe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},Ybe=()=>{};Qbe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},eSe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},tSe=(t,e,r,n)=>{r.files++},rSe=(t,e)=>{e.push(t)},nSe=()=>{};oSe=t=>t,sSe=()=>[""].slice(0,0);cSe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},lSe=()=>{};dSe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&aV(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},fSe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&aV(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};hSe=t=>t.counts,gSe=t=>t.groups,ySe=t=>t.paths,_Se=t=>t.paths.slice(0,t.options.maxFiles),vSe=(t,e,r)=>(M_(e,r,t.counts,t.options.suppressErrors),null),bSe=(t,e,r)=>(M_(e,r,t.paths,t.options.suppressErrors),null),SSe=(t,e,r)=>(M_(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),wSe=(t,e,r)=>(M_(e,r,t.groups,t.options.suppressErrors),null);cV={withFileTypes:!0},$Se=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",cV,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},kSe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",cV)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};ASe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},OSe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},TSe=class{aborted=!1;abort(){this.aborted=!0}},lV=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=xSe(e,this.isSynchronous),this.root=jT(t,e),this.state={root:qbe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new OSe,options:e,queue:new ASe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new TSe,fs:e.fs||zbe},this.joinPath=Gbe(this.root,e),this.pushDirectory=Xbe(this.root,e),this.pushFile=iSe(e),this.getArray=aSe(e),this.groupFiles=uSe(e),this.resolveSymlink=pSe(e,this.isSynchronous),this.walkDirectory=ESe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=jT(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let x=Dbe(_),$=jT(MT(_),this.state.options);_=this.joinPath(x,$),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};nV=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return PSe(this.root,this.options)}withCallback(t){uV(this.root,this.options,t)}sync(){return ISe(this.root,this.options)}},dV=null;try{rV.resolve("picomatch"),dV=rV("picomatch")}catch{}fV=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:iV,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new nV(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new nV(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||dV;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var Wd=v((J7e,_V)=>{"use strict";var mV="[^\\\\/]",RSe="(?=.)",hV="[^/]",zT="(?:\\/|$)",gV="(?:^|\\/)",FT=`\\.{1,2}${zT}`,CSe="(?!\\.)",DSe=`(?!${gV}${FT})`,NSe=`(?!\\.{0,1}${zT})`,jSe=`(?!${FT})`,MSe="[^.\\/]",zSe=`${hV}*?`,FSe="/",yV={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:RSe,QMARK:hV,END_ANCHOR:zT,DOTS_SLASH:FT,NO_DOT:CSe,NO_DOTS:DSe,NO_DOT_SLASH:NSe,NO_DOTS_SLASH:jSe,QMARK_NO_DOT:MSe,STAR:zSe,START_ANCHOR:gV,SEP:FSe},LSe={...yV,SLASH_LITERAL:"[\\\\/]",QMARK:mV,STAR:`${mV}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},USe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};_V.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:USe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?LSe:yV}}});var Kd=v(Er=>{"use strict";var{REGEX_BACKSLASH:qSe,REGEX_REMOVE_BACKSLASH:BSe,REGEX_SPECIAL_CHARS:ZSe,REGEX_SPECIAL_CHARS_GLOBAL:HSe}=Wd();Er.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Er.hasRegexChars=t=>ZSe.test(t);Er.isRegexChar=t=>t.length===1&&Er.hasRegexChars(t);Er.escapeRegex=t=>t.replace(HSe,"\\$1");Er.toPosixSlashes=t=>t.replace(qSe,"/");Er.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Er.removeBackslashes=t=>t.replace(BSe,e=>e==="\\"?"":e);Er.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Er.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Er.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Er.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Er.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var EV=v((X7e,kV)=>{"use strict";var vV=Kd(),{CHAR_ASTERISK:LT,CHAR_AT:GSe,CHAR_BACKWARD_SLASH:Jd,CHAR_COMMA:VSe,CHAR_DOT:UT,CHAR_EXCLAMATION_MARK:qT,CHAR_FORWARD_SLASH:$V,CHAR_LEFT_CURLY_BRACE:BT,CHAR_LEFT_PARENTHESES:ZT,CHAR_LEFT_SQUARE_BRACKET:WSe,CHAR_PLUS:KSe,CHAR_QUESTION_MARK:bV,CHAR_RIGHT_CURLY_BRACE:JSe,CHAR_RIGHT_PARENTHESES:SV,CHAR_RIGHT_SQUARE_BRACKET:YSe}=Wd(),wV=t=>t===$V||t===Jd,xV=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},XSe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,x=!1,$=!1,w=!1,R=0,T,A,N={value:"",depth:0,isGlob:!1},k=()=>l>=n,Z=()=>c.charCodeAt(l+1),ne=()=>(T=A,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),we&&m===!0&&d>0?(we=c.slice(0,d),I=c.slice(d)):m===!0?(we="",I=c):we=c,we&&we!==""&&we!=="/"&&we!==c&&wV(we.charCodeAt(we.length-1))&&(we=we.slice(0,-1)),r.unescape===!0&&(I&&(I=vV.removeBackslashes(I)),we&&_===!0&&(we=vV.removeBackslashes(we)));let sn={prefix:P,input:t,start:u,base:we,glob:I,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:x,negatedExtglob:$};if(r.tokens===!0&&(sn.maxDepth=0,wV(A)||s.push(N),sn.tokens=s),r.parts===!0||r.tokens===!0){let He;for(let ut=0;ut{"use strict";var Yd=Wd(),Br=Kd(),{MAX_LENGTH:z_,POSIX_REGEX_SOURCE:QSe,REGEX_NON_SPECIAL_CHARS:ewe,REGEX_SPECIAL_CHARS_BACKREF:twe,REPLACEMENTS:AV}=Yd,rwe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Br.escapeRegex(i)).join("..")}return r},Cc=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,OV=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},nwe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},TV=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(nwe(e))return e.replace(/\\(.)/g,"$1")},iwe=t=>{let e=t.map(TV).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},owe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=TV(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Br.escapeRegex(r[0]):`[${r.map(i=>Br.escapeRegex(i)).join("")}]`}*`},swe=t=>{let e=0,r=t.trim(),n=HT(r);for(;n;)e++,r=n.body.trim(),n=HT(r);return e},awe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Yd.DEFAULT_MAX_EXTGLOB_RECURSION,n=OV(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||iwe(n)))return{risky:!0};for(let i of n){let o=owe(i);if(o)return{risky:!0,safeOutput:o};if(swe(i)>r)return{risky:!0}}return{risky:!1}},GT=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=AV[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(z_,r.maxLength):z_,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=Yd.globChars(r.windows),l=Yd.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:x,STAR:$,START_ANCHOR:w}=c,R=U=>`(${a}(?:(?!${w}${U.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:x,N=r.bash===!0?R(r):$;r.capture&&(N=`(${N})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=Br.removePrefix(t,k),i=t.length;let Z=[],ne=[],we=[],P=o,I,sn=()=>k.index===i-1,He=k.peek=(U=1)=>t[k.index+U],ut=k.advance=()=>t[++k.index]||"",ji=()=>t.slice(k.index+1),an=(U="",at=0)=>{k.consumed+=U,k.index+=at},yo=U=>{k.output+=U.output!=null?U.output:U.value,an(U.value)},Yoe=()=>{let U=1;for(;He()==="!"&&(He(2)!=="("||He(3)==="?");)ut(),k.start++,U++;return U%2===0?!1:(k.negated=!0,k.start++,!0)},Ph=U=>{k[U]++,we.push(U)},_o=U=>{k[U]--,we.pop()},Ee=U=>{if(P.type==="globstar"){let at=k.braces>0&&(U.type==="comma"||U.type==="brace"),L=U.extglob===!0||Z.length&&(U.type==="pipe"||U.type==="paren");U.type!=="slash"&&U.type!=="paren"&&!at&&!L&&(k.output=k.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=N,k.output+=P.output)}if(Z.length&&U.type!=="paren"&&(Z[Z.length-1].inner+=U.value),(U.value||U.output)&&yo(U),P&&P.type==="text"&&U.type==="text"){P.output=(P.output||P.value)+U.value,P.value+=U.value;return}U.prev=P,s.push(U),P=U},Ih=(U,at)=>{let L={...l[at],conditions:1,inner:""};L.prev=P,L.parens=k.parens,L.output=k.output,L.startIndex=k.index,L.tokensIndex=s.length;let Ae=(r.capture?"(":"")+L.open;Ph("parens"),Ee({type:U,value:at,output:k.output?"":p}),Ee({type:"paren",extglob:!0,value:ut(),output:Ae}),Z.push(L)},Xoe=U=>{let at=t.slice(U.startIndex,k.index+1),L=t.slice(U.startIndex+2,k.index),Ae=awe(L,r);if((U.type==="plus"||U.type==="star")&&Ae.risky){let nt=Ae.safeOutput?(U.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,ei=s[U.tokensIndex];ei.type="text",ei.value=at,ei.output=nt||Br.escapeRegex(at);for(let ti=U.tokensIndex+1;ti1&&U.inner.includes("/")&&(nt=R(r)),(nt!==N||sn()||/^\)+$/.test(ji()))&&(it=U.close=`)$))${nt}`),U.inner.includes("*")&&(Ct=ji())&&/^\.[^\\/.]+$/.test(Ct)){let ei=GT(Ct,{...e,fastpaths:!1}).output;it=U.close=`)${ei})${nt})`}U.prev.type==="bos"&&(k.negatedExtglob=!0)}Ee({type:"paren",extglob:!0,value:I,output:it}),_o("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let U=!1,at=t.replace(twe,(L,Ae,it,Ct,nt,ei)=>Ct==="\\"?(U=!0,L):Ct==="?"?Ae?Ae+Ct+(nt?_.repeat(nt.length):""):ei===0?A+(nt?_.repeat(nt.length):""):_.repeat(it.length):Ct==="."?u.repeat(it.length):Ct==="*"?Ae?Ae+Ct+(nt?N:""):N:Ae?L:`\\${L}`);return U===!0&&(r.unescape===!0?at=at.replace(/\\/g,""):at=at.replace(/\\+/g,L=>L.length%2===0?"\\\\":L?"\\":"")),at===t&&r.contains===!0?(k.output=t,k):(k.output=Br.wrapOutput(at,k,e),k)}for(;!sn();){if(I=ut(),I==="\0")continue;if(I==="\\"){let L=He();if(L==="/"&&r.bash!==!0||L==="."||L===";")continue;if(!L){I+="\\",Ee({type:"text",value:I});continue}let Ae=/^\\+/.exec(ji()),it=0;if(Ae&&Ae[0].length>2&&(it=Ae[0].length,k.index+=it,it%2!==0&&(I+="\\")),r.unescape===!0?I=ut():I+=ut(),k.brackets===0){Ee({type:"text",value:I});continue}}if(k.brackets>0&&(I!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&I===":"){let L=P.value.slice(1);if(L.includes("[")&&(P.posix=!0,L.includes(":"))){let Ae=P.value.lastIndexOf("["),it=P.value.slice(0,Ae),Ct=P.value.slice(Ae+2),nt=QSe[Ct];if(nt){P.value=it+nt,k.backtrack=!0,ut(),!o.output&&s.indexOf(P)===1&&(o.output=p);continue}}}(I==="["&&He()!==":"||I==="-"&&He()==="]")&&(I=`\\${I}`),I==="]"&&(P.value==="["||P.value==="[^")&&(I=`\\${I}`),r.posix===!0&&I==="!"&&P.value==="["&&(I="^"),P.value+=I,yo({value:I});continue}if(k.quotes===1&&I!=='"'){I=Br.escapeRegex(I),P.value+=I,yo({value:I});continue}if(I==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&Ee({type:"text",value:I});continue}if(I==="("){Ph("parens"),Ee({type:"paren",value:I});continue}if(I===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Cc("opening","("));let L=Z[Z.length-1];if(L&&k.parens===L.parens+1){Xoe(Z.pop());continue}Ee({type:"paren",value:I,output:k.parens?")":"\\)"}),_o("parens");continue}if(I==="["){if(r.nobracket===!0||!ji().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Cc("closing","]"));I=`\\${I}`}else Ph("brackets");Ee({type:"bracket",value:I});continue}if(I==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){Ee({type:"text",value:I,output:`\\${I}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Cc("opening","["));Ee({type:"text",value:I,output:`\\${I}`});continue}_o("brackets");let L=P.value.slice(1);if(P.posix!==!0&&L[0]==="^"&&!L.includes("/")&&(I=`/${I}`),P.value+=I,yo({value:I}),r.literalBrackets===!1||Br.hasRegexChars(L))continue;let Ae=Br.escapeRegex(P.value);if(k.output=k.output.slice(0,-P.value.length),r.literalBrackets===!0){k.output+=Ae,P.value=Ae;continue}P.value=`(${a}${Ae}|${P.value})`,k.output+=P.value;continue}if(I==="{"&&r.nobrace!==!0){Ph("braces");let L={type:"brace",value:I,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};ne.push(L),Ee(L);continue}if(I==="}"){let L=ne[ne.length-1];if(r.nobrace===!0||!L){Ee({type:"text",value:I,output:I});continue}let Ae=")";if(L.dots===!0){let it=s.slice(),Ct=[];for(let nt=it.length-1;nt>=0&&(s.pop(),it[nt].type!=="brace");nt--)it[nt].type!=="dots"&&Ct.unshift(it[nt].value);Ae=rwe(Ct,r),k.backtrack=!0}if(L.comma!==!0&&L.dots!==!0){let it=k.output.slice(0,L.outputIndex),Ct=k.tokens.slice(L.tokensIndex);L.value=L.output="\\{",I=Ae="\\}",k.output=it;for(let nt of Ct)k.output+=nt.output||nt.value}Ee({type:"brace",value:I,output:Ae}),_o("braces"),ne.pop();continue}if(I==="|"){Z.length>0&&Z[Z.length-1].conditions++,Ee({type:"text",value:I});continue}if(I===","){let L=I,Ae=ne[ne.length-1];Ae&&we[we.length-1]==="braces"&&(Ae.comma=!0,L="|"),Ee({type:"comma",value:I,output:L});continue}if(I==="/"){if(P.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),P=o;continue}Ee({type:"slash",value:I,output:f});continue}if(I==="."){if(k.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let L=ne[ne.length-1];P.type="dots",P.output+=I,P.value+=I,L.dots=!0;continue}if(k.braces+k.parens===0&&P.type!=="bos"&&P.type!=="slash"){Ee({type:"text",value:I,output:u});continue}Ee({type:"dot",value:I,output:u});continue}if(I==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&He()==="("&&He(2)!=="?"){Ih("qmark",I);continue}if(P&&P.type==="paren"){let Ae=He(),it=I;(P.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(ji()))&&(it=`\\${I}`),Ee({type:"text",value:I,output:it});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){Ee({type:"qmark",value:I,output:x});continue}Ee({type:"qmark",value:I,output:_});continue}if(I==="!"){if(r.noextglob!==!0&&He()==="("&&(He(2)!=="?"||!/[!=<:]/.test(He(3)))){Ih("negate",I);continue}if(r.nonegate!==!0&&k.index===0){Yoe();continue}}if(I==="+"){if(r.noextglob!==!0&&He()==="("&&He(2)!=="?"){Ih("plus",I);continue}if(P&&P.value==="("||r.regex===!1){Ee({type:"plus",value:I,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||k.parens>0){Ee({type:"plus",value:I});continue}Ee({type:"plus",value:d});continue}if(I==="@"){if(r.noextglob!==!0&&He()==="("&&He(2)!=="?"){Ee({type:"at",extglob:!0,value:I,output:""});continue}Ee({type:"text",value:I});continue}if(I!=="*"){(I==="$"||I==="^")&&(I=`\\${I}`);let L=ewe.exec(ji());L&&(I+=L[0],k.index+=L[0].length),Ee({type:"text",value:I});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=I,P.output=N,k.backtrack=!0,k.globstar=!0,an(I);continue}let U=ji();if(r.noextglob!==!0&&/^\([^?]/.test(U)){Ih("star",I);continue}if(P.type==="star"){if(r.noglobstar===!0){an(I);continue}let L=P.prev,Ae=L.prev,it=L.type==="slash"||L.type==="bos",Ct=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!it||U[0]&&U[0]!=="/")){Ee({type:"star",value:I,output:""});continue}let nt=k.braces>0&&(L.type==="comma"||L.type==="brace"),ei=Z.length&&(L.type==="pipe"||L.type==="paren");if(!it&&L.type!=="paren"&&!nt&&!ei){Ee({type:"star",value:I,output:""});continue}for(;U.slice(0,3)==="/**";){let ti=t[k.index+4];if(ti&&ti!=="/")break;U=U.slice(3),an("/**",3)}if(L.type==="bos"&&sn()){P.type="globstar",P.value+=I,P.output=R(r),k.output=P.output,k.globstar=!0,an(I);continue}if(L.type==="slash"&&L.prev.type!=="bos"&&!Ct&&sn()){k.output=k.output.slice(0,-(L.output+P.output).length),L.output=`(?:${L.output}`,P.type="globstar",P.output=R(r)+(r.strictSlashes?")":"|$)"),P.value+=I,k.globstar=!0,k.output+=L.output+P.output,an(I);continue}if(L.type==="slash"&&L.prev.type!=="bos"&&U[0]==="/"){let ti=U[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(L.output+P.output).length),L.output=`(?:${L.output}`,P.type="globstar",P.output=`${R(r)}${f}|${f}${ti})`,P.value+=I,k.output+=L.output+P.output,k.globstar=!0,an(I+ut()),Ee({type:"slash",value:"/",output:""});continue}if(L.type==="bos"&&U[0]==="/"){P.type="globstar",P.value+=I,P.output=`(?:^|${f}|${R(r)}${f})`,k.output=P.output,k.globstar=!0,an(I+ut()),Ee({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-P.output.length),P.type="globstar",P.output=R(r),P.value+=I,k.output+=P.output,k.globstar=!0,an(I);continue}let at={type:"star",value:I,output:N};if(r.bash===!0){at.output=".*?",(P.type==="bos"||P.type==="slash")&&(at.output=T+at.output),Ee(at);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){at.output=I,Ee(at);continue}(k.index===k.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(k.output+=g,P.output+=g):r.dot===!0?(k.output+=b,P.output+=b):(k.output+=T,P.output+=T),He()!=="*"&&(k.output+=p,P.output+=p)),Ee(at)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cc("closing","]"));k.output=Br.escapeLast(k.output,"["),_o("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cc("closing",")"));k.output=Br.escapeLast(k.output,"("),_o("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cc("closing","}"));k.output=Br.escapeLast(k.output,"{"),_o("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&Ee({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let U of k.tokens)k.output+=U.output!=null?U.output:U.value,U.suffix&&(k.output+=U.suffix)}return k};GT.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(z_,r.maxLength):z_,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=AV[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=Yd.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let x=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,$=T=>{switch(T){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+x(r);case"**/*":return`(?:${m}${x(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${x(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${x(r)}${s})?${o}${a}${_}`;default:{let A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let N=$(A[1]);return N?N+o+A[2]:void 0}}},w=Br.removePrefix(t,b),R=$(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};PV.exports=GT});var DV=v((eQe,CV)=>{"use strict";var cwe=EV(),VT=IV(),RV=Kd(),lwe=Wd(),uwe=t=>t&&typeof t=="object"&&!Array.isArray(t),xt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>xt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=uwe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?xt.compileRe(t,e):xt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=xt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=xt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};xt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?RV.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=xt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};xt.matchBase=(t,e,r)=>(e instanceof RegExp?e:xt.makeRe(e,r)).test(RV.basename(t));xt.isMatch=(t,e,r)=>xt(e,r)(t);xt.parse=(t,e)=>Array.isArray(t)?t.map(r=>xt.parse(r,e)):VT(t,{...e,fastpaths:!1});xt.scan=(t,e)=>cwe(t,e);xt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=xt.toRegex(a,e);return n===!0&&(c.state=t),c};xt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=VT.fastpaths(t,e)),i.output||(i=VT(t,e)),xt.compileRe(i,e,r,n)};xt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};xt.constants=lwe;CV.exports=xt});var zV=v((tQe,MV)=>{"use strict";var NV=DV(),dwe=Kd();function jV(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:dwe.isWindows()}),NV(t,e,r)}Object.assign(jV,NV);MV.exports=jV});import{readdir as fwe,readdirSync as pwe,realpath as mwe,realpathSync as hwe,stat as gwe,statSync as ywe}from"fs";import{isAbsolute as _we,posix as Qs,resolve as vwe}from"path";import{fileURLToPath as bwe}from"url";function xwe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&wwe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Qs.relative(t,n)||".":n=>Qs.relative(t,`${e}/${n}`)||"."}function Ewe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Qs.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function qV(t){var e;let r=Dc.default.scan(t,Awe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function Cwe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Dc.default.scan(t);return r.isGlob||r.negated}function Xd(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function BV(t){return typeof t=="string"?[t]:t??[]}function WT(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=Rwe(o);s=_we(s.replace(Nwe,""))?Qs.relative(a,s):Qs.normalize(s);let c=(i=Dwe.exec(s))===null||i===void 0?void 0:i[0],l=qV(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Qs.join(o,...d):o}return s}function jwe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(WT(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(WT(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(WT(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function Mwe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=jwe(t,e,n);t.debug&&Xd("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(LV,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Dc.default)(i.match,f),m=(0,Dc.default)(i.ignore,f),h=xwe(i.match,f),g=FV(r,d,o),b=o?g:FV(r,d,!0),_=(w,R)=>{let T=b(R,!0);return T!=="."&&!h(T)||m(T)},x;t.deep!==void 0&&(x=Math.round(t.deep-n.depthOffset));let $=new fV({filters:[a?(w,R)=>{let T=g(w,R),A=p(T)&&!m(T);return A&&Xd(`matched ${T}`),A}:(w,R)=>{let T=g(w,R);return p(T)&&!m(T)}],exclude:a?(w,R)=>{let T=_(w,R);return Xd(`${T?"skipped":"crawling"} ${R}`),T}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:x,signal:t.signal}).crawl(d);return t.debug&&Xd("internal properties:",{...n,root:d}),[$,r!==d&&!o&&Ewe(r,d)]}function zwe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function Lwe(t){let e={...Fwe,...t};return e.cwd=(e.cwd instanceof URL?bwe(e.cwd):vwe(e.cwd)).replace(LV,"/"),e.ignore=BV(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||fwe,readdirSync:e.fs.readdirSync||pwe,realpath:e.fs.realpath||mwe,realpathSync:e.fs.realpathSync||hwe,stat:e.fs.stat||gwe,statSync:e.fs.statSync||ywe}),e.debug&&Xd("globbing with options:",e),e}function Uwe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=Swe(t)||typeof t=="string",i=BV((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=Lwe(n?e:t);return i.length>0?Mwe(o,i):[]}function Fo(t,e){let[r,n]=Uwe(t,e);return r?zwe(r.sync(),n):[]}var Dc,Swe,LV,UV,wwe,$we,kwe,Awe,Owe,Twe,Pwe,Iwe,Rwe,Dwe,Nwe,Fwe,Qd=y(()=>{pV();Dc=St(zV(),1),Swe=Array.isArray,LV=/\\/g,UV=process.platform==="win32",wwe=/^(\/?\.\.)+$/;$we=/^[A-Z]:\/$/i,kwe=UV?t=>$we.test(t):t=>t==="/";Awe={parts:!0};Owe=/(?t.replace(Owe,"\\$&"),Iwe=t=>t.replace(Twe,"\\$&"),Rwe=UV?Iwe:Pwe;Dwe=/^(\/?\.\.)+/,Nwe=/\\(?=[()[\]{}!*+?@|])/g;Fwe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as F_,readFileSync as qwe,readdirSync as Bwe,statSync as ZV}from"node:fs";import{join as Nc}from"node:path";function Zwe(t){let{cwd:e="."}=t,r,n;try{let c=se(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=fi(e,n),o=[],{layers:s,forbiddenImports:a}=KT(r);return s.size>0&&(Hwe(e,i,s,o),Gwe(e,i,s,o)),a.length>0&&Vwe(e,i,a,o),o}function KT(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function Hwe(t,e,r,n){let i=e.mainRoot,o=Nc(t,i);if(F_(o))for(let s of Bwe(o)){let a=Nc(o,s);ZV(a).isDirectory()&&(r.has(s)||n.push({detector:L_,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function Gwe(t,e,r,n){let i=e.mainRoot,o=Nc(t,i);if(F_(o))for(let s of r){let a=Nc(o,s);F_(a)&&ZV(a).isDirectory()||n.push({detector:L_,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function Vwe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Nc(t,i,s.from);if(!F_(a))continue;let c=Fo([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Nc(a,l),d;try{d=qwe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];Wwe(p,s.to,e.importStyle)&&n.push({detector:L_,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function Wwe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var L_,HV,JT=y(()=>{"use strict";Qd();At();Rc();L_="ARCHITECTURE_FROM_SPEC";HV={name:L_,run:Zwe}});import{existsSync as Kwe,readFileSync as Jwe}from"node:fs";import{join as Ywe}from"node:path";function Xwe(t){let{cwd:e="."}=t,r=Ywe(e,"spec/capabilities.yaml");if(!Kwe(r))return[];let n;try{let c=Jwe(r,"utf8"),l=GV.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=se(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:U_,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:U_,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:U_,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var GV,U_,VV,WV=y(()=>{"use strict";GV=St(tr(),1);At();U_="CAPABILITIES_FEATURE_MAPPING";VV={name:U_,run:Xwe}});import{existsSync as Qwe,readFileSync as exe}from"node:fs";import{join as txe}from"node:path";function rxe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function nxe(t){let{cwd:e="."}=t;return xe(e,YT,r=>ixe(r,e))}function ixe(t,e){let r=fi(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=txe(e,o);if(!Qwe(s))continue;let a=exe(s,"utf8");rxe(a)||n.push({detector:YT,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var YT,KV,JV=y(()=>{"use strict";Rc();Ot();YT="CONVENTION_DRIFT";KV={name:YT,run:nxe}});import{existsSync as XT,readFileSync as YV}from"node:fs";import{join as q_}from"node:path";function oxe(t){return JSON.parse(t).total?.lines?.pct??0}function XV(t){let e=/XT(q_(c.dir,d)));if(!l){s.push(c.path);continue}let u=XV(YV(q_(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:Ji,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=QV(n,i);return a0?[{detector:Ji,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function cxe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let s=axe(e,t.focusModules);if(s)return s}let r=fi(e),n=dt(e).language==="kotlin"?OT.find(s=>XT(q_(e,s)))??j9(e):r.coverageSummary,i=q_(e,n);if(!XT(i))return[{detector:Ji,severity:"info",message:`${n} not present \u2014 run stage_2.2 first`}];let o;try{let s=YV(i,"utf8");o=r.coverageFormat==="jacoco-xml"?sxe(s):oxe(s)}catch(s){return[{detector:Ji,severity:"warn",message:`${n} unparseable: ${s.message}`}]}return o===null?[{detector:Ji,severity:"warn",message:`${n} contained no line-coverage counter`}]:o>=B_?[]:[{detector:Ji,severity:"warn",message:`line coverage ${o.toFixed(1)}% < floor ${B_}%`}]}var Ji,B_,eW,tW=y(()=>{"use strict";T_();Rc();E_();fn();Ji="COVERAGE_DROP",B_=70;eW={name:Ji,run:cxe}});import{existsSync as lxe}from"node:fs";import{join as uxe}from"node:path";function dxe(t){let{cwd:e="."}=t;return xe(e,Z_,r=>fxe(r,e))}function fxe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?lxe(uxe(e,r.path))?[]:[{detector:Z_,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Z_,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Z_,rW,nW=y(()=>{"use strict";Ot();Z_="DELIVERABLE_INTEGRITY";rW={name:Z_,run:dxe}});function pxe(t){let e=(t.features??[]).filter(i=>i.status==="done");return e.length===0?[]:!t.project?.deliverable?[]:(t.project?.smoke??[]).length>0?[]:[{detector:QT,severity:"warn",path:"spec.yaml",message:`${e.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function mxe(t){let{cwd:e="."}=t;return xe(e,QT,r=>pxe(r))}var QT,iW,oW=y(()=>{"use strict";Ot();QT="SMOKE_PROBE_DEMAND";iW={name:QT,run:mxe}});function hxe(t){let{cwd:e="."}=t;return xe(e,H_,r=>gxe(r,e))}function gxe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=dc(e);if(n===null)return[{detector:H_,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=n.get(o.id),a=wd(e,o.modules??[]);s!==a&&i.push({detector:H_,severity:"warn",path:"spec/attestation.yaml",message:s===void 0?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var H_,sW,aW=y(()=>{"use strict";xd();Ot();H_="STALE_ATTESTATION";sW={name:H_,run:hxe}});function yxe(t){let{cwd:e="."}=t,r;try{r=se(e)}catch{return[]}return _xe(r)}function _xe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:cW,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var cW,lW,uW=y(()=>{"use strict";At();cW="DEPENDENCY_CYCLE";lW={name:cW,run:yxe}});import{appendFileSync as vxe,existsSync as dW,mkdirSync as bxe,readFileSync as Sxe}from"node:fs";import{dirname as wxe,join as xxe}from"node:path";function fW(t){return xxe(t,$xe,kxe)}function pW(t){return eP.add(t),()=>eP.delete(t)}function ea(t,e){let r=fW(t),n=wxe(r);dW(n)||bxe(n,{recursive:!0}),vxe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of eP)try{i(t,e)}catch{}}function mn(t){let e=fW(t);if(!dW(e))return[];let r=Sxe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var $xe,kxe,eP,Mn=y(()=>{"use strict";$xe=".cladding",kxe="audit.log.jsonl";eP=new Set});import{existsSync as Exe}from"node:fs";import{join as Axe}from"node:path";function Oxe(t){let{cwd:e="."}=t,r=mn(e);if(r.length===0)return[{detector:tP,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(Exe(Axe(e,i.artifact))||n.push({detector:tP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var tP,mW,hW=y(()=>{"use strict";Mn();tP="EVIDENCE_MISMATCH";mW={name:tP,run:Oxe}});import{existsSync as Txe,readFileSync as Pxe}from"node:fs";import{join as Ixe}from"node:path";function Rxe(t){let e=Ixe(t,vW);if(!Txe(e))return null;try{let n=((0,_W.parse)(Pxe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*yW(t,e){for(let r of t??[])r.startsWith(gW)&&(yield{ref:r,name:r.slice(gW.length),field:e})}function Cxe(t){let{cwd:e="."}=t,r=Rxe(e);if(r===null)return[];let n;try{n=se(e)}catch(o){return[{detector:rP,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...yW(s.evidence_refs,"evidence_refs"),...yW(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:rP,severity:"warn",path:vW,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var _W,rP,gW,vW,bW,SW=y(()=>{"use strict";_W=St(tr(),1);At();rP="FIXTURE_REFERENCE_INVALID",gW="fixture:",vW="conformance/fixtures.yaml";bW={name:rP,run:Cxe}});function Dxe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:G_,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Xe(n.cmd,[...n.args],{cwd:e,reject:!1});return Gd(i)?[{detector:G_,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:I_(i,G_,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var G_,V_,nP=y(()=>{"use strict";kr();fn();pn();G_="HARDCODED_SECRET";V_={name:G_,run:Dxe}});import{existsSync as jc,readFileSync as iP}from"node:fs";import{join as ta}from"node:path";function Nxe(t){return Fo(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec)\.ts$/.test(r)).length}function ef(t){if(!jc(t))return null;try{return JSON.parse(iP(t,"utf8"))}catch{return null}}function jxe(t,e){let r=ta(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(iP(r,"utf8"))}catch(c){e.push({detector:Yi,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:Yi,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=Nxe(t);s!==a&&e.push({detector:Yi,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function Mxe(t,e){for(let r of wW){let n=ta(t,r.path);if(!jc(n))continue;let i=ef(n);if(!i){e.push({detector:Yi,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:Yi,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function zxe(t,e){let r=ef(ta(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of wW){let s=ta(t,o.path);if(!jc(s))continue;let a=ef(s);a?.version&&a.version!==n&&e.push({detector:Yi,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=ta(t,".claude-plugin","marketplace.json");if(jc(i)){let o=ef(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Yi,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function Fxe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function Lxe(t,e){let r=ta(t,"src","cli","clad.ts"),n=ta(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!jc(r)||!jc(n))return;let i=Fxe(iP(r,"utf8"));if(i.length===0)return;let s=ef(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:Yi,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function Uxe(t){let{cwd:e="."}=t,r=[];return jxe(e,r),Lxe(e,r),Mxe(e,r),zxe(e,r),r}var Yi,wW,xW,$W=y(()=>{"use strict";Qd();Yi="HARNESS_INTEGRITY",wW=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];xW={name:Yi,run:Uxe}});import{existsSync as qxe,readFileSync as Bxe}from"node:fs";import{join as Zxe}from"node:path";function Gxe(t){let{cwd:e="."}=t;return xe(e,W_,r=>Kxe(r,e))}function Vxe(){return Hxe}function Wxe(t){let e=Zxe(t,"spec/capabilities.yaml");if(!qxe(e))return!1;try{let r=kW.default.parse(Bxe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function Kxe(t,e){let r=t.features.length;if(r{"use strict";kW=St(tr(),1);Ot();W_="HOLLOW_GOVERNANCE",Hxe=8;EW={name:W_,run:Gxe}});function Jxe(t){let{cwd:e="."}=t,r;try{r=se(e)}catch{return[]}let n=[];return OW(r.features.map(i=>i.id),"feature","spec/features/",n),OW((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function OW(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:TW,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var TW,PW,IW=y(()=>{"use strict";At();TW="ID_COLLISION";PW={name:TW,run:Jxe}});import{existsSync as tf,readFileSync as oP,readdirSync as sP,statSync as Yxe,writeFileSync as CW}from"node:fs";import{join as Xi}from"node:path";function RW(t){if(!tf(t))return 0;try{return sP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function Xxe(t){if(!tf(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=sP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Xi(n,o),a;try{a=Yxe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function Qxe(t){let e=Xi(t,"spec","capabilities.yaml");if(!tf(e))return 0;try{let r=K_.default.parse(oP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function Lo(t="."){let e=RW(Xi(t,"spec","features")),r=RW(Xi(t,"spec","scenarios")),n=Qxe(t),i=Xxe(Xi(t,"tests")),o=new Date().toISOString().slice(0,10);return{features:e,scenarios:r,capabilities:n,test_files:i,last_synced:o}}function Mc(t,e){let r=Xi(t,"spec.yaml");if(!tf(r))return;let n=oP(r,"utf8"),i=e$e(n,e);i!==n&&CW(r,i)}function e$e(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as lye}from"node:buffer";import{StringDecoder as uye}from"node:string_decoder";var i_,dye,fye,pye,AT=y(()=>{Ur();i_=(t,e,r)=>{if(r)return;if(t)return{transform:dye.bind(void 0,new TextEncoder)};let n=new uye(e);return{transform:fye.bind(void 0,n),final:pye.bind(void 0,n)}},dye=function*(t,e){lye.isBuffer(e)?yield Zi(e):typeof e=="string"?yield t.encode(e):yield e},fye=function*(t,e){yield Nt(e)?t.write(e):e},pye=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as TH}from"node:util";var TT,o_,OH,mye,PH,hye,IH=y(()=>{TT=TH(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),o_=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=hye}=e[r];for await(let i of n(t))yield*o_(i,e,r+1)},OH=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*mye(r,Number(e),t)},mye=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*o_(n,r,e+1)},PH=TH(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),hye=function*(t){yield t}});var OT,RH,Ks,qd,gye,yye,PT=y(()=>{OT=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},RH=(t,e)=>[...e.flatMap(r=>[...Ks(r,t,0)]),...qd(t)],Ks=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=yye}=e[r];for(let i of n(t))yield*Ks(i,e,r+1)},qd=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*gye(r,Number(e),t)},gye=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ks(n,r,e+1)},yye=function*(t){yield t}});import{Transform as _ye,getDefaultHighWaterMark as CH}from"node:stream";var IT,s_,DH,a_=y(()=>{ur();n_();AH();AT();IH();PT();IT=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=DH(t,s,o),l=Ws(e),u=Ws(r),d=l?TT.bind(void 0,o_,a):OT.bind(void 0,Ks),f=l||u?TT.bind(void 0,OH,a):OT.bind(void 0,qd),p=l||u?PH.bind(void 0,a):void 0;return{stream:new _ye({writableObjectMode:n,writableHighWaterMark:CH(n),readableObjectMode:i,readableHighWaterMark:CH(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},s_=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=DH(s,r,a);t=RH(c,t)}return t},DH=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:$H(n,a)},i_(r,s,n),r_(r,o,n,c),{transform:t,final:e},{transform:kH(i,a)},xH({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var NH,vye,bye,Sye,wye,jH=y(()=>{a_();Ur();ur();NH=(t,e)=>{for(let r of vye(t))bye(t,r,e)},vye=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),bye=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${jo[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Sye(a,n));r.input=Ed(s)},Sye=(t,e)=>{let r=s_(t,e,"utf8",!0);return wye(r),Ed(r)},wye=t=>{let e=t.find(r=>typeof r!="string"&&!Nt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var c_,xye,$ye,MH,zH,kye,FH,RT=y(()=>{Zs();ur();gc();Ro();c_=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&hc(r,n)&&!qr.has(e)&&xye(n)&&(t.some(({type:i,value:o})=>i==="native"&&$ye.has(o))||t.every(({type:i})=>dn.has(i))),xye=t=>t===1||t===2,$ye=new Set(["pipe","overlapped"]),MH=async(t,e,r,n)=>{for await(let i of t)kye(e)||FH(i,r,n)},zH=(t,e,r)=>{for(let n of t)FH(n,e,r)},kye=t=>t._readableState.pipes.length>0,FH=(t,e,r)=>{let n=ay(t);ai({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Eye,appendFileSync as Aye}from"node:fs";var LH,Tye,Oye,Pye,Iye,Rye,UH=y(()=>{RT();a_();n_();Ur();ur();Vs();LH=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>Tye({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Tye=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=kZ(t,o,d),p=Zi(f),{stdioItems:m,objectMode:h}=e[r],g=Oye([p],m,c,n),{serializedResult:b,finalResult:_=b}=Pye({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Iye({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let x=a[r]?_:void 0;try{return n.error===void 0&&Rye(b,m,i),x}catch($){return n.error=$,x}},Oye=(t,e,r,n)=>{try{return s_(t,e,r,!1)}catch(i){return n.error=i,t}},Pye=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Ed(t)};let s=h4(t,r);return n[o]?{serializedResult:s,finalResult:ET(s,!i[o],e)}:{serializedResult:s}},Iye=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!c_({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=ET(t,!1,s);try{zH(a,e,n)}catch(c){r.error??=c}},Rye=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Qy.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Aye(n,t):(r.add(o),Eye(n,t))}}});var qH,BH=y(()=>{Ur();Ud();qH=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Ki(e,r,"all")]:Array.isArray(e)?[Ki(t,r,"all"),...e]:Nt(t)&&Nt(e)?SA([t,e]):`${t}${e}`}});import{once as CT}from"node:events";var ZH,Cye,HH,GH,Dye,DT,NT=y(()=>{qs();ZH=async(t,e)=>{let[r,n]=await Cye(t);return e.isForcefullyTerminated??=!1,[r,n]},Cye=async t=>{let[e,r]=await Promise.allSettled([CT(t,"spawn"),CT(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?HH(t):r.value},HH=async t=>{try{return await CT(t,"exit")}catch{return HH(t)}},GH=async t=>{let[e,r]=await t;if(!Dye(e,r)&&DT(e,r))throw new Dn;return[e,r]},Dye=(t,e)=>t===void 0&&e===void 0,DT=(t,e)=>t!==0||e!==null});var VH,Nye,WH=y(()=>{qs();Vs();NT();VH=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=Nye(t,e,r),s=o?.code==="ETIMEDOUT",a=$Z(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},Nye=(t,e,r)=>t!==void 0?t:DT(e,r)?new Dn:void 0});import{spawnSync as jye}from"node:child_process";var KH,Mye,zye,Fye,l_,Lye,Uye,qye,Bye,JH=y(()=>{PA();iT();oT();Ld();Jy();bH();Ud();jH();UH();Vs();BH();WH();KH=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Mye(t,e,r),d=Lye({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ac(d,c,l)},Mye=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=uy(t,e,r),a=zye(r),{file:c,commandArguments:l,options:u}=My(t,e,a);Fye(u);let d=_H(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},zye=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Fye=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&l_("ipcInput"),t&&l_("ipc: true"),r&&l_("detached: true"),n&&l_("cancelSignal")},l_=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Lye=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Uye({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=VH(c,r),{output:m,error:h=l}=LH({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,x)=>Ki(_,r,x)),b=Ki(qH(m,r),r,"all");return Bye({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Uye=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{NH(o,r);let a=qye(r);return jye(...zy(t,e,a))}catch(a){return Ec({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},qye=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Wy(e)}),Bye=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Ky({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Fd({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as jT,on as Zye}from"node:events";var YH,Hye,Gye,Vye,Wye,XH=y(()=>{Sc();Dd();Cd();YH=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(vc({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Py(t)}),Hye({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Hye=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{xy(e,i);let o=No(t,e,r),s=new AbortController;try{return await Promise.race([Gye(o,n,s),Vye(o,r,s),Wye(o,r,s)])}catch(a){throw bc(t),a}finally{s.abort(),$y(e,i)}},Gye=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await jT(t,"message",{signal:r});return n}for await(let[n]of Zye(t,"message",{signal:r}))if(e(n))return n},Vye=async(t,e,{signal:r})=>{await jT(t,"disconnect",{signal:r}),lB(e)},Wye=async(t,e,{signal:r})=>{let[n]=await jT(t,"strict:error",{signal:r});throw vy(n,e)}});import{once as eG,on as Kye}from"node:events";var tG,MT,Jye,Yye,Xye,QH,zT=y(()=>{Sc();Dd();Cd();tG=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>MT({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),MT=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{vc({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Py(t)}),xy(e,o);let s=No(t,e,r),a=new AbortController,c={};return Jye(t,s,a),Yye({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Xye({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Jye=async(t,e,r)=>{try{await eG(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Yye=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await eG(t,"strict:error",{signal:r.signal});n.error=vy(i,e),r.abort()}catch{}},Xye=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of Kye(r,"message",{signal:o.signal}))QH(s),yield c}catch{QH(s)}finally{o.abort(),$y(e,a),n||bc(t),i&&await t}},QH=({error:t})=>{if(t)throw t}});import rG from"node:process";var nG,iG,oG,FT=y(()=>{Ny();XH();zT();Ty();nG=(t,{ipc:e})=>{Object.assign(t,oG(t,!1,e))},iG=()=>{let t=rG,e=!0,r=rG.channel!==void 0;return{...oG(t,e,r),getCancelSignal:MB.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},oG=(t,e,r)=>({sendMessage:Dy.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:YH.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:tG.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as Qye}from"node:child_process";import{PassThrough as e_e,Readable as t_e,Writable as r_e,Duplex as n_e}from"node:stream";var sG,i_e,Bd,o_e,s_e,a_e,c_e,aG=y(()=>{t_();Ld();Jy();sG=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{xT(n);let a=new Qye;i_e(a,n),Object.assign(a,{readable:o_e,writable:s_e,duplex:a_e});let c=Ec({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=c_e(c,s,i);return{subprocess:a,promise:l}},i_e=(t,e)=>{let r=Bd(),n=Bd(),i=Bd(),o=Array.from({length:e.length-3},Bd),s=Bd(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Bd=()=>{let t=new e_e;return t.end(),t},o_e=()=>new t_e({read(){}}),s_e=()=>new r_e({write(){}}),a_e=()=>new n_e({read(){},write(){}}),c_e=async(t,e,r)=>Ac(t,e,r)});import{createReadStream as cG,createWriteStream as lG}from"node:fs";import{Buffer as l_e}from"node:buffer";import{Readable as Zd,Writable as u_e,Duplex as d_e}from"node:stream";var dG,Hd,uG,f_e,fG=y(()=>{a_();t_();ur();dG=(t,e)=>e_(f_e,t,e,!1),Hd=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${jo[t]}.`)},uG={fileNumber:Hd,generator:IT,asyncGenerator:IT,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:d_e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},f_e={input:{...uG,fileUrl:({value:t})=>({stream:cG(t)}),filePath:({value:{file:t}})=>({stream:cG(t)}),webStream:({value:t})=>({stream:Zd.fromWeb(t)}),iterable:({value:t})=>({stream:Zd.from(t)}),asyncIterable:({value:t})=>({stream:Zd.from(t)}),string:({value:t})=>({stream:Zd.from(t)}),uint8Array:({value:t})=>({stream:Zd.from(l_e.from(t))})},output:{...uG,fileUrl:({value:t})=>({stream:lG(t)}),filePath:({value:{file:t,append:e}})=>({stream:lG(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:u_e.fromWeb(t)}),iterable:Hd,asyncIterable:Hd,string:Hd,uint8Array:Hd}}});import{on as p_e,once as pG}from"node:events";import{PassThrough as m_e,getDefaultHighWaterMark as h_e}from"node:stream";import{finished as gG}from"node:stream/promises";function Js(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)UT(i);let e=t.some(({readableObjectMode:i})=>i),r=g_e(t,e),n=new LT({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var g_e,LT,y_e,__e,v_e,UT,b_e,S_e,w_e,x_e,$_e,yG,_G,qT,vG,k_e,u_,mG,hG,d_=y(()=>{g_e=(t,e)=>{if(t.length===0)return h_e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},LT=class extends m_e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(UT(e),this.#t.has(e))return;this.#t.add(e),this.#n??=y_e(this,this.#t,this.#o);let r=b_e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(UT(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},y_e=async(t,e,r)=>{u_(t,mG);let n=new AbortController;try{await Promise.race([__e(t,n),v_e(t,e,r,n)])}finally{n.abort(),u_(t,-mG)}},__e=async(t,{signal:e})=>{try{await gG(t,{signal:e,cleanup:!0})}catch(r){throw yG(t,r),r}},v_e=async(t,e,r,{signal:n})=>{for await(let[i]of p_e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},UT=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},b_e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{u_(t,hG);let a=new AbortController;try{await Promise.race([S_e(o,e,a),w_e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),x_e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),u_(t,-hG)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?qT(t):$_e(t))},S_e=async(t,e,{signal:r})=>{try{await t,r.aborted||qT(e)}catch(n){r.aborted||yG(e,n)}},w_e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await gG(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;_G(s)?i.add(e):vG(t,s)}},x_e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await pG(t,i,{signal:o}),!t.readable)return pG(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},$_e=t=>{t.writable&&t.end()},yG=(t,e)=>{_G(e)?qT(t):vG(t,e)},_G=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",qT=t=>{(t.readable||t.writable)&&t.destroy()},vG=(t,e)=>{t.destroyed||(t.once("error",k_e),t.destroy(e))},k_e=()=>{},u_=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},mG=2,hG=1});import{finished as bG}from"node:stream/promises";var Oc,E_e,BT,A_e,ZT,f_=y(()=>{Hi();Oc=(t,e)=>{t.pipe(e),E_e(t,e),A_e(t,e)},E_e=async(t,e)=>{if(!(Cn(t)||Cn(e))){try{await bG(t,{cleanup:!0,readable:!0,writable:!1})}catch{}BT(e)}},BT=t=>{t.writable&&t.end()},A_e=async(t,e)=>{if(!(Cn(t)||Cn(e))){try{await bG(e,{cleanup:!0,readable:!1,writable:!0})}catch{}ZT(t)}},ZT=t=>{t.readable&&t.destroy()}});var SG,T_e,O_e,P_e,I_e,R_e,wG=y(()=>{d_();Hi();wy();ur();f_();SG=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>dn.has(c)))T_e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!dn.has(c)))P_e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Js(o);Oc(s,i)}},T_e=(t,e,r,n)=>{r==="output"?Oc(t.stdio[n],e):Oc(e,t.stdio[n]);let i=O_e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},O_e=["stdin","stdout","stderr"],P_e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;I_e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},I_e=(t,{signal:e})=>{Cn(t)&&Bs(t,R_e,e)},R_e=2});var Ys,xG=y(()=>{Ys=[];Ys.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ys.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ys.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var p_,HT,GT,C_e,VT,m_,D_e,WT,KT,JT,$G,y8e,_8e,kG=y(()=>{xG();p_=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",HT=Symbol.for("signal-exit emitter"),GT=globalThis,C_e=Object.defineProperty.bind(Object),VT=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(GT[HT])return GT[HT];C_e(GT,HT,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},m_=class{},D_e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),WT=class extends m_{onExit(){return()=>{}}load(){}unload(){}},KT=class extends m_{#t=JT.platform==="win32"?"SIGINT":"SIGHUP";#r=new VT;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ys)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!p_(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Ys)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Ys.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return p_(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&p_(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},JT=globalThis.process,{onExit:$G,load:y8e,unload:_8e}=D_e(p_(JT)?new KT(JT):new WT)});import{addAbortListener as N_e}from"node:events";var EG,AG=y(()=>{kG();EG=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=$G(()=>{t.kill()});N_e(n,()=>{i()})}});var OG,j_e,M_e,TG,z_e,PG=y(()=>{bA();ly();Do();pc();OG=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=cy(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=j_e(r,n,i),{sourceStream:d,sourceError:f}=z_e(t,l),{options:p,fileDescriptors:m}=li.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},j_e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=M_e(t,e,...r),a=Sy(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},M_e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(TG,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||_A(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=Yg(r,...n);return{destination:e(TG)(i,o,s),pipeOptions:s}}if(li.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},TG=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),z_e=(t,e)=>{try{return{sourceStream:xc(t,e)}}catch(r){return{sourceError:r}}}});var RG,F_e,YT,IG,XT=y(()=>{Ld();f_();RG=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=F_e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw YT({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},F_e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return ZT(t),n;if(e!==void 0)return BT(r),e},YT=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Ec({error:t,command:IG,escapedCommand:IG,fileDescriptors:e,options:r,startTime:n,isSync:!1}),IG="source.pipe(destination)"});var CG,DG=y(()=>{CG=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as L_e}from"node:stream/promises";var NG,U_e,q_e,B_e,h_,Z_e,H_e,jG=y(()=>{d_();wy();f_();NG=(t,e,r)=>{let n=h_.has(e)?q_e(t,e):U_e(t,e);return Bs(t,Z_e,r.signal),Bs(e,H_e,r.signal),B_e(e),n},U_e=(t,e)=>{let r=Js([t]);return Oc(r,e),h_.set(e,r),r},q_e=(t,e)=>{let r=h_.get(e);return r.add(t),r},B_e=async t=>{try{await L_e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}h_.delete(t)},h_=new WeakMap,Z_e=2,H_e=1});import{aborted as G_e}from"node:util";var MG,V_e,zG=y(()=>{XT();MG=(t,e)=>t===void 0?[]:[V_e(t,e)],V_e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await G_e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw YT({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var g_,W_e,K_e,FG=y(()=>{Bi();PG();XT();DG();jG();zG();g_=(t,...e)=>{if(wt(e[0]))return g_.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=OG(t,...e),i=W_e({...n,destination:r});return i.pipe=g_.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},W_e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=K_e(t,i);RG({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=NG(e,o,d);return await Promise.race([CG(u),...MG(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},K_e=(t,e)=>Promise.allSettled([t,e])});import{on as J_e}from"node:events";import{getDefaultHighWaterMark as Y_e}from"node:stream";var y_,X_e,QT,Q_e,UG,eO,LG,eve,tve,__=y(()=>{AT();n_();PT();y_=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return X_e(e,s),UG({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},X_e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},QT=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Q_e(e,s,t);let a=t.readableObjectMode&&!o;return UG({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Q_e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},UG=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=J_e(t,"data",{signal:e.signal,highWaterMark:LG,highWatermark:LG});return eve({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},eO=Y_e(!0),LG=eO,eve=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=tve({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ks(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*qd(a)}},tve=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[i_(t,r,!e),r_(t,i,!n,{})].filter(Boolean)});import{setImmediate as rve}from"node:timers/promises";var qG,nve,ive,ove,tO,BG,rO=y(()=>{Vy();Ur();RT();__();Vs();Ud();qG=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=nve({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([ive(t),d]);return}let f=$T(c,r),p=QT({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([ove({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},nve=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!c_({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=QT({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await MH(a,t,r,o)},ive=async t=>{await rve(),t.readableFlowing===null&&t.resume()},ove=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await By(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Zy(r,{maxBuffer:o})):await Gy(r,{maxBuffer:o})}catch(a){return BG(SZ({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},tO=async t=>{try{return await t}catch(e){return BG(e)}},BG=({bufferedData:t})=>p4(t)?new Uint8Array(t):t});import{finished as sve}from"node:stream/promises";var Gd,ave,cve,lve,uve,dve,nO,v_,ZG,b_=y(()=>{Gd=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=ave(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],sve(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||uve(a,e,r,n)}finally{s.abort()}},ave=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&cve(t,r,n),n},cve=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{lve(e,r),n.call(t,...i)}},lve=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},uve=(t,e,r,n)=>{if(!dve(t,e,r,n))throw t},dve=(t,e,r,n=!0)=>r.propagating?ZG(t)||v_(t):(r.propagating=!0,nO(r,e)===n?ZG(t):v_(t)),nO=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",v_=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",ZG=t=>t?.code==="EPIPE"});var HG,iO,oO=y(()=>{rO();b_();HG=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>iO({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),iO=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=Gd(t,e,l);if(nO(l,e)){await u;return}let[d]=await Promise.all([qG({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var GG,VG,fve,pve,sO=y(()=>{d_();oO();GG=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Js([t,e].filter(Boolean)):void 0,VG=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>iO({...fve(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:pve(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),fve=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},pve=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var WG,KG,JG=y(()=>{gc();Ro();WG=t=>hc(t,"ipc"),KG=(t,e)=>{let r=ay(t);ai({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var YG,XG,QG=y(()=>{Vs();JG();Vi();zT();YG=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=WG(o),a=Gi(e,"ipc"),c=Gi(r,"ipc");for await(let l of MT({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(wZ(t,i,c),i.push(l)),s&&KG(l,o);return i},XG=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as mve}from"node:events";var e9,hve,gve,yve,t9=y(()=>{Gs();QA();ZA();XA();Hi();ur();rO();QG();tT();sO();oO();NT();b_();e9=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=ZH(t,f),x={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},$=HG({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:x}),w=VG({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:x}),R=[],O=YG({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),A=hve(h,t,x),N=gve(m,x);try{return await Promise.race([Promise.all([{},GH(_),Promise.all($),w,O,VB(t,d),...A,...N]),g,yve(t,b),...qB(t,o,f,b),...cB({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...LB({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all($.map(Z=>tO(Z))),tO(w),XG(O,R),Promise.allSettled(A),Promise.allSettled(N)])}},hve=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Gd(n,i,r)),gve=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>jn(o,{checkOpen:!1})&&!Cn(o)).map(({type:i,value:o,stream:s=o})=>Gd(s,n,e,{isSameDirection:dn.has(i),stopOnExit:i==="native"}))),yve=async(t,{signal:e})=>{let[r]=await mve(t,"error",{signal:e});throw r}});var r9,Vd,Pc,S_=y(()=>{wc();r9=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Vd=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=ci();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Pc=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as n9}from"node:stream/promises";var aO,i9,cO,lO,w_,x_,uO=y(()=>{b_();aO=async t=>{if(t!==void 0)try{await cO(t)}catch{}},i9=async t=>{if(t!==void 0)try{await lO(t)}catch{}},cO=async t=>{await n9(t,{cleanup:!0,readable:!1,writable:!0})},lO=async t=>{await n9(t,{cleanup:!0,readable:!0,writable:!1})},w_=async(t,e)=>{if(await t,e)throw e},x_=(t,e,r)=>{r&&!v_(r)?t.destroy(r):e&&t.destroy()}});import{Readable as _ve}from"node:stream";import{callbackify as vve}from"node:util";var o9,dO,fO,pO,bve,mO,hO,s9,gO=y(()=>{Zs();Do();__();wc();S_();uO();o9=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||qr.has(r),{subprocessStdout:a,waitReadableDestroy:c}=dO(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=fO(a,s),{read:f,onStdoutDataDone:p}=pO({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new _ve({read:f,destroy:vve(hO.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return mO({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},dO=(t,e,r)=>{let n=xc(t,e),i=Vd(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},fO=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:eO},pO=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=ci(),s=y_({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){bve(this,s,o)},onStdoutDataDone:o}},bve=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},mO=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await lO(t),await n,await aO(i),await e,r.readable&&r.push(null)}catch(o){await aO(i),s9(r,o)}},hO=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Pc(r,e)&&(s9(t,n),await w_(e,n))},s9=(t,e)=>{x_(t,t.readable,e)}});import{Writable as Sve}from"node:stream";import{callbackify as a9}from"node:util";var c9,yO,_O,wve,xve,vO,bO,l9,SO=y(()=>{Do();S_();uO();c9=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=yO(t,r,e),s=new Sve({..._O(n,t,i),destroy:a9(bO.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return vO(n,s),s},yO=(t,e,r)=>{let n=Sy(t,e),i=Vd(r,n,"writableFinal"),o=Vd(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},_O=(t,e,r)=>({write:wve.bind(void 0,t),final:a9(xve.bind(void 0,t,e,r))}),wve=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},xve=async(t,e,r)=>{await Pc(r,e)&&(t.writable&&t.end(),await e)},vO=async(t,e,r)=>{try{await cO(t),e.writable&&e.end()}catch(n){await i9(r),l9(e,n)}},bO=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Pc(r,e),await Pc(n,e)&&(l9(t,i),await w_(e,i))},l9=(t,e)=>{x_(t,t.writable,e)}});import{Duplex as $ve}from"node:stream";import{callbackify as kve}from"node:util";var u9,Eve,d9=y(()=>{Zs();gO();SO();u9=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||qr.has(r),{subprocessStdout:c,waitReadableDestroy:l}=dO(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=yO(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=fO(c,a),{read:g,onStdoutDataDone:b}=pO({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new $ve({read:g,..._O(u,t,d),destroy:kve(Eve.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return mO({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),vO(u,_,c),_},Eve=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([hO({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),bO({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var wO,Ave,f9=y(()=>{Zs();Do();__();wO=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||qr.has(e),s=xc(t,r),a=y_({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Ave(a,s,t)},Ave=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var p9,m9=y(()=>{S_();gO();SO();d9();f9();p9=(t,{encoding:e})=>{let r=r9();t.readable=o9.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=c9.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=u9.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=wO.bind(void 0,t,e),t[Symbol.asyncIterator]=wO.bind(void 0,t,e,{})}});var h9,Tve,Ove,g9=y(()=>{h9=(t,e)=>{for(let[r,n]of Ove){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Tve=(async()=>{})().constructor.prototype,Ove=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Tve,t)])});import{setMaxListeners as Pve}from"node:events";import{spawn as Ive}from"node:child_process";var y9,Rve,Cve,Dve,Nve,jve,_9=y(()=>{Vy();PA();iT();Do();oT();FT();Ld();Jy();aG();fG();Ud();wG();yy();AG();FG();sO();t9();m9();wc();g9();y9=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Rve(t,e,r),{subprocess:f,promise:p}=Dve({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=g_.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),h9(f,p),li.set(f,{options:u,fileDescriptors:d}),f},Rve=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=uy(t,e,r),{file:a,commandArguments:c,options:l}=My(t,e,r),u=Cve(l),d=dG(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Cve=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Dve=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Ive(...zy(t,e,r))}catch(m){return sG({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Pve(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];SG(c,a,l),EG(c,r,l);let d={},f=ci();c.kill=sB.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=GG(c,r),p9(c,r),nG(c,r);let p=Nve({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Nve=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await e9({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map(($,w)=>Ki($,e,w)),_=Ki(h,e,"all"),x=jve({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ac(x,n,e)},jve=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Fd({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ui,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Ky({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var $_,Mve,zve,v9=y(()=>{Bi();Vi();$_=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Mve(n,t[n],i)]));return{...t,...r}},Mve=(t,e,r)=>zve.has(t)&&wt(e)&&wt(r)?{...e,...r}:r,zve=new Set(["env",...kA])});var Mo,Fve,Lve,b9=y(()=>{Bi();bA();S4();JH();_9();v9();Mo=(t,e,r,n)=>{let i=(s,a,c)=>Mo(s,a,r,c),o=(...s)=>Fve({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Fve=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(wt(o))return i(t,$_(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Lve({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?KH(a,c,l):y9(a,c,l,i)},Lve=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=v4(e)?b4(e,r):[e,...r],[s,a,c]=Yg(...o),l=$_($_(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var S9,w9,x9,Uve,qve,$9=y(()=>{S9=({file:t,commandArguments:e})=>x9(t,e),w9=({file:t,commandArguments:e})=>({...x9(t,e),isSync:!0}),x9=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=Uve(t);return{file:r,commandArguments:n}},Uve=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(qve)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},qve=/ +/g});var k9,E9,Bve,A9,Zve,T9,O9=y(()=>{k9=(t,e,r)=>{t.sync=e(Bve,r),t.s=t.sync},E9=({options:t})=>A9(t),Bve=({options:t})=>({...A9(t),isSync:!0}),A9=t=>({options:{...Zve(t),...t}}),Zve=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},T9={preferLocal:!0}});var a7e,Xe,c7e,l7e,u7e,d7e,f7e,p7e,m7e,h7e,kr=y(()=>{b9();$9();eT();O9();FT();a7e=Mo(()=>({})),Xe=Mo(()=>({isSync:!0})),c7e=Mo(S9),l7e=Mo(w9),u7e=Mo(ZB),d7e=Mo(E9,{},T9,k9),{sendMessage:f7e,getOneMessage:p7e,getEachMessage:m7e,getCancelSignal:h7e}=iG()});import{existsSync as k_,statSync as Hve}from"node:fs";import{dirname as xO,extname as Gve,isAbsolute as P9,join as $O,relative as kO,resolve as E_,sep as Vve}from"node:path";function A_(t){return t==="./gradlew"||t==="gradle"}function Wve(t){return(k_($O(t,"build.gradle.kts"))||k_($O(t,"build.gradle")))&&k_($O(t,"gradle.properties"))}function Kve(t,e){let n=kO(t,e).split(Vve).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function zo(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Jve(t,e){let r=E_(t,e),n=r;k_(r)?Hve(r).isFile()&&(n=xO(r)):Gve(r)!==""&&(n=xO(r));let i=kO(t,n);if(i.startsWith("..")||P9(i))return null;let o=n;for(;;){if(Wve(o))return o;if(E_(o)===E_(t))return null;let s=xO(o);if(s===o)return null;let a=kO(t,s);if(a.startsWith("..")||P9(a))return null;o=s}}function T_(t,e){let r=E_(t),n=new Map,i=[];for(let o of e){let s=Jve(r,o);if(!s){i.push(o);continue}let a=Kve(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var O_=y(()=>{"use strict"});import{existsSync as Yve,readFileSync as Xve}from"node:fs";import{join as Qve}from"node:path";function Ic(t="."){let e=Qve(t,".cladding","config.yaml");if(!Yve(e))return EO;try{let n=(0,I9.parse)(Xve(e,"utf8"))?.gate;if(!n)return EO;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of ebe){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return EO}}function R9(t,e){let r=[],n=!1;for(let i of t){let o=tbe.exec(i);if(o){n=!0;for(let s of e)r.push(zo(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var I9,ebe,EO,tbe,P_=y(()=>{"use strict";I9=St(tr(),1);O_();ebe=["type","lint","test","coverage"],EO={scope:"feature"};tbe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as TO,readFileSync as C9,readdirSync as rbe,statSync as nbe}from"node:fs";import{join as I_}from"node:path";function IO(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=I_(t,e);if(TO(r))try{if(D9.test(C9(r,"utf8")))return!0}catch{}}return!1}function N9(t){try{return TO(t)&&D9.test(C9(t,"utf8"))}catch{return!1}}function j9(t,e=0){if(e>4||!TO(t))return!1;let r;try{r=rbe(t)}catch{return!1}for(let n of r){let i=I_(t,n),o=!1;try{o=nbe(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(j9(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&N9(i))return!0}return!1}function sbe(t){if(IO(t))return!0;for(let e of ibe)if(N9(I_(t,e)))return!0;for(let e of obe)if(j9(I_(t,e)))return!0;return!1}function M9(t="."){let e=Ic(t).coverage;return e||(sbe(t)?"kover":"jacoco")}function z9(t="."){return OO[M9(t)]}function F9(t="."){return AO[M9(t)]}var OO,AO,PO,D9,ibe,obe,R_=y(()=>{"use strict";P_();OO={kover:"koverXmlReport",jacoco:"jacocoTestReport"},AO={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},PO=[AO.kover,AO.jacoco],D9=/kover/i;ibe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],obe=["buildSrc","build-logic"]});import{existsSync as RO,readdirSync as L9}from"node:fs";import{join as C_}from"node:path";function CO(t){return RO(C_(t,"gradlew"))?"./gradlew":"gradle"}function abe(t){let e=CO(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[z9(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function lbe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function fbe(t,e){for(let r of e)if(RO(C_(t,r)))return r}function pbe(t,e){try{return L9(t).find(n=>n.endsWith(e))}catch{return}}function hbe(t,e){for(let r of mbe)if(r.configs.some(n=>RO(C_(t,n))))return r.gate;return e}function dt(t="."){for(let e of ube){let r;for(let o of e.manifests)if(o.startsWith(".")?r=pbe(t,o):r=fbe(t,[o]),r)break;if(!r||e.requiresSource&&!lbe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"&&n.lint?{...n,lint:hbe(t,n.lint)}:n;return{language:e.language,manifest:r,gates:i}}return dbe}var cbe,ube,dbe,mbe,fn=y(()=>{"use strict";R_();cbe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);ube=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","madge","--circular","--extensions","ts","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:abe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}],dbe={language:"unknown",manifest:"",gates:{}};mbe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}]});import{existsSync as gbe,readFileSync as ybe}from"node:fs";import{join as _be}from"node:path";function Wd(t){return t.code==="ENOENT"}function D_(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return U9.test(o)||U9.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function jt(t,e,r){return Wd(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function rr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Rc(t,e){let r=_be(t,"package.json");if(!gbe(r))return!1;try{return!!JSON.parse(ybe(r,"utf8")).scripts?.[e]}catch{return!1}}var U9,pn=y(()=>{"use strict";U9=/config (is |file )?not found|no such file|ENOENT|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function vbe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:N_,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Xe(n.cmd,[...n.args],{cwd:e,reject:!1});return Wd(i)?[{detector:N_,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:D_(i,N_,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var N_,j_,DO=y(()=>{"use strict";kr();fn();pn();N_="ARCHITECTURE_VIOLATION";j_={name:N_,run:vbe}});import q9 from"node:process";function Xs(t={}){let r=j_.run(t).filter(o=>o.severity==="error"),n=r.length===0,i={stage:bbe,pass:n,exitCode:n?0:1};return n?i:{...i,stderr:r.map(o=>o.message).join(` +`)}}var bbe,Sbe,M_=y(()=>{"use strict";DO();bbe="stage_1.5";Sbe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${q9.argv[1]}`;if(Sbe){let t=Xs();console.log(JSON.stringify(t)),q9.exit(t.exitCode)}});import{existsSync as NO,readdirSync as B9}from"node:fs";import{join as z_}from"node:path";function xbe(t,e){let r=z_(t,e.path);if(!NO(r))return!0;if(e.isDirectory)try{return B9(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function $be(t){let{cwd:e="."}=t,r=[];for(let i of wbe)xbe(e,i)&&r.push({detector:Kd,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=z_(e,"spec.yaml");if(NO(n)){let i=Abe(n),o=i?null:kbe(e);if(i)r.push({detector:Kd,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:Kd,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=Ebe(e);s&&r.push({detector:Kd,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function kbe(t){for(let e of["spec/features","spec/scenarios"]){let r=z_(t,e);if(!NO(r))continue;let n;try{n=B9(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ii(z_(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function Ebe(t){try{return se(t),null}catch(e){return e.message}}function Abe(t){let e;try{e=ii(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Kd,wbe,Z9,H9=y(()=>{"use strict";Tt();Hg();Kd="ABSENCE_OF_GOVERNANCE",wbe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];Z9={name:Kd,run:$be}});function G9(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function jO(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;let n=Tbe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:G9(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${G9(r)}'`:null}function Obe(t,e){let r=jO(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function V9(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...Obe(r,n));return e}var Tbe,MO=y(()=>{"use strict";Tbe={event:"when",state:"while",optional:"where",unwanted:"if"}});function _e(t,e,r){let n;try{n=se(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var xt=y(()=>{"use strict";Tt()});function Pbe(t){let{cwd:e="."}=t;return _e(e,F_,Ibe)}function Ibe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:F_,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of V9(t.features))e.push({detector:F_,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var F_,W9,K9=y(()=>{"use strict";MO();xt();F_="AC_DRIFT";W9={name:F_,run:Pbe}});function fi(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return Nbe[n]??J9}var Rbe,Cbe,J9,Dbe,Nbe,Cc=y(()=>{"use strict";fn();Rbe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Cbe=/^[ \t]*import\s+([\w.]+)/gm,J9={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Rbe,importStyle:"relative"},Dbe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:Cbe,importStyle:"dotted"},Nbe={typescript:J9,kotlin:Dbe}});import{existsSync as jbe,readFileSync as Mbe,readdirSync as zbe,statSync as Fbe}from"node:fs";import{join as X9,relative as Y9}from"node:path";function Lbe(t,e){if(!jbe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=zbe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=X9(i,s),c;try{c=Fbe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function Ube(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function Bbe(t){return qbe.test(t)}function Zbe(t){let{cwd:e="."}=t,r;try{r=se(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=fi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Lbe(X9(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=Mbe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Tt();Cc();Q9="AI_HINTS_FORBIDDEN_PATTERN";qbe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;eV={name:Q9,run:Zbe}});function Hbe(t){let{cwd:e="."}=t,r;try{r=se(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:rV,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var rV,nV,iV=y(()=>{"use strict";Tt();rV="AC_DUPLICATE_WITHIN_FEATURE";nV={name:rV,run:Hbe}});import{createRequire as Gbe}from"module";import{basename as Vbe,dirname as FO,normalize as Wbe,relative as Kbe,resolve as Jbe,sep as aV}from"path";import*as Ybe from"fs";function Xbe(t){let e=Wbe(t);return e.length>1&&e[e.length-1]===aV&&(e=e.substring(0,e.length-1)),e}function cV(t,e){return t.replace(Qbe,e)}function tSe(t){return t==="/"||eSe.test(t)}function zO(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=Jbe(t)),(n||o)&&(t=Xbe(t)),t===".")return"";let s=t[t.length-1]!==i;return cV(s?t+i:t,i)}function lV(t,e){return e+t}function rSe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:cV(Kbe(t,n),e.pathSeparator)+e.pathSeparator+r}}function nSe(t){return t}function iSe(t,e,r){return e+t+r}function oSe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?rSe(t,e):n?lV:nSe}function sSe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function aSe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function dSe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?aSe(t):sSe(t):n&&n.length?lSe:cSe:uSe}function ySe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?gSe:r&&r.length?n?fSe:pSe:n?mSe:hSe}function bSe(t){return t.group?vSe:_Se}function xSe(t){return t.group?SSe:wSe}function ESe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?kSe:$Se}function uV(t,e,r){if(r.options.useRealPaths)return ASe(e,r);let n=FO(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=FO(n)}return r.symlinks.set(t,e),i>1}function ASe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function L_(t,e,r,n){e(t&&!n?t:null,r)}function jSe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?TSe:RSe:n?e?OSe:NSe:i?e?ISe:DSe:e?PSe:CSe}function FSe(t){return t?zSe:MSe}function BSe(t,e){return new Promise((r,n)=>{pV(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function pV(t,e,r){new fV(t,e,r).start()}function ZSe(t,e){return new fV(t,e).start()}var oV,Qbe,eSe,cSe,lSe,uSe,fSe,pSe,mSe,hSe,gSe,_Se,vSe,SSe,wSe,$Se,kSe,TSe,OSe,PSe,ISe,RSe,CSe,DSe,NSe,dV,MSe,zSe,LSe,USe,qSe,fV,sV,mV,hV,gV=y(()=>{oV=Gbe(import.meta.url);Qbe=/[\\/]/g;eSe=/^[a-z]:[\\/]$/i;cSe=(t,e)=>{e.push(t||".")},lSe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},uSe=()=>{};fSe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},pSe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},mSe=(t,e,r,n)=>{r.files++},hSe=(t,e)=>{e.push(t)},gSe=()=>{};_Se=t=>t,vSe=()=>[""].slice(0,0);SSe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},wSe=()=>{};$Se=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&uV(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},kSe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&uV(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};TSe=t=>t.counts,OSe=t=>t.groups,PSe=t=>t.paths,ISe=t=>t.paths.slice(0,t.options.maxFiles),RSe=(t,e,r)=>(L_(e,r,t.counts,t.options.suppressErrors),null),CSe=(t,e,r)=>(L_(e,r,t.paths,t.options.suppressErrors),null),DSe=(t,e,r)=>(L_(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),NSe=(t,e,r)=>(L_(e,r,t.groups,t.options.suppressErrors),null);dV={withFileTypes:!0},MSe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",dV,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},zSe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",dV)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};LSe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},USe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},qSe=class{aborted=!1;abort(){this.aborted=!0}},fV=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=jSe(e,this.isSynchronous),this.root=zO(t,e),this.state={root:tSe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new USe,options:e,queue:new LSe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new qSe,fs:e.fs||Ybe},this.joinPath=oSe(this.root,e),this.pushDirectory=dSe(this.root,e),this.pushFile=ySe(e),this.getArray=bSe(e),this.groupFiles=xSe(e),this.resolveSymlink=ESe(e,this.isSynchronous),this.walkDirectory=FSe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=zO(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let x=Vbe(_),$=zO(FO(_),this.state.options);_=this.joinPath(x,$),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};sV=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return BSe(this.root,this.options)}withCallback(t){pV(this.root,this.options,t)}sync(){return ZSe(this.root,this.options)}},mV=null;try{oV.resolve("picomatch"),mV=oV("picomatch")}catch{}hV=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:aV,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new sV(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new sV(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||mV;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var Jd=v((yQe,SV)=>{"use strict";var yV="[^\\\\/]",HSe="(?=.)",_V="[^/]",LO="(?:\\/|$)",vV="(?:^|\\/)",UO=`\\.{1,2}${LO}`,GSe="(?!\\.)",VSe=`(?!${vV}${UO})`,WSe=`(?!\\.{0,1}${LO})`,KSe=`(?!${UO})`,JSe="[^.\\/]",YSe=`${_V}*?`,XSe="/",bV={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:HSe,QMARK:_V,END_ANCHOR:LO,DOTS_SLASH:UO,NO_DOT:GSe,NO_DOTS:VSe,NO_DOT_SLASH:WSe,NO_DOTS_SLASH:KSe,QMARK_NO_DOT:JSe,STAR:YSe,START_ANCHOR:vV,SEP:XSe},QSe={...bV,SLASH_LITERAL:"[\\\\/]",QMARK:yV,STAR:`${yV}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},ewe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};SV.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:ewe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?QSe:bV}}});var Yd=v(Er=>{"use strict";var{REGEX_BACKSLASH:twe,REGEX_REMOVE_BACKSLASH:rwe,REGEX_SPECIAL_CHARS:nwe,REGEX_SPECIAL_CHARS_GLOBAL:iwe}=Jd();Er.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Er.hasRegexChars=t=>nwe.test(t);Er.isRegexChar=t=>t.length===1&&Er.hasRegexChars(t);Er.escapeRegex=t=>t.replace(iwe,"\\$1");Er.toPosixSlashes=t=>t.replace(twe,"/");Er.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Er.removeBackslashes=t=>t.replace(rwe,e=>e==="\\"?"":e);Er.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Er.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Er.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Er.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Er.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var OV=v((vQe,TV)=>{"use strict";var wV=Yd(),{CHAR_ASTERISK:qO,CHAR_AT:owe,CHAR_BACKWARD_SLASH:Xd,CHAR_COMMA:swe,CHAR_DOT:BO,CHAR_EXCLAMATION_MARK:ZO,CHAR_FORWARD_SLASH:AV,CHAR_LEFT_CURLY_BRACE:HO,CHAR_LEFT_PARENTHESES:GO,CHAR_LEFT_SQUARE_BRACKET:awe,CHAR_PLUS:cwe,CHAR_QUESTION_MARK:xV,CHAR_RIGHT_CURLY_BRACE:lwe,CHAR_RIGHT_PARENTHESES:$V,CHAR_RIGHT_SQUARE_BRACKET:uwe}=Jd(),kV=t=>t===AV||t===Xd,EV=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},dwe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,x=!1,$=!1,w=!1,R=0,O,A,N={value:"",depth:0,isGlob:!1},k=()=>l>=n,Z=()=>c.charCodeAt(l+1),ne=()=>(O=A,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),I=c.slice(d)):m===!0?(xe="",I=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&kV(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(I&&(I=wV.removeBackslashes(I)),xe&&_===!0&&(xe=wV.removeBackslashes(xe)));let sn={prefix:P,input:t,start:u,base:xe,glob:I,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:x,negatedExtglob:$};if(r.tokens===!0&&(sn.maxDepth=0,kV(A)||s.push(N),sn.tokens=s),r.parts===!0||r.tokens===!0){let He;for(let ut=0;ut{"use strict";var Qd=Jd(),Br=Yd(),{MAX_LENGTH:U_,POSIX_REGEX_SOURCE:fwe,REGEX_NON_SPECIAL_CHARS:pwe,REGEX_SPECIAL_CHARS_BACKREF:mwe,REPLACEMENTS:PV}=Qd,hwe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Br.escapeRegex(i)).join("..")}return r},Dc=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,IV=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},gwe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},RV=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(gwe(e))return e.replace(/\\(.)/g,"$1")},ywe=t=>{let e=t.map(RV).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},_we=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=RV(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Br.escapeRegex(r[0]):`[${r.map(i=>Br.escapeRegex(i)).join("")}]`}*`},vwe=t=>{let e=0,r=t.trim(),n=VO(r);for(;n;)e++,r=n.body.trim(),n=VO(r);return e},bwe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Qd.DEFAULT_MAX_EXTGLOB_RECURSION,n=IV(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||ywe(n)))return{risky:!0};for(let i of n){let o=_we(i);if(o)return{risky:!0,safeOutput:o};if(vwe(i)>r)return{risky:!0}}return{risky:!1}},WO=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=PV[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(U_,r.maxLength):U_,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=Qd.globChars(r.windows),l=Qd.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:x,STAR:$,START_ANCHOR:w}=c,R=U=>`(${a}(?:(?!${w}${U.dot?m:u}).)*?)`,O=r.dot?"":h,A=r.dot?_:x,N=r.bash===!0?R(r):$;r.capture&&(N=`(${N})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=Br.removePrefix(t,k),i=t.length;let Z=[],ne=[],xe=[],P=o,I,sn=()=>k.index===i-1,He=k.peek=(U=1)=>t[k.index+U],ut=k.advance=()=>t[++k.index]||"",ji=()=>t.slice(k.index+1),an=(U="",at=0)=>{k.consumed+=U,k.index+=at},yo=U=>{k.output+=U.output!=null?U.output:U.value,an(U.value)},use=()=>{let U=1;for(;He()==="!"&&(He(2)!=="("||He(3)==="?");)ut(),k.start++,U++;return U%2===0?!1:(k.negated=!0,k.start++,!0)},Ch=U=>{k[U]++,xe.push(U)},_o=U=>{k[U]--,xe.pop()},Ee=U=>{if(P.type==="globstar"){let at=k.braces>0&&(U.type==="comma"||U.type==="brace"),L=U.extglob===!0||Z.length&&(U.type==="pipe"||U.type==="paren");U.type!=="slash"&&U.type!=="paren"&&!at&&!L&&(k.output=k.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=N,k.output+=P.output)}if(Z.length&&U.type!=="paren"&&(Z[Z.length-1].inner+=U.value),(U.value||U.output)&&yo(U),P&&P.type==="text"&&U.type==="text"){P.output=(P.output||P.value)+U.value,P.value+=U.value;return}U.prev=P,s.push(U),P=U},Dh=(U,at)=>{let L={...l[at],conditions:1,inner:""};L.prev=P,L.parens=k.parens,L.output=k.output,L.startIndex=k.index,L.tokensIndex=s.length;let Ae=(r.capture?"(":"")+L.open;Ch("parens"),Ee({type:U,value:at,output:k.output?"":p}),Ee({type:"paren",extglob:!0,value:ut(),output:Ae}),Z.push(L)},dse=U=>{let at=t.slice(U.startIndex,k.index+1),L=t.slice(U.startIndex+2,k.index),Ae=bwe(L,r);if((U.type==="plus"||U.type==="star")&&Ae.risky){let nt=Ae.safeOutput?(U.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,ei=s[U.tokensIndex];ei.type="text",ei.value=at,ei.output=nt||Br.escapeRegex(at);for(let ti=U.tokensIndex+1;ti1&&U.inner.includes("/")&&(nt=R(r)),(nt!==N||sn()||/^\)+$/.test(ji()))&&(it=U.close=`)$))${nt}`),U.inner.includes("*")&&(Ct=ji())&&/^\.[^\\/.]+$/.test(Ct)){let ei=WO(Ct,{...e,fastpaths:!1}).output;it=U.close=`)${ei})${nt})`}U.prev.type==="bos"&&(k.negatedExtglob=!0)}Ee({type:"paren",extglob:!0,value:I,output:it}),_o("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let U=!1,at=t.replace(mwe,(L,Ae,it,Ct,nt,ei)=>Ct==="\\"?(U=!0,L):Ct==="?"?Ae?Ae+Ct+(nt?_.repeat(nt.length):""):ei===0?A+(nt?_.repeat(nt.length):""):_.repeat(it.length):Ct==="."?u.repeat(it.length):Ct==="*"?Ae?Ae+Ct+(nt?N:""):N:Ae?L:`\\${L}`);return U===!0&&(r.unescape===!0?at=at.replace(/\\/g,""):at=at.replace(/\\+/g,L=>L.length%2===0?"\\\\":L?"\\":"")),at===t&&r.contains===!0?(k.output=t,k):(k.output=Br.wrapOutput(at,k,e),k)}for(;!sn();){if(I=ut(),I==="\0")continue;if(I==="\\"){let L=He();if(L==="/"&&r.bash!==!0||L==="."||L===";")continue;if(!L){I+="\\",Ee({type:"text",value:I});continue}let Ae=/^\\+/.exec(ji()),it=0;if(Ae&&Ae[0].length>2&&(it=Ae[0].length,k.index+=it,it%2!==0&&(I+="\\")),r.unescape===!0?I=ut():I+=ut(),k.brackets===0){Ee({type:"text",value:I});continue}}if(k.brackets>0&&(I!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&I===":"){let L=P.value.slice(1);if(L.includes("[")&&(P.posix=!0,L.includes(":"))){let Ae=P.value.lastIndexOf("["),it=P.value.slice(0,Ae),Ct=P.value.slice(Ae+2),nt=fwe[Ct];if(nt){P.value=it+nt,k.backtrack=!0,ut(),!o.output&&s.indexOf(P)===1&&(o.output=p);continue}}}(I==="["&&He()!==":"||I==="-"&&He()==="]")&&(I=`\\${I}`),I==="]"&&(P.value==="["||P.value==="[^")&&(I=`\\${I}`),r.posix===!0&&I==="!"&&P.value==="["&&(I="^"),P.value+=I,yo({value:I});continue}if(k.quotes===1&&I!=='"'){I=Br.escapeRegex(I),P.value+=I,yo({value:I});continue}if(I==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&Ee({type:"text",value:I});continue}if(I==="("){Ch("parens"),Ee({type:"paren",value:I});continue}if(I===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Dc("opening","("));let L=Z[Z.length-1];if(L&&k.parens===L.parens+1){dse(Z.pop());continue}Ee({type:"paren",value:I,output:k.parens?")":"\\)"}),_o("parens");continue}if(I==="["){if(r.nobracket===!0||!ji().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Dc("closing","]"));I=`\\${I}`}else Ch("brackets");Ee({type:"bracket",value:I});continue}if(I==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){Ee({type:"text",value:I,output:`\\${I}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Dc("opening","["));Ee({type:"text",value:I,output:`\\${I}`});continue}_o("brackets");let L=P.value.slice(1);if(P.posix!==!0&&L[0]==="^"&&!L.includes("/")&&(I=`/${I}`),P.value+=I,yo({value:I}),r.literalBrackets===!1||Br.hasRegexChars(L))continue;let Ae=Br.escapeRegex(P.value);if(k.output=k.output.slice(0,-P.value.length),r.literalBrackets===!0){k.output+=Ae,P.value=Ae;continue}P.value=`(${a}${Ae}|${P.value})`,k.output+=P.value;continue}if(I==="{"&&r.nobrace!==!0){Ch("braces");let L={type:"brace",value:I,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};ne.push(L),Ee(L);continue}if(I==="}"){let L=ne[ne.length-1];if(r.nobrace===!0||!L){Ee({type:"text",value:I,output:I});continue}let Ae=")";if(L.dots===!0){let it=s.slice(),Ct=[];for(let nt=it.length-1;nt>=0&&(s.pop(),it[nt].type!=="brace");nt--)it[nt].type!=="dots"&&Ct.unshift(it[nt].value);Ae=hwe(Ct,r),k.backtrack=!0}if(L.comma!==!0&&L.dots!==!0){let it=k.output.slice(0,L.outputIndex),Ct=k.tokens.slice(L.tokensIndex);L.value=L.output="\\{",I=Ae="\\}",k.output=it;for(let nt of Ct)k.output+=nt.output||nt.value}Ee({type:"brace",value:I,output:Ae}),_o("braces"),ne.pop();continue}if(I==="|"){Z.length>0&&Z[Z.length-1].conditions++,Ee({type:"text",value:I});continue}if(I===","){let L=I,Ae=ne[ne.length-1];Ae&&xe[xe.length-1]==="braces"&&(Ae.comma=!0,L="|"),Ee({type:"comma",value:I,output:L});continue}if(I==="/"){if(P.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),P=o;continue}Ee({type:"slash",value:I,output:f});continue}if(I==="."){if(k.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let L=ne[ne.length-1];P.type="dots",P.output+=I,P.value+=I,L.dots=!0;continue}if(k.braces+k.parens===0&&P.type!=="bos"&&P.type!=="slash"){Ee({type:"text",value:I,output:u});continue}Ee({type:"dot",value:I,output:u});continue}if(I==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&He()==="("&&He(2)!=="?"){Dh("qmark",I);continue}if(P&&P.type==="paren"){let Ae=He(),it=I;(P.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(ji()))&&(it=`\\${I}`),Ee({type:"text",value:I,output:it});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){Ee({type:"qmark",value:I,output:x});continue}Ee({type:"qmark",value:I,output:_});continue}if(I==="!"){if(r.noextglob!==!0&&He()==="("&&(He(2)!=="?"||!/[!=<:]/.test(He(3)))){Dh("negate",I);continue}if(r.nonegate!==!0&&k.index===0){use();continue}}if(I==="+"){if(r.noextglob!==!0&&He()==="("&&He(2)!=="?"){Dh("plus",I);continue}if(P&&P.value==="("||r.regex===!1){Ee({type:"plus",value:I,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||k.parens>0){Ee({type:"plus",value:I});continue}Ee({type:"plus",value:d});continue}if(I==="@"){if(r.noextglob!==!0&&He()==="("&&He(2)!=="?"){Ee({type:"at",extglob:!0,value:I,output:""});continue}Ee({type:"text",value:I});continue}if(I!=="*"){(I==="$"||I==="^")&&(I=`\\${I}`);let L=pwe.exec(ji());L&&(I+=L[0],k.index+=L[0].length),Ee({type:"text",value:I});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=I,P.output=N,k.backtrack=!0,k.globstar=!0,an(I);continue}let U=ji();if(r.noextglob!==!0&&/^\([^?]/.test(U)){Dh("star",I);continue}if(P.type==="star"){if(r.noglobstar===!0){an(I);continue}let L=P.prev,Ae=L.prev,it=L.type==="slash"||L.type==="bos",Ct=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!it||U[0]&&U[0]!=="/")){Ee({type:"star",value:I,output:""});continue}let nt=k.braces>0&&(L.type==="comma"||L.type==="brace"),ei=Z.length&&(L.type==="pipe"||L.type==="paren");if(!it&&L.type!=="paren"&&!nt&&!ei){Ee({type:"star",value:I,output:""});continue}for(;U.slice(0,3)==="/**";){let ti=t[k.index+4];if(ti&&ti!=="/")break;U=U.slice(3),an("/**",3)}if(L.type==="bos"&&sn()){P.type="globstar",P.value+=I,P.output=R(r),k.output=P.output,k.globstar=!0,an(I);continue}if(L.type==="slash"&&L.prev.type!=="bos"&&!Ct&&sn()){k.output=k.output.slice(0,-(L.output+P.output).length),L.output=`(?:${L.output}`,P.type="globstar",P.output=R(r)+(r.strictSlashes?")":"|$)"),P.value+=I,k.globstar=!0,k.output+=L.output+P.output,an(I);continue}if(L.type==="slash"&&L.prev.type!=="bos"&&U[0]==="/"){let ti=U[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(L.output+P.output).length),L.output=`(?:${L.output}`,P.type="globstar",P.output=`${R(r)}${f}|${f}${ti})`,P.value+=I,k.output+=L.output+P.output,k.globstar=!0,an(I+ut()),Ee({type:"slash",value:"/",output:""});continue}if(L.type==="bos"&&U[0]==="/"){P.type="globstar",P.value+=I,P.output=`(?:^|${f}|${R(r)}${f})`,k.output=P.output,k.globstar=!0,an(I+ut()),Ee({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-P.output.length),P.type="globstar",P.output=R(r),P.value+=I,k.output+=P.output,k.globstar=!0,an(I);continue}let at={type:"star",value:I,output:N};if(r.bash===!0){at.output=".*?",(P.type==="bos"||P.type==="slash")&&(at.output=O+at.output),Ee(at);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){at.output=I,Ee(at);continue}(k.index===k.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(k.output+=g,P.output+=g):r.dot===!0?(k.output+=b,P.output+=b):(k.output+=O,P.output+=O),He()!=="*"&&(k.output+=p,P.output+=p)),Ee(at)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Dc("closing","]"));k.output=Br.escapeLast(k.output,"["),_o("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Dc("closing",")"));k.output=Br.escapeLast(k.output,"("),_o("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Dc("closing","}"));k.output=Br.escapeLast(k.output,"{"),_o("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&Ee({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let U of k.tokens)k.output+=U.output!=null?U.output:U.value,U.suffix&&(k.output+=U.suffix)}return k};WO.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(U_,r.maxLength):U_,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=PV[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=Qd.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let x=O=>O.noglobstar===!0?_:`(${g}(?:(?!${p}${O.dot?c:o}).)*?)`,$=O=>{switch(O){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+x(r);case"**/*":return`(?:${m}${x(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${x(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${x(r)}${s})?${o}${a}${_}`;default:{let A=/^(.*?)\.(\w+)$/.exec(O);if(!A)return;let N=$(A[1]);return N?N+o+A[2]:void 0}}},w=Br.removePrefix(t,b),R=$(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};CV.exports=WO});var MV=v((SQe,jV)=>{"use strict";var Swe=OV(),KO=DV(),NV=Yd(),wwe=Jd(),xwe=t=>t&&typeof t=="object"&&!Array.isArray(t),$t=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>$t(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=xwe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?$t.compileRe(t,e):$t.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=$t(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=$t.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};$t.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?NV.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=$t.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};$t.matchBase=(t,e,r)=>(e instanceof RegExp?e:$t.makeRe(e,r)).test(NV.basename(t));$t.isMatch=(t,e,r)=>$t(e,r)(t);$t.parse=(t,e)=>Array.isArray(t)?t.map(r=>$t.parse(r,e)):KO(t,{...e,fastpaths:!1});$t.scan=(t,e)=>Swe(t,e);$t.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=$t.toRegex(a,e);return n===!0&&(c.state=t),c};$t.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=KO.fastpaths(t,e)),i.output||(i=KO(t,e)),$t.compileRe(i,e,r,n)};$t.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};$t.constants=wwe;jV.exports=$t});var UV=v((wQe,LV)=>{"use strict";var zV=MV(),$we=Yd();function FV(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:$we.isWindows()}),zV(t,e,r)}Object.assign(FV,zV);LV.exports=FV});import{readdir as kwe,readdirSync as Ewe,realpath as Awe,realpathSync as Twe,stat as Owe,statSync as Pwe}from"fs";import{isAbsolute as Iwe,posix as Qs,resolve as Rwe}from"path";import{fileURLToPath as Cwe}from"url";function jwe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&Nwe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Qs.relative(t,n)||".":n=>Qs.relative(t,`${e}/${n}`)||"."}function Fwe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Qs.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function HV(t){var e;let r=Nc.default.scan(t,Lwe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function Gwe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Nc.default.scan(t);return r.isGlob||r.negated}function ef(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function GV(t){return typeof t=="string"?[t]:t??[]}function JO(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=Hwe(o);s=Iwe(s.replace(Wwe,""))?Qs.relative(a,s):Qs.normalize(s);let c=(i=Vwe.exec(s))===null||i===void 0?void 0:i[0],l=HV(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Qs.join(o,...d):o}return s}function Kwe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(JO(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(JO(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(JO(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function Jwe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=Kwe(t,e,n);t.debug&&ef("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(BV,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Nc.default)(i.match,f),m=(0,Nc.default)(i.ignore,f),h=jwe(i.match,f),g=qV(r,d,o),b=o?g:qV(r,d,!0),_=(w,R)=>{let O=b(R,!0);return O!=="."&&!h(O)||m(O)},x;t.deep!==void 0&&(x=Math.round(t.deep-n.depthOffset));let $=new hV({filters:[a?(w,R)=>{let O=g(w,R),A=p(O)&&!m(O);return A&&ef(`matched ${O}`),A}:(w,R)=>{let O=g(w,R);return p(O)&&!m(O)}],exclude:a?(w,R)=>{let O=_(w,R);return ef(`${O?"skipped":"crawling"} ${R}`),O}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:x,signal:t.signal}).crawl(d);return t.debug&&ef("internal properties:",{...n,root:d}),[$,r!==d&&!o&&Fwe(r,d)]}function Ywe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function Qwe(t){let e={...Xwe,...t};return e.cwd=(e.cwd instanceof URL?Cwe(e.cwd):Rwe(e.cwd)).replace(BV,"/"),e.ignore=GV(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||kwe,readdirSync:e.fs.readdirSync||Ewe,realpath:e.fs.realpath||Awe,realpathSync:e.fs.realpathSync||Twe,stat:e.fs.stat||Owe,statSync:e.fs.statSync||Pwe}),e.debug&&ef("globbing with options:",e),e}function exe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=Dwe(t)||typeof t=="string",i=GV((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=Qwe(n?e:t);return i.length>0?Jwe(o,i):[]}function Fo(t,e){let[r,n]=exe(t,e);return r?Ywe(r.sync(),n):[]}var Nc,Dwe,BV,ZV,Nwe,Mwe,zwe,Lwe,Uwe,qwe,Bwe,Zwe,Hwe,Vwe,Wwe,Xwe,tf=y(()=>{gV();Nc=St(UV(),1),Dwe=Array.isArray,BV=/\\/g,ZV=process.platform==="win32",Nwe=/^(\/?\.\.)+$/;Mwe=/^[A-Z]:\/$/i,zwe=ZV?t=>Mwe.test(t):t=>t==="/";Lwe={parts:!0};Uwe=/(?t.replace(Uwe,"\\$&"),Zwe=t=>t.replace(qwe,"\\$&"),Hwe=ZV?Zwe:Bwe;Vwe=/^(\/?\.\.)+/,Wwe=/\\(?=[()[\]{}!*+?@|])/g;Xwe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as q_,readFileSync as txe,readdirSync as rxe,statSync as VV}from"node:fs";import{join as jc}from"node:path";function nxe(t){let{cwd:e="."}=t,r,n;try{let c=se(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=fi(e,n),o=[],{layers:s,forbiddenImports:a}=YO(r);return s.size>0&&(ixe(e,i,s,o),oxe(e,i,s,o)),a.length>0&&sxe(e,i,a,o),o}function YO(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function ixe(t,e,r,n){let i=e.mainRoot,o=jc(t,i);if(q_(o))for(let s of rxe(o)){let a=jc(o,s);VV(a).isDirectory()&&(r.has(s)||n.push({detector:B_,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function oxe(t,e,r,n){let i=e.mainRoot,o=jc(t,i);if(q_(o))for(let s of r){let a=jc(o,s);q_(a)&&VV(a).isDirectory()||n.push({detector:B_,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function sxe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=jc(t,i,s.from);if(!q_(a))continue;let c=Fo([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=jc(a,l),d;try{d=txe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];axe(p,s.to,e.importStyle)&&n.push({detector:B_,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function axe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var B_,WV,XO=y(()=>{"use strict";tf();Tt();Cc();B_="ARCHITECTURE_FROM_SPEC";WV={name:B_,run:nxe}});import{existsSync as cxe,readFileSync as lxe}from"node:fs";import{join as uxe}from"node:path";function dxe(t){let{cwd:e="."}=t,r=uxe(e,"spec/capabilities.yaml");if(!cxe(r))return[];let n;try{let c=lxe(r,"utf8"),l=KV.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=se(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:Z_,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:Z_,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:Z_,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var KV,Z_,JV,YV=y(()=>{"use strict";KV=St(tr(),1);Tt();Z_="CAPABILITIES_FEATURE_MAPPING";JV={name:Z_,run:dxe}});import{existsSync as fxe,readFileSync as pxe}from"node:fs";import{join as mxe}from"node:path";function hxe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function gxe(t){let{cwd:e="."}=t;return _e(e,QO,r=>yxe(r,e))}function yxe(t,e){let r=fi(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=mxe(e,o);if(!fxe(s))continue;let a=pxe(s,"utf8");hxe(a)||n.push({detector:QO,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var QO,XV,QV=y(()=>{"use strict";Cc();xt();QO="CONVENTION_DRIFT";XV={name:QO,run:gxe}});import{existsSync as eP,readFileSync as eW}from"node:fs";import{join as H_}from"node:path";function _xe(t){return JSON.parse(t).total?.lines?.pct??0}function tW(t){let e=/eP(H_(c.dir,d)));if(!l){s.push(c.path);continue}let u=tW(eW(H_(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:Ji,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=rW(n,i);return a0?[{detector:Ji,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function Sxe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let s=bxe(e,t.focusModules);if(s)return s}let r=fi(e),n=dt(e).language==="kotlin"?PO.find(s=>eP(H_(e,s)))??F9(e):r.coverageSummary,i=H_(e,n);if(!eP(i))return[{detector:Ji,severity:"info",message:`${n} not present \u2014 run stage_2.2 first`}];let o;try{let s=eW(i,"utf8");o=r.coverageFormat==="jacoco-xml"?vxe(s):_xe(s)}catch(s){return[{detector:Ji,severity:"warn",message:`${n} unparseable: ${s.message}`}]}return o===null?[{detector:Ji,severity:"warn",message:`${n} contained no line-coverage counter`}]:o>=G_?[]:[{detector:Ji,severity:"warn",message:`line coverage ${o.toFixed(1)}% < floor ${G_}%`}]}var Ji,G_,nW,iW=y(()=>{"use strict";R_();Cc();O_();fn();Ji="COVERAGE_DROP",G_=70;nW={name:Ji,run:Sxe}});import{existsSync as wxe}from"node:fs";import{join as xxe}from"node:path";function $xe(t){let{cwd:e="."}=t;return _e(e,V_,r=>kxe(r,e))}function kxe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?wxe(xxe(e,r.path))?[]:[{detector:V_,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:V_,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var V_,oW,sW=y(()=>{"use strict";xt();V_="DELIVERABLE_INTEGRITY";oW={name:V_,run:$xe}});function Exe(t){let e=(t.features??[]).filter(i=>i.status==="done");return e.length===0?[]:!t.project?.deliverable?[]:(t.project?.smoke??[]).length>0?[]:[{detector:tP,severity:"warn",path:"spec.yaml",message:`${e.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function Axe(t){let{cwd:e="."}=t;return _e(e,tP,r=>Exe(r))}var tP,aW,cW=y(()=>{"use strict";xt();tP="SMOKE_PROBE_DEMAND";aW={name:tP,run:Axe}});function Txe(t){let{cwd:e="."}=t;return _e(e,W_,r=>Oxe(r,e))}function Oxe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=dc(e);if(n===null)return[{detector:W_,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=n.get(o.id),a=$d(e,o.modules??[]);s!==a&&i.push({detector:W_,severity:"warn",path:"spec/attestation.yaml",message:s===void 0?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var W_,lW,uW=y(()=>{"use strict";kd();xt();W_="STALE_ATTESTATION";lW={name:W_,run:Txe}});function Pxe(t){let{cwd:e="."}=t,r;try{r=se(e)}catch{return[]}return Ixe(r)}function Ixe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:dW,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var dW,fW,pW=y(()=>{"use strict";Tt();dW="DEPENDENCY_CYCLE";fW={name:dW,run:Pxe}});import{appendFileSync as Rxe,existsSync as mW,mkdirSync as Cxe,readFileSync as Dxe}from"node:fs";import{dirname as Nxe,join as jxe}from"node:path";function hW(t){return jxe(t,Mxe,zxe)}function gW(t){return rP.add(t),()=>rP.delete(t)}function ea(t,e){let r=hW(t),n=Nxe(r);mW(n)||Cxe(n,{recursive:!0}),Rxe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of rP)try{i(t,e)}catch{}}function mn(t){let e=hW(t);if(!mW(e))return[];let r=Dxe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var Mxe,zxe,rP,Mn=y(()=>{"use strict";Mxe=".cladding",zxe="audit.log.jsonl";rP=new Set});import{existsSync as Fxe}from"node:fs";import{join as Lxe}from"node:path";function Uxe(t){let{cwd:e="."}=t,r=mn(e);if(r.length===0)return[{detector:nP,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(Fxe(Lxe(e,i.artifact))||n.push({detector:nP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var nP,yW,_W=y(()=>{"use strict";Mn();nP="EVIDENCE_MISMATCH";yW={name:nP,run:Uxe}});import{existsSync as qxe,readFileSync as Bxe}from"node:fs";import{join as Zxe}from"node:path";function Hxe(t){let e=Zxe(t,wW);if(!qxe(e))return null;try{let n=((0,SW.parse)(Bxe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*bW(t,e){for(let r of t??[])r.startsWith(vW)&&(yield{ref:r,name:r.slice(vW.length),field:e})}function Gxe(t){let{cwd:e="."}=t,r=Hxe(e);if(r===null)return[];let n;try{n=se(e)}catch(o){return[{detector:iP,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...bW(s.evidence_refs,"evidence_refs"),...bW(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:iP,severity:"warn",path:wW,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var SW,iP,vW,wW,xW,$W=y(()=>{"use strict";SW=St(tr(),1);Tt();iP="FIXTURE_REFERENCE_INVALID",vW="fixture:",wW="conformance/fixtures.yaml";xW={name:iP,run:Gxe}});function Vxe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:K_,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Xe(n.cmd,[...n.args],{cwd:e,reject:!1});return Wd(i)?[{detector:K_,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:D_(i,K_,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var K_,J_,oP=y(()=>{"use strict";kr();fn();pn();K_="HARDCODED_SECRET";J_={name:K_,run:Vxe}});import{existsSync as Mc,readFileSync as sP}from"node:fs";import{join as ta}from"node:path";function Wxe(t){return Fo(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec)\.ts$/.test(r)).length}function rf(t){if(!Mc(t))return null;try{return JSON.parse(sP(t,"utf8"))}catch{return null}}function Kxe(t,e){let r=ta(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(sP(r,"utf8"))}catch(c){e.push({detector:Yi,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:Yi,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=Wxe(t);s!==a&&e.push({detector:Yi,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function Jxe(t,e){for(let r of kW){let n=ta(t,r.path);if(!Mc(n))continue;let i=rf(n);if(!i){e.push({detector:Yi,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:Yi,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function Yxe(t,e){let r=rf(ta(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of kW){let s=ta(t,o.path);if(!Mc(s))continue;let a=rf(s);a?.version&&a.version!==n&&e.push({detector:Yi,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=ta(t,".claude-plugin","marketplace.json");if(Mc(i)){let o=rf(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Yi,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function Xxe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function Qxe(t,e){let r=ta(t,"src","cli","clad.ts"),n=ta(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Mc(r)||!Mc(n))return;let i=Xxe(sP(r,"utf8"));if(i.length===0)return;let s=rf(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:Yi,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function e$e(t){let{cwd:e="."}=t,r=[];return Kxe(e,r),Qxe(e,r),Jxe(e,r),Yxe(e,r),r}var Yi,kW,EW,AW=y(()=>{"use strict";tf();Yi="HARNESS_INTEGRITY",kW=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];EW={name:Yi,run:e$e}});import{existsSync as t$e,readFileSync as r$e}from"node:fs";import{join as n$e}from"node:path";function o$e(t){let{cwd:e="."}=t;return _e(e,Y_,r=>c$e(r,e))}function s$e(){return i$e}function a$e(t){let e=n$e(t,"spec/capabilities.yaml");if(!t$e(e))return!1;try{let r=TW.default.parse(r$e(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function c$e(t,e){let r=t.features.length;if(r{"use strict";TW=St(tr(),1);xt();Y_="HOLLOW_GOVERNANCE",i$e=8;OW={name:Y_,run:o$e}});function l$e(t){let{cwd:e="."}=t,r;try{r=se(e)}catch{return[]}let n=[];return IW(r.features.map(i=>i.id),"feature","spec/features/",n),IW((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function IW(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:RW,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var RW,CW,DW=y(()=>{"use strict";Tt();RW="ID_COLLISION";CW={name:RW,run:l$e}});import{existsSync as nf,readFileSync as aP,readdirSync as cP,statSync as u$e,writeFileSync as jW}from"node:fs";import{join as Xi}from"node:path";function NW(t){if(!nf(t))return 0;try{return cP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function d$e(t){if(!nf(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=cP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Xi(n,o),a;try{a=u$e(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function f$e(t){let e=Xi(t,"spec","capabilities.yaml");if(!nf(e))return 0;try{let r=X_.default.parse(aP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function Lo(t="."){let e=NW(Xi(t,"spec","features")),r=NW(Xi(t,"spec","scenarios")),n=f$e(t),i=d$e(Xi(t,"tests")),o=new Date().toISOString().slice(0,10);return{features:e,scenarios:r,capabilities:n,test_files:i,last_synced:o}}function zc(t,e){let r=Xi(t,"spec.yaml");if(!nf(r))return;let n=aP(r,"utf8"),i=p$e(n,e);i!==n&&jW(r,i)}function p$e(t,e){let r=t.includes(`\r `)?`\r `:` `,n=t.split(/\r?\n/),i=n.findIndex(d=>/^inventory:\s*$/.test(d)),o=["# Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand.","inventory:",` features: ${e.features??0}`,` scenarios: ${e.scenarios??0}`,` capabilities: ${e.capabilities??0}`,` test_files: ${e.test_files??0}`,` last_synced: ${JSON.stringify(e.last_synced??"")}`],s=d=>r===`\r @@ -249,18 +249,18 @@ ${o.join(` `)}let a=i;a>0&&/Auto-maintained by `clad sync`/.test(n[a-1])&&(a-=1);let c=i+1;for(;ci+1);)c++;let l=n.slice(0,a),u=n.slice(c);for(;l.length>0&&l[l.length-1].trim()==="";)l.pop();return l.push(""),s([...l,...o,"",...u.filter((d,f)=>!(f===0&&d.trim()===""))].join(` `).replace(/\n{3,}/g,` -`))}function ra(t="."){let e=Xi(t,"spec","features");if(!tf(e))return!1;let r=[];for(let i of sP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,K_.parse)(oP(Xi(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` +`))}function ra(t="."){let e=Xi(t,"spec","features");if(!nf(e))return!1;let r=[];for(let i of cP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,X_.parse)(aP(Xi(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` `)+` -`;return CW(Xi(t,"spec","index.yaml"),n,"utf8"),!0}var K_,rf=y(()=>{"use strict";K_=St(tr(),1)});import{existsSync as DW,readFileSync as NW,readdirSync as t$e}from"node:fs";import{join as aP}from"node:path";function r$e(t){let{cwd:e="."}=t,r;try{r=se(e)}catch{return[]}let n=Lo(e),i=r.inventory;if(!i){let s=jW.filter(([c])=>(n[c]??0)>0);if(s.length===0)return cP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...cP(e),{detector:nf,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of jW){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:nf,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...cP(e)),o}function cP(t){let e=aP(t,"spec","index.yaml"),r=aP(t,"spec","features");if(!DW(e)||!DW(r))return[];let n=new Map;try{for(let l of NW(e,"utf8").split(` -`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of t$e(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=NW(aP(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:nf,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:nf,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var nf,jW,MW,zW=y(()=>{"use strict";rf();At();nf="INVENTORY_DRIFT",jW=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];MW={name:nf,run:r$e}});import{existsSync as n$e,readFileSync as i$e}from"node:fs";import{join as o$e}from"node:path";function a$e(t){let{cwd:e="."}=t,r=o$e(e,"src","spec","schema.json"),n=[];if(n$e(r)){let i;try{i=JSON.parse(i$e(r,"utf8"))}catch(o){n.push({detector:of,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of s$e)i.required?.includes(o)||n.push({detector:of,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:of,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=se(e);i.schema!==FW&&n.push({detector:of,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${FW}'`})}catch{}return n}var of,s$e,FW,LW,UW=y(()=>{"use strict";At();of="META_INTEGRITY",s$e=["schema","project","features"],FW="0.1";LW={name:of,run:a$e}});function c$e(t){let{cwd:e="."}=t,r;try{r=se(e)}catch{return[]}let n=[];return qW(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),qW((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function qW(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:BW,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var BW,ZW,HW=y(()=>{"use strict";At();BW="SLUG_CONFLICT";ZW={name:BW,run:c$e}});import{existsSync as l$e}from"node:fs";import{join as u$e}from"node:path";function d$e(t){let{cwd:e="."}=t;return xe(e,lP,r=>f$e(r,e))}function f$e(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=u$e(e,i);l$e(o)||r.push({detector:lP,severity:"error",path:i,message:`feature ${n.id} declares module '${i}' but the file does not exist`})}return r}var lP,GW,VW=y(()=>{"use strict";Ot();lP="MISSING_IMPLEMENTATION";GW={name:lP,run:d$e}});function p$e(t){let{cwd:e="."}=t;return xe(e,uP,m$e)}function m$e(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:uP,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var uP,WW,KW=y(()=>{"use strict";Ot();uP="MISSING_TESTS";WW={name:uP,run:p$e}});import{existsSync as h$e,readFileSync as g$e}from"node:fs";import{join as JW}from"node:path";function YW(t){if(h$e(t))try{return JSON.parse(g$e(t,"utf8"))}catch{return}}function b$e(t){let{cwd:e="."}=t,r=YW(JW(e,y$e)),n=YW(JW(e,_$e));if(!r||!n)return[{detector:dP,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>v$e&&i.push({detector:dP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var dP,y$e,_$e,v$e,XW,QW=y(()=>{"use strict";dP="PERFORMANCE_DRIFT",y$e="perf/baseline.json",_$e="perf/current.json",v$e=10;XW={name:dP,run:b$e}});import{existsSync as S$e}from"node:fs";import{join as w$e}from"node:path";function $$e(t){let{cwd:e="."}=t;return xe(e,fP,r=>A$e(r,e))}function k$e(){return x$e}function E$e(t,e){return(t.modules??[]).some(r=>S$e(w$e(e,r)))}function A$e(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||E$e(s,e)||r.push(s.id);let n=k$e();if(r.length<=n)return[];let i=r.slice(0,e3).join(", "),o=r.length>e3?", \u2026":"";return[{detector:fP,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var fP,x$e,e3,t3,r3=y(()=>{"use strict";Ot();fP="PLANNED_BACKLOG",x$e=5,e3=8;t3={name:fP,run:$$e}});import{existsSync as O$e,readFileSync as T$e}from"node:fs";import{join as P$e}from"node:path";function C$e(t){let{cwd:e="."}=t;return xe(e,pP,r=>N$e(r,e))}function D$e(){return I$e}function N$e(t,e){if(t.features.lengthn.includes(i))?[{detector:pP,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Refine it with \`clad refine\` or by hand.`}]:[]}var pP,I$e,R$e,n3,i3=y(()=>{"use strict";Ot();pP="PROJECT_CONTEXT_DRIFT",I$e=8,R$e=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];n3={name:pP,run:C$e}});function o3(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:J_,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function j$e(t){let{cwd:e="."}=t;return xe(e,J_,M$e)}function M$e(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...o3(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:J_,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...o3(e,n.features,`scenario ${n.id}.features`));return r}var J_,s3,a3=y(()=>{"use strict";Ot();J_="REFERENCE_INTEGRITY";s3={name:J_,run:j$e}});function F$e(t){let{cwd:e="."}=t;return xe(e,sf,r=>U$e(r))}function L$e(){return z$e}function U$e(t){let e=[],r=t.features.length,n=t.scenarios??[];r>=L$e()&&n.length===0&&e.push({detector:sf,severity:"warn",path:"spec/scenarios/",message:`${r} features but no scenarios declared \u2014 cross-feature user-journey flows are not captured. Author at least one with \`clad_create_scenario\`.`});for(let o of n)(o.features??[]).length===0&&e.push({detector:sf,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let i=new Map(t.features.filter(o=>typeof o.slug=="string"&&o.slug.length>0).map(o=>[o.slug,o.id]));for(let o of n){if(!o.flow)continue;let s=new Set(o.features??[]),a=new Map;for(let c of o.flow.matchAll(/\(([^)]+)\)/g))for(let l of c[1].split(/[,/·]/)){let u=l.trim(),d=i.get(u);d&&!s.has(d)&&a.set(u,d)}if(a.size>0){let c=[...a].map(([l,u])=>`${l} (${u})`).join(", ");e.push({detector:sf,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} flow references ${c} but features[] does not bind ${a.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var sf,z$e,c3,l3=y(()=>{"use strict";Ot();sf="SCENARIO_COVERAGE",z$e=8;c3={name:sf,run:F$e}});import{createHash as q$e}from"node:crypto";function B$e(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function af(t,e=0){if(t.oracle_policy){let r=t.oracle_policy;return{mandateActive:!0,reportOnly:!1,exhaustive:!1,alwaysEars:new Set(r.always_ears??u3),sample:B$e(r.sample??0)}}return t.require_oracles===!0?{mandateActive:!0,reportOnly:!1,exhaustive:!0,alwaysEars:new Set,sample:1}:t.require_oracles===void 0&&e>=8?{mandateActive:!0,reportOnly:!0,exhaustive:!1,alwaysEars:new Set(u3),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function cf(t){return(t.features??[]).filter(e=>e.status==="done").length}function Z$e(t,e){return e<=0?!1:e>=1?!0:parseInt(q$e("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var u3,Y_=y(()=>{"use strict";u3=["unwanted"]});import{existsSync as H$e,readdirSync as G$e}from"node:fs";import{join as f3}from"node:path";import p3 from"node:process";function V$e(t){let e=!1,r=n=>{for(let i of G$e(n,{withFileTypes:!0})){if(e)return;let o=f3(n,i.name);i.isDirectory()?r(o):(/\.(test|spec)\.[cm]?[jt]sx?$/.test(i.name)||/_test\.py$/.test(i.name))&&(e=!0)}};try{r(t)}catch{}return e}function mP(t={}){let{cwd:e="."}=t,r=f3(e,Uo);if(!H$e(r)||!V$e(r))return{stage:X_,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${Uo}/ \u2014 skipped`};let n=dt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:X_,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=Xe(i.cmd,[...i.args,Uo],{cwd:e,reject:!1}),s=jt(X_,i.cmd,o);return s||rr(X_,o)}var X_,Uo,W$e,hP=y(()=>{"use strict";kr();fn();pn();X_="stage_2.3",Uo="tests/oracle";W$e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${p3.argv[1]}`;if(W$e){let t=mP();console.log(JSON.stringify(t)),p3.exit(t.exitCode)}});import{existsSync as K$e}from"node:fs";import{join as J$e}from"node:path";function Y$e(t){let{cwd:e="."}=t;return xe(e,zn,r=>X$e(r,e))}function X$e(t,e){let r=[],n=af(t.project,cf(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?mn(e):[],s=o.filter(l=>l.kind==="oracle"),a=new Set(["agent:developer","agent:specialists"]),c=l=>o.find(u=>u.featureId===l&&a.has(u.stage))?.identity.name;for(let l of t.features)if(l.status==="done")for(let u of l.acceptance_criteria??[]){let d=u.oracle_refs??[];if(lf(n,l.id,u)&&d.length===0){let f=n.exhaustive?"project.require_oracles is set":u.ears&&n.alwaysEars.has(u.ears)?`oracle_policy.always_ears includes '${u.ears}'`:"selected by oracle_policy.sample";r.push({detector:zn,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${Uo}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!K$e(J$e(e,f))){r.push({detector:zn,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${Uo}/`)||r.push({detector:zn,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${Uo}/ \u2014 stage_2.3 only runs ${Uo}/, so this oracle will not execute`}),!n.mandateActive)continue;let p=s.find(g=>g.featureId===l.id&&g.acId===u.id&&g.artifact===f);if(!p){r.push({detector:zn,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' has no authoring-provenance record \u2014 author it via 'clad oracle' (or clad_author_oracle) so impl-blindness can be verified`});continue}let m=c(l.id);m&&p.identity.name===m?r.push({detector:zn,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:zn,severity:"info",message:`${l.id}.${u.id} oracle author\u2260implementer not verified \u2014 no implementer identity recorded (no clad drive history to compare)`});let h=(p.readManifest??[]).filter(g=>(l.modules??[]).includes(g));h.length>0&&r.push({detector:zn,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: author read implementation file(s) the feature owns (${h.join(", ")})`}),p.blind===!1&&r.push({detector:zn,severity:"info",message:`${l.id}.${u.id} oracle '${f}' provenance is self-reported (host-protocol), not cladding-controlled \u2014 manifest checked, blindness unproven`})}}if(n.mandateActive&&!n.exhaustive){let l=t.features.filter(u=>u.status==="done").flatMap(u=>u.acceptance_criteria??[]).filter(u=>!u.ears).length;l>0&&r.push({detector:zn,severity:"info",message:`${l} done AC(s) carry no EARS tag and are invisible to the risk-weighted oracle mandate \u2014 tag them (ubiquitous/event/state/optional/unwanted) for the mandate to mean anything.`})}return r}var zn,m3,h3=y(()=>{"use strict";Mn();Y_();hP();Ot();zn="SPEC_CONFORMANCE";m3={name:zn,run:Y$e}});function Q$e(t){let{cwd:e="."}=t,r=mn(e);if(r.length===0)return[{detector:gP,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=Date.now(),i=[];for(let o of r){let s=Date.parse(o.identity.timestamp);if(Number.isNaN(s))continue;let a=(n-s)/(1e3*60*60*24);a>g3&&i.push({detector:gP,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${g3})`})}return i}var gP,g3,y3,_3=y(()=>{"use strict";Mn();gP="STALE_EVIDENCE",g3=90;y3={name:gP,run:Q$e}});import{existsSync as v3}from"node:fs";import{join as b3}from"node:path";function e0e(t){let{cwd:e="."}=t;return xe(e,zc,r=>t0e(r,e))}function t0e(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:zc,severity:"warn",message:`feature ${n.id} has archived_at but status='${n.status}' (expected 'archived')`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`archived_at already set but status is '${n.status}'`}}}),n.superseded_by&&!n.archived_at&&r.push({detector:zc,severity:"warn",message:`feature ${n.id} has superseded_by but no archived_at`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`superseded by ${n.superseded_by} but missing archived_at`}}}),n.status==="archived"){let i=(n.modules??[]).filter(o=>v3(b3(e,o)));i.length>0&&r.push({detector:zc,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}(n.status==="planned"||n.status==="in_progress")&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>v3(b3(e,i)))&&r.push({detector:zc,severity:"warn",message:`feature ${n.id} (status='${n.status}') declares ${n.modules?.length??0} module(s) but none exist on disk \u2014 consider archiving`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:"all declared modules vanished from disk"}}})}return r}var zc,Q_,yP=y(()=>{"use strict";Ot();zc="STALE_SPECIFICATION";Q_={name:zc,run:e0e}});import{existsSync as S3,statSync as w3}from"node:fs";import{join as x3}from"node:path";function n0e(t,e){let r=0;for(let n of e){let i=x3(t,n);if(!S3(i))continue;let o=w3(i).mtimeMs;o>r&&(r=o)}return r}function i0e(t){let{cwd:e="."}=t;return xe(e,_P,r=>o0e(r,e))}function o0e(t,e){let r=fi(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=n0e(e,n);if(i===0)return[];let o=Fo([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=x3(e,a);if(!S3(c))continue;let l=w3(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>r0e&&s.push({detector:_P,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var _P,r0e,$3,k3=y(()=>{"use strict";Qd();Rc();Ot();_P="STALE_TESTS",r0e=30;$3={name:_P,run:i0e}});import{existsSync as s0e}from"node:fs";import{join as a0e}from"node:path";function c0e(t){let{cwd:e="."}=t;return xe(e,uf,r=>l0e(r,e))}function l0e(t,e){let r=[];for(let n of t.features){let i=n.modules??[],o=n.acceptance_criteria??[];if(n.status==="done"&&i.length===0&&o.length===0){r.push({detector:uf,severity:"error",message:`feature ${n.id} status='done' but declares no modules and no acceptance_criteria \u2014 nothing to verify (hollow completion)`});continue}if(i.length===0)continue;let s=i.filter(a=>!s0e(a0e(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:uf,severity:"error",message:`feature ${n.id} status='done' but ${s.length}/${i.length} module(s) missing: ${s.join(", ")}`}):n.status==="in_progress"&&s.length===i.length&&r.push({detector:uf,severity:"warn",message:`feature ${n.id} status='in_progress' but every declared module is missing \u2014 likely a stale start`}))}return r}var uf,E3,A3=y(()=>{"use strict";Ot();uf="STATUS_DRIFT";E3={name:uf,run:c0e}});function u0e(t){let{cwd:e="."}=t;return xe(e,ev,r=>d0e(r,e))}function d0e(t,e){let r=dt(e).language;return r==="unknown"?[{detector:ev,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:ev,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var ev,O3,T3=y(()=>{"use strict";fn();Ot();ev="TECH_STACK_MISMATCH";O3={name:ev,run:u0e}});function h0e(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function g0e(t){let{cwd:e="."}=t;return xe(e,vP,r=>y0e(r,e))}function y0e(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=Fo([...h0e(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:vP,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var vP,P3,f0e,p0e,m0e,I3,R3=y(()=>{"use strict";Qd();JT();Ot();vP="UNMAPPED_ARTIFACT",P3=["src/stages/**/*.ts","src/spec/**/*.ts"],f0e={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},p0e={kotlin:"src/main/kotlin"},m0e=8;I3={name:vP,run:g0e}});import{existsSync as C3}from"node:fs";import{join as D3}from"node:path";function v0e(t){return _0e.some(e=>t.startsWith(e))}function b0e(t){let{cwd:e="."}=t;return xe(e,bP,r=>S0e(r,e))}function S0e(t,e){let r=[];for(let n of t.features)if(n.status==="done")for(let i of n.acceptance_criteria??[])for(let o of i.test_refs??[]){if(v0e(o))continue;let s=o.split("#",1)[0];C3(D3(e,o))||s&&C3(D3(e,s))||r.push({detector:bP,severity:"error",path:o,message:`${n.id}.${i.id} test_ref '${o}' resolves to nothing on disk \u2014 a test_ref must be a real file path (e.g. 'tests/x.test.ts', optionally with a '#' anchor) or a 'self-dogfood: +`:"";return` + + + + +cladding \xB7 knowledge graph + + + +
+ +
+ +
+
drag = orbit \xB7 scroll = zoom \xB7 click node = focus \xB7 hover = details
+ +${o} + + +`}LI();iP();YI();QI();nP();zI();uP();dP();pP();hP();Cp();var gNe=[gv,Ov,hv,Tv,_v,Sv,uv,Ev,kv,lv],yNe=/\bF-(?:\d{3,}|[a-f0-9]{6,8})\b/;function _Ne(t,e){if(t.path){let n=t.path.split("#")[0].trim();for(let i of[Fe.module(n),Fe.test(n),Fe.doc(n)])if(e.has(i))return i}let r=yNe.exec(t.message??"");return r&&e.has(Fe.feature(r[0]))?Fe.feature(r[0]):null}function KS(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};for(let o of gNe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s){if(a.severity!=="error"&&a.severity!=="warn")continue;let c=_Ne(a,r);if(!c)continue;let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}function oX(t,e=10){let r={};for(let s of t.nodes)r[s.kind]=(r[s.kind]??0)+1;let n={},i=new Map;for(let s of t.edges)n[s.kind]=(n[s.kind]??0)+1,i.set(s.from,(i.get(s.from)??0)+1),i.set(s.to,(i.get(s.to)??0)+1);let o=t.nodes.map(s=>({id:s.id,kind:s.kind,label:s.label,degree:i.get(s.id)??0})).sort((s,a)=>a.degree-s.degree||s.id.localeCompare(a.id)).slice(0,e);return{nodeCount:t.nodes.length,edgeCount:t.edges.length,nodesByKind:r,edgesByKind:n,hubs:o}}function sX(t){let e=n=>Object.keys(n).sort().map(i=>`${i}=${n[i]}`).join(" ");return`${[`nodes: ${t.nodeCount} (${e(t.nodesByKind)})`,`edges: ${t.edgeCount} (${e(t.edgesByKind)})`,"hubs (top by degree):",...t.hubs.map((n,i)=>` ${String(i+1).padStart(2)}. [${n.kind}] ${n.label} \u2014 degree ${n.degree}`)].join(` +`)} +`}lt();No();function aX(t={}){try{let e=t.format??"mermaid",r=J(),n=Ea(r,".");if(t.focus){let o=HS(r,n,t.focus);if(!o){H("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let s=t.depth!==void 0?Number(t.depth):1/0;n=BS(n,o,s)}if(e==="obsidian"){let o=t.out??".cladding/graph",s=rX(n);for(let[a,c]of s){let l=vNe(o,a);eD(rD(l),{recursive:!0}),tD(l,c,"utf8")}H("pass","graph",`wrote ${s.size} note(s) to ${o} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(e==="html"){if(!t.out){H("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let o=WS(n,KS(n,"."));eD(rD(t.out),{recursive:!0}),tD(t.out,o,"utf8"),H("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let i=e==="dot"?tX(n):e==="json"?VS(n):eX(n);t.out?(eD(rD(t.out),{recursive:!0}),tD(t.out,i,"utf8"),H("pass","graph",`wrote ${e} graph to ${t.out}`),process.exit(0)):process.stdout.write(i,()=>process.exit(0))}catch(e){H("fail","graph",e.message),process.exit(1)}}function cX(){try{let t=Ea(J(),".");process.stdout.write(sX(oX(t)),()=>process.exit(0))}catch(t){H("fail","graph",t.message),process.exit(1)}}Cp();import{createServer as bNe}from"node:http";import{existsSync as SNe,watch as wNe}from"node:fs";import{join as xNe}from"node:path";lt();No();function $Ne(t={}){let e=t.cwd??".",r=new Set,n=()=>Ea(J(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh + +`)}catch{r.delete(u)}},o=bNe((u,d)=>{let f=(u.url??"/").split("?")[0];try{if(f==="/graph.json"){d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(VS(n()));return}if(f==="/health.json"){d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(JSON.stringify(KS(n(),e)));return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected + +`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(WS(n()));return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(p){d.headersSent||d.writeHead(500,{"Content-Type":"text/plain"});try{d.end(p.message)}catch{}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=xNe(e,u);if(SNe(d))try{c.push(wNe(d,{recursive:!0},a))}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive + +`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise(u=>{o.listen(t.port??0,"127.0.0.1",()=>{let d=o.address(),f=typeof d=="object"&&d?d.port:t.port??0;u({port:f,broadcast:i,close:()=>new Promise(p=>{s&&clearTimeout(s),clearInterval(l);for(let m of c)try{m.close()}catch{}for(let m of r)try{m.end()}catch{}r.clear(),o.close(()=>p()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function lX(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await $Ne({port:e,cwd:t.cwd??"."});H("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){H("fail","graph",r.message),process.exit(1)}}var kNe=["stage_1.1","stage_2.1","stage_2.3"];function ENe(t){return(t.features??[]).filter(e=>e.status==="done")}function ANe(t,e){let r=ENe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function uX(t,e){let r=[];for(let n of kNe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=ANe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}J_();import dX from"node:process";function TNe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function JS(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=TNe(n,t);i.pass||r.push(i)}return r}Ln();var nD="stage_4.1";function iD(t={}){let{cwd:e="."}=t,r=gn(e);if(r.length===0)return{stage:nD,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=JS(r);if(n.length===0)return{stage:nD,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:nD,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var ONe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dX.argv[1]}`;if(ONe){let t=iD();console.log(JSON.stringify(t)),dX.exit(t.exitCode)}Ar();import fX from"node:process";var YS="stage_1.4";function oD(t={}){let{cwd:e="."}=t,r;try{r=Qe("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:YS,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:YS,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:YS,pass:!0,exitCode:0}:{stage:YS,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var INe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${fX.argv[1]}`;if(INe){let t=oD();console.log(JSON.stringify(t)),fX.exit(t.exitCode)}Ar();Dp();hn();import pX from"node:process";var XS="stage_2.2";function sD(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=ns("coverage",t))}catch(a){return{stage:XS,pass:!1,exitCode:1,stderr:a.message}}if(!r||!n)return{stage:XS,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Qe(r,[...n],{cwd:e,reject:!1}),s=Ft(XS,r,o);return s||nr(XS,o)}var CNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${pX.argv[1]}`;if(CNe){let t=sD();console.log(JSON.stringify(t)),pX.exit(t.exitCode)}Pv();aD();Ar();mn();hn();import hX from"node:process";var ew="stage_3.2";function cD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:ew,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Mc(e,o[o.length-1]))return{stage:ew,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Qe(i,[...o],{cwd:e,reject:!1}),a=Ft(ew,i,s);return a||nr(ew,s)}var NNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hX.argv[1]}`;if(NNe){let t=cD();console.log(JSON.stringify(t)),hX.exit(t.exitCode)}Ar();lt();hn();import{existsSync as jNe}from"node:fs";import{resolve as gX}from"node:path";import yX from"node:process";var Gt="stage_2.4",_X=5e3;function lD(t={}){let{cwd:e="."}=t,r,n=[],i=!1;try{let f=J(e);r=f.project.deliverable,n=f.project.smoke??[],i=f.features.some(p=>p.status==="done")}catch{return{stage:Gt,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return MNe(e,n[0],i);if(!r)return{stage:Gt,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:Gt,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:Gt,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let o=gX(e,r.path);if(!jNe(o))return{stage:Gt,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let s=r.timeout_ms??_X,a;try{a=Qe(o,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:s})}catch(f){a=f}let c=Ft(Gt,r.path,a);if(c)return c;if(a.timedOut)return{stage:Gt,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${s}ms (hung or too slow)`};let l=r.expect_exit??0,u=a.exitCode??1;if(u===l)return{stage:Gt,pass:!0,exitCode:0,disposition:"liveness"};let d=String(a.stderr??"").trim()||String(a.stdout??"").trim();return{stage:Gt,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${u}, expected ${l}${d?` \u2014 ${d.slice(0,200)}`:""}`}}function MNe(t,e,r){if(e.kind==="none")return{stage:Gt,pass:!0,exitCode:0,disposition:"na"};if(!r)return{stage:Gt,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 smoke probe skipped"};let n=e.run??[];if(n.length===0)return{stage:Gt,pass:!1,exitCode:2,stderr:"cli smoke probe has no run argv \u2014 skipped"};let[i,...o]=n,s=i.startsWith(".")||i.startsWith("/")?gX(t,i):i,a=_X,c;try{c=Qe(s,[...o],{cwd:t,reject:!1,timeout:a})}catch(p){c=p}let l=Ft(Gt,i,c);if(l)return l;if(c.timedOut)return{stage:Gt,pass:!1,exitCode:1,stderr:`smoke probe '${n.join(" ")}' timed out after ${a}ms`};let u=e.expect?.exit??0,d=c.exitCode??1;if(d!==u){let p=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:Gt,pass:!1,exitCode:1,disposition:"fail",stderr:`smoke probe exited ${d}, expected ${u}${p?` \u2014 ${p.slice(0,200)}`:""}`}}let f=e.expect?.token;return f?String(c.stdout??"").includes(f)?{stage:Gt,pass:!0,exitCode:0,disposition:"pass"}:{stage:Gt,pass:!1,exitCode:1,disposition:"fail",stderr:`smoke probe ran (exit ${d}) but stdout did not contain the AC token ${JSON.stringify(f)}`}:{stage:Gt,pass:!0,exitCode:0,disposition:"liveness"}}var FNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${yX.argv[1]}`;if(FNe){let t=lD();console.log(JSON.stringify(t)),yX.exit(t.exitCode)}Ar();mn();hn();import vX from"node:process";var tw="stage_3.1";function uD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:tw,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Mc(e,o[o.length-1]))return{stage:tw,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Qe(i,[...o],{cwd:e,reject:!1}),a=Ft(tw,i,s);return a||nr(tw,s)}var zNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vX.argv[1]}`;if(zNe){let t=uD();console.log(JSON.stringify(t)),vX.exit(t.exitCode)}sP();dD();fD();Ar();Dp();hn();import wX from"node:process";var iw="stage_2.1";function pD(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=ns("test",t))}catch(a){return{stage:iw,pass:!1,exitCode:1,stderr:a.message}}if(!r||!n)return{stage:iw,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${i}'`};let o=Qe(r,[...n],{cwd:e,reject:!1}),s=Ft(iw,r,o);return s||nr(iw,o)}var qNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wX.argv[1]}`;if(qNe){let t=pD();console.log(JSON.stringify(t)),wX.exit(t.exitCode)}Ar();mn();hn();import xX from"node:process";var ow="stage_3.3";function mD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:ow,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Mc(e,o[o.length-1]))return{stage:ow,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Qe(i,[...o],{cwd:e,reject:!1}),a=Ft(ow,i,s);return a||nr(ow,s)}var BNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xX.argv[1]}`;if(BNe){let t=mD();console.log(JSON.stringify(t)),xX.exit(t.exitCode)}var HNe=new Set(["fail","pending_env","advisory"]);function Aa(t){return HNe.has(t)}function $X(t){return t.disposition??(t.pass?"pass":t.exitCode===2?"skip":"fail")}function kX(t,e){return Aa(e)?t.disposition?1:t.exitCode:0}cP();gD();_D();pf();vv();var DX=$t(rr(),1);import{existsSync as vD,readFileSync as aje,readdirSync as CX,statSync as cje,writeFileSync as lje}from"node:fs";import{basename as Fp,join as zp,relative as RX}from"node:path";var uje=["self-dogfood:","fixture:","derived:"],NX=/\.(test|spec)\.[jt]sx?$/;function jX(t,e=t,r=[]){let n;try{n=CX(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=zp(e,i);try{cje(o).isDirectory()?jX(t,o,r):NX.test(i)&&r.push(o)}catch{continue}}return r}function MX(t="."){let e=zp(t,"spec","features"),r=zp(t,"tests"),n=[],i=[];if(!vD(e)||!vD(r))return{repaired:n,suggested:i};let o=jX(r),s=new Map;for(let a of o){let c=RX(t,a).split("\\").join("/"),l=s.get(Fp(a))??[];l.push(c),s.set(Fp(a),l)}for(let a of CX(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=zp(e,a),l,u;try{l=aje(c,"utf8"),u=(0,DX.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(uje.some(w=>g.startsWith(w)))continue;let v=g.split("#",1)[0];if(vD(zp(t,v)))continue;let _=s.get(Fp(v))??[];if(_.length!==1)continue;let S=g.replace(v,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>Fp(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>RX(t,h).split("\\").join("/")).find(h=>{let g=Fp(h).replace(NX,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),v=l.match(g);if(!v)continue;let _=v[2]+" ";l=l.replace(g,`$1 ${_}test_refs: -${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&F1e(c,l,"utf8")}return{repaired:n,suggested:i}}kd();import{existsSync as U1e,readFileSync as q1e}from"node:fs";import{join as B1e}from"node:path";function Z1e(t,e){let r=B1e(t,e);if(!U1e(r))return[];let n=[];for(let i of q1e(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function EY(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>Z1e(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function AY(t){let e=[];e.push(`# Spec-conformance oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` -`)}tv();Tt();uc();Mn();kd();var H1e={ALL_FEATURES_DONE:"All work complete.",MAX_ITERATIONS:"Stopped \u2014 reached the iteration limit.",WALL_CLOCK:"Stopped \u2014 exceeded the time budget.",BUDGET_EXCEEDED:"Stopped \u2014 budget exhausted.",BLOCKED_FEATURE:"Stopped \u2014 a feature is blocked by dependencies.",RETRY_THRESHOLD:"Stopped \u2014 a feature failed too many times.",GATE_NO_PROGRESS:"Stopped \u2014 gates are not making progress.",HUMAN_REQUIRED:"Paused \u2014 needs human sign-off.",TRANSPORT_AUTH_FAILED:"Stopped \u2014 agent rejected the credentials. Check your API key.",TRANSPORT_RATE_LIMITED:"Stopped \u2014 agent is rate-limited. Try again after the cooldown.",TRANSPORT_NETWORK:"Stopped \u2014 could not reach the agent over the network.",LLM_UNAVAILABLE:"Stopped \u2014 could not reach the agent.",UNCAUGHT_ERROR:"Stopped \u2014 unexpected error."},G1e={"stage_1.1":"Type","stage_1.2":"Lint","stage_1.3":"Drift","stage_1.4":"Commit","stage_1.5":"Architecture","stage_1.6":"Secret","stage_2.1":"Unit tests","stage_2.2":"Coverage","stage_2.3":"Spec conformance","stage_2.4":"Deliverable smoke","stage_3.1":"Smoke","stage_3.2":"Performance","stage_3.3":"Visual","stage_4.1":"Audit","stage_4.2":"UAT"};function p1(t,e){let r=e.features.find(n=>n.id===t);return r&&r.title?r.title:t}function TY(t,e){let r=H1e[t.class]??"Stopped.",n=V1e(t.detail,e);return n?`${r} ${n}`:r}function PS(t){return G1e[t]??t}function V1e(t,e){return t?t.replace(/\bF-\d{3,}\b/g,r=>{let n=p1(r,e);return n===r?r:`"${n}"`}):""}var OY=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"];function W1e(t,e,r){if(e.startsWith("stage_4")){let n=mn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return mS(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function K1e(t,e,r){let n=t.modules??[];if(t.status!=="done"||n.length===0)return"\xB7";if(e===null)return"-";let i=e.get(t.id);return i===void 0?"!":i===$d(r,n)?"\u2713":"!"}function PY(t,e=".",r={}){let n=r.internal??!1,i=dc(e),o=[...OY.map(l=>n?l.replace("stage_",""):J1e(l)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,c=t.features.map(l=>({featureId:l.id,title:l.title||l.id,cells:[...OY.map(u=>W1e(l,u,e)),K1e(l,i,e)]})).map(l=>{let u=l.cells.join(" ");return n?`${l.featureId.padEnd(12)} ${u} ${l.title}`:`${l.title.padEnd(35).slice(0,35)} ${u}`});return[s,...c].join(` -`)}function J1e(t){return PS(t).slice(0,3)}async function cBe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Roe(),Ioe)),Promise.resolve().then(()=>(Moe(),joe)),Promise.resolve().then(()=>(vf(),WK))]),i=e({cwd:t.cwd});n(i.server);let o=new r;re.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function lBe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await B8({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});for(let o of n.created)X("pass",`created ${o}`);for(let o of n.skipped)X("skip",o);for(let o of n.proposals??[])X("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(X("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){re.stdout.write(` +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&lje(c,l,"utf8")}return{repaired:n,suggested:i}}Cd();import{existsSync as dje,readFileSync as fje}from"node:fs";import{join as pje}from"node:path";function mje(t,e){let r=pje(t,e);if(!dje(r))return[];let n=[];for(let i of fje(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function FX(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>mje(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function zX(t){let e=[];e.push(`# Spec-conformance oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` +`)}wv();lt();No();Ln();Cd();var hje={ALL_FEATURES_DONE:"All work complete.",MAX_ITERATIONS:"Stopped \u2014 reached the iteration limit.",WALL_CLOCK:"Stopped \u2014 exceeded the time budget.",BUDGET_EXCEEDED:"Stopped \u2014 budget exhausted.",BLOCKED_FEATURE:"Stopped \u2014 a feature is blocked by dependencies.",RETRY_THRESHOLD:"Stopped \u2014 a feature failed too many times.",GATE_NO_PROGRESS:"Stopped \u2014 gates are not making progress.",HUMAN_REQUIRED:"Paused \u2014 needs human sign-off.",TRANSPORT_AUTH_FAILED:"Stopped \u2014 agent rejected the credentials. Check your API key.",TRANSPORT_RATE_LIMITED:"Stopped \u2014 agent is rate-limited. Try again after the cooldown.",TRANSPORT_NETWORK:"Stopped \u2014 could not reach the agent over the network.",LLM_UNAVAILABLE:"Stopped \u2014 could not reach the agent.",UNCAUGHT_ERROR:"Stopped \u2014 unexpected error."},gje={"stage_1.1":"Type","stage_1.2":"Lint","stage_1.3":"Drift","stage_1.4":"Commit","stage_1.5":"Architecture","stage_1.6":"Secret","stage_2.1":"Unit tests","stage_2.2":"Coverage","stage_2.3":"Spec conformance","stage_2.4":"Deliverable smoke","stage_3.1":"Smoke","stage_3.2":"Performance","stage_3.3":"Visual","stage_4.1":"Audit","stage_4.2":"UAT"};function bD(t,e){let r=e.features.find(n=>n.id===t);return r&&r.title?r.title:t}function LX(t,e){let r=hje[t.class]??"Stopped.",n=yje(t.detail,e);return n?`${r} ${n}`:r}function fw(t){return gje[t]??t}function yje(t,e){return t?t.replace(/\bF-\d{3,}\b/g,r=>{let n=bD(r,e);return n===r?r:`"${n}"`}):""}var UX=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"];function _je(t,e,r){if(e.startsWith("stage_4")){let n=gn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return JS(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function vje(t,e,r){let n=t.modules??[];if(t.status!=="done"||n.length===0)return"\xB7";if(e===null)return"-";let i=e.get(t.id);return i===void 0?"!":i===Rd(r,n)?"\u2713":"!"}function qX(t,e=".",r={}){let n=r.internal??!1,i=gc(e),o=[...UX.map(l=>n?l.replace("stage_",""):bje(l)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,c=t.features.map(l=>({featureId:l.id,title:l.title||l.id,cells:[...UX.map(u=>_je(l,u,e)),vje(l,i,e)]})).map(l=>{let u=l.cells.join(" ");return n?`${l.featureId.padEnd(12)} ${u} ${l.title}`:`${l.title.padEnd(35).slice(0,35)} ${u}`});return[s,...c].join(` +`)}function bje(t){return fw(t).slice(0,3)}async function RZe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Hse(),Bse)),Promise.resolve().then(()=>(Kse(),Wse)),Promise.resolve().then(()=>(If(),HJ))]),i=e({cwd:t.cwd});n(i.server);let o=new r;K.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function CZe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await zY({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});for(let o of n.created)H("pass",`created ${o}`);for(let o of n.skipped)H("skip",o);for(let o of n.proposals??[])H("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(H("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){K.stdout.write(` \u{1F4A1} \uB2E4\uC74C \uC815\uBCF4\uAC00 \uC788\uC73C\uBA74 \uB354 \uC815\uD655\uD55C \uC2A4\uD399\uC774 \uB429\uB2C8\uB2E4: -`);for(let[o,s]of n.clarifyingQuestions.entries())re.stdout.write(` ${o+1}. ${s} -`);re.stdout.write(` -`)}else r||n.created.some(s=>s==="docs/conventions.md")&&(re.stdout.write(` +`);for(let[o,s]of n.clarifyingQuestions.entries())K.stdout.write(` ${o+1}. ${s} +`);K.stdout.write(` +`)}else r||n.created.some(s=>s==="docs/conventions.md")&&(K.stdout.write(` \u{1F4A1} Tip: \uB354 \uC815\uD655\uD55C \uC2A4\uCE90\uD3F4\uB4DC\uB97C \uC6D0\uD558\uC2DC\uBA74 -`),re.stdout.write(` clad init -`),re.stdout.write(` \uC608: clad init \uACB0\uC81C SaaS for B2B -`),re.stdout.write(` \uAE30\uC874 seeds \uB294 .cladding/scan/*.proposal \uB85C \uBD84\uAE30\uB429\uB2C8\uB2E4. - -`));re.exit(0)}async function uBe(t,e){X("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(cse(),ase)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)X(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),re.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=se(e.cwd??"."),a=n.featuresTouched.map(l=>p1(l,s)),c=`${TY(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;X(i,"run",c),a.length>0&&re.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&X("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),re.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function dBe(t={}){try{let e=se(),r=Lo(".");zc(".",r),ra(".");let n=kY(".");for(let o of n.repaired)X("note","test_refs",`repaired ${o.from} \u2192 ${o.to} (${o.shard})`);for(let o of n.suggested)X("note","test_refs",`suggested ${o.ref} (${o.shard}) \u2014 confirm by removing the 'derived:' prefix`);let i=OS(".");if(i&&X("note","deliverable",`auto-detected entry '${i.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`),t.proposeArchive){let s=nv.run({cwd:"."}).filter(a=>a.suggestion?.action==="propose-archive");if(s.length===0){X("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),re.exit(0);return}for(let a of s){let c=a.suggestion?.args??{},l=String(c.featureId??"?"),u=String(c.reason??a.message);X("note",`propose-archive \xB7 ${l}`,u)}X("pass","sync",`${e.features.length} features \xB7 ${s.length} archive candidate(s)`),re.exit(0);return}X("pass","sync",`${e.features.length} features valid`),re.exit(0)}catch(e){X("fail","sync",e.message),re.exit(1)}}function fBe(t){if(!t){X("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),re.exit(2);return}let e=$S(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";X("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),re.exit(0)}function pBe(t,e={}){if(!t){X("fail","rollback","feature id required (e.g. clad rollback F-001)"),re.exit(2);return}let r=kS(".",t);if(!r){X("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),re.exit(1);return}ES(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";X("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?re.stdout.write(`Run: git checkout ${r.gitHead} -`):re.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),re.exit(0)}async function mBe(t){let e=await ZC({force:t.force,quiet:t.quiet});re.exit(e.errors.length>0?1:0)}async function hBe(){X("note","update","reconciling the current project after the engine upgrade");let t=await mK(".",{wireHosts:async()=>(await ZC({quiet:!0})).errors.length});if(X(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){X("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),re.exit(t.code);return}X("pass","spec",`inventory synced \xB7 ${t.features} features`),X(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),X(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)X("note","deprecated",r);re.stdout.write(` +`),K.stdout.write(` clad init +`),K.stdout.write(` \uC608: clad init \uACB0\uC81C SaaS for B2B +`),K.stdout.write(` \uAE30\uC874 seeds \uB294 .cladding/scan/*.proposal \uB85C \uBD84\uAE30\uB429\uB2C8\uB2E4. + +`));K.exit(0)}async function DZe(t,e){H("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(bae(),vae)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)H(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),K.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=J(e.cwd??"."),a=n.featuresTouched.map(l=>bD(l,s)),c=`${LX(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;H(i,"run",c),a.length>0&&K.stdout.write(`Touched: ${a.join(", ")} +`)}let o=n.stubsCreated.length>0;o&&H("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),K.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function NZe(t={}){try{let e=J(),r=Ho(".");Bc(".",r),aa("."),l3(".");let n=MX(".");for(let o of n.repaired)H("note","test_refs",`repaired ${o.from} \u2192 ${o.to} (${o.shard})`);for(let o of n.suggested)H("note","test_refs",`suggested ${o.ref} (${o.shard}) \u2014 confirm by removing the 'derived:' prefix`);let i=dw(".");if(i&&H("note","deliverable",`auto-detected entry '${i.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`),t.proposeArchive){let s=$v.run({cwd:"."}).filter(a=>a.suggestion?.action==="propose-archive");if(s.length===0){H("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),K.exit(0);return}for(let a of s){let c=a.suggestion?.args??{},l=String(c.featureId??"?"),u=String(c.reason??a.message);H("note",`propose-archive \xB7 ${l}`,u)}H("pass","sync",`${e.features.length} features \xB7 ${s.length} archive candidate(s)`),K.exit(0);return}H("pass","sync",`${e.features.length} features valid`),K.exit(0)}catch(e){H("fail","sync",e.message),K.exit(1)}}function jZe(t){if(!t){H("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),K.exit(2);return}let e=sw(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";H("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),K.exit(0)}function MZe(t,e={}){if(!t){H("fail","rollback","feature id required (e.g. clad rollback F-001)"),K.exit(2);return}let r=aw(".",t);if(!r){H("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),K.exit(1);return}cw(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";H("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?K.stdout.write(`Run: git checkout ${r.gitHead} +`):K.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. +`),K.exit(0)}async function FZe(t){let e=await U1({force:t.force,quiet:t.quiet});K.exit(e.errors.length>0?1:0)}async function zZe(){H("note","update","reconciling the current project after the engine upgrade");let t=await uJ(".",{wireHosts:async()=>(await U1({quiet:!0})).errors.length});if(H(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){H("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),K.exit(t.code);return}H("pass","spec",`inventory synced \xB7 ${t.features} features`),H(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),H(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)H("note","deprecated",r);K.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),wL({tier:"pre-commit",strict:!0}).anyFailed?re.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):X("pass","drift","clean against the stricter detectors"),re.exit(t.code)}var gBe={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function wL(t){let e=t.tier??"all",r=gBe[e];if(!r)return t.json?re.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):X("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0};let n={focusModules:t.focusModules},o=[["stage_1.1",()=>xp(n)],["stage_1.2",()=>wp(n)],["stage_1.3",()=>Qi({...n,strict:t.strict})],["stage_1.4",XC],["stage_1.5",Xs],["stage_1.6",mf],["stage_2.1",()=>s1(n)],["stage_2.2",()=>QC(n)],["stage_2.3",yP],["stage_2.4",r1],["stage_3.1",n1],["stage_3.2",t1],["stage_3.3",a1],["stage_4.1",YC],["stage_4.2",$p]].filter(([u])=>r.includes(u)),s=0,a=!1,c=u=>u==="pass"?"pass":u==="liveness"?"note":u==="na"?"skip":Sa(u)?"fail":"skip",l=[];for(let[u,d]of o){let f=d({}),p=t.internal?u:PS(u),m=fY(f);Sa(m)&&(a=!0,s=Math.max(s,pY(f,m))),l.push({stage:u,label:p,status:m,exitCode:f.exitCode,stderr:f.stderr,findings:f.findings}),t.json||(X(c(m),p),Sa(m)&&SBe(f))}if(t.strict)try{let u=se();for(let d of X8(u,l))s=Math.max(s,1),a=!0,l.push({stage:d.stage,label:d.label,status:"fail",exitCode:1,stderr:d.message}),t.json||X("fail",d.label,d.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let u=l.find(m=>m.stage==="stage_1.3"),d=(u?.findings??[]).filter(m=>m.severity==="error"||m.severity==="warn"),f=u?.status==="fail"&&d.length>0&&d.every(m=>m.detector==="STALE_ATTESTATION"),p=l.every(m=>m.stage==="stage_1.3"||!Sa(m.status));if(f&&p&&u&&(u.status="pass",u.exitCode=0,u.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",a=l.some(m=>Sa(m.status)),s=a?Math.max(1,s):0,t.json||X("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!a)try{s4(".",se())&&(t.json||X("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json?re.stdout.write(`${JSON.stringify({tier:e,worst:s,anyFailed:a,stages:l},null,2)} -`):a&&re.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),qi(".","gate_run",{tier:e,strict:t.strict===!0,worst:s,anyFailed:a}),{worst:s,anyFailed:a}}function yBe(t){try{let e=se(),r=pS(e,t);re.stdout.write(`${JSON.stringify(r,null,2)} -`),re.exit("not_found"in r?1:0)}catch(e){X("fail","context",e.message),re.exit(1)}}function _Be(t){let e;if(t.feature)try{let n=(se().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(X("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),re.exit(1)),e=n.modules}catch(r){X("fail","check",r.message),re.exit(1)}re.exit(wL({...t,focusModules:e}).worst)}function vBe(t){let e=f4(".",t,{checkStages:wL,onIndex:ra});X(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),re.exit(e.code)}function bBe(t,e={}){let r=e.cwd??".",n;try{n=se(r)}catch(o){X("fail","oracle",`spec not loaded: ${o.message}`),re.exit(1);return}if(e.required){t&&re.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=m3(n);if(o.length===0){re.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. -`),re.exit(0);return}let s=o.filter(a=>!a.hasOracle);for(let a of o){let c=a.hasOracle?"\u2713":"\xB7",l=a.hasOracle?"":" \u2190 needs an impl-blind oracle";re.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} -`)}re.stdout.write(` +`),O2({tier:"pre-commit",strict:!0}).anyFailed?K.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):H("pass","drift","clean against the stricter detectors"),K.exit(t.code)}var LZe={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function O2(t){let e=t.tier??"all",r=LZe[e];if(!r)return t.json?K.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):H("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0};let n={focusModules:t.focusModules},o=[["stage_1.1",()=>jp(n)],["stage_1.2",()=>Np(n)],["stage_1.3",()=>ro({...n,strict:t.strict})],["stage_1.4",oD],["stage_1.5",na],["stage_1.6",$f],["stage_2.1",()=>pD(n)],["stage_2.2",()=>sD(n)],["stage_2.3",oP],["stage_2.4",lD],["stage_3.1",uD],["stage_3.2",cD],["stage_3.3",mD],["stage_4.1",iD],["stage_4.2",Mp]].filter(([u])=>r.includes(u)),s=0,a=!1,c=u=>u==="pass"?"pass":u==="liveness"?"note":u==="na"?"skip":Aa(u)?"fail":"skip",l=[];for(let[u,d]of o){let f=d({}),p=t.internal?u:fw(u),m=$X(f);Aa(m)&&(a=!0,s=Math.max(s,kX(f,m))),l.push({stage:u,label:p,status:m,exitCode:f.exitCode,stderr:f.stderr,findings:f.findings}),t.json||(H(c(m),p),Aa(m)&&WZe(f))}if(t.strict)try{let u=J();for(let d of uX(u,l))s=Math.max(s,1),a=!0,l.push({stage:d.stage,label:d.label,status:"fail",exitCode:1,stderr:d.message}),t.json||H("fail",d.label,d.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let u=l.find(m=>m.stage==="stage_1.3"),d=(u?.findings??[]).filter(m=>m.severity==="error"||m.severity==="warn"),f=u?.status==="fail"&&d.length>0&&d.every(m=>m.detector==="STALE_ATTESTATION"),p=l.every(m=>m.stage==="stage_1.3"||!Aa(m.status));if(f&&p&&u&&(u.status="pass",u.exitCode=0,u.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",a=l.some(m=>Aa(m.status)),s=a?Math.max(1,s):0,t.json||H("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!a)try{p6(".",J())&&(t.json||H("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json?K.stdout.write(`${JSON.stringify({tier:e,worst:s,anyFailed:a,stages:l},null,2)} +`):a&&K.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),Zi(".","gate_run",{tier:e,strict:t.strict===!0,worst:s,anyFailed:a}),{worst:s,anyFailed:a}}function UZe(t){try{let e=J(),r=xl(e,t);K.stdout.write(`${JSON.stringify(r,null,2)} +`),K.exit("not_found"in r?1:0)}catch(e){H("fail","context",e.message),K.exit(1)}}function qZe(t,e={}){try{let r=J(),n=e.depth!==void 0?Number(e.depth):void 0,i=gi(r,t,{depth:n});K.stdout.write(`${JSON.stringify(i,null,2)} +`),K.exit("not_found"in i?1:0)}catch(r){H("fail","impact",r.message),K.exit(1)}}function BZe(t={}){try{let e=J(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Iv(e,o=>{try{return wae(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});K.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),K.exit(0)}catch(e){H("fail","infer-deps",e.message),K.exit(1)}}function HZe(t={}){try{let e=J(),n=JY(e,i=>{try{return wae(i,"utf8")}catch{return null}},".");if(t.json)K.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let i=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${n.context.medianSliceTokens} tok vs naive ${n.context.medianNaiveTokens} tok = ${n.context.medianShrinkFactor}x smaller (median)`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`," (deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"];K.stdout.write(`${i.join(` +`)} +`)}K.exit(0)}catch(e){H("fail","measure",e.message),K.exit(1)}}function ZZe(t){let e;if(t.feature)try{let n=(J().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(H("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),K.exit(1)),e=n.modules}catch(r){H("fail","check",r.message),K.exit(1)}K.exit(O2({...t,focusModules:e}).worst)}function GZe(t){let e=v6(".",t,{checkStages:O2,onIndex:aa});H(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),K.exit(e.code)}function VZe(t,e={}){let r=e.cwd??".",n;try{n=J(r)}catch(o){H("fail","oracle",`spec not loaded: ${o.message}`),K.exit(1);return}if(e.required){t&&K.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=p3(n);if(o.length===0){K.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),K.exit(0);return}let s=o.filter(a=>!a.hasOracle);for(let a of o){let c=a.hasOracle?"\u2713":"\xB7",l=a.hasOracle?"":" \u2190 needs an impl-blind oracle";K.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} +`)}K.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),re.exit(s.length>0?1:0);return}if(!t){X("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),re.exit(1);return}let i=EY(n,t,e.ac,r);if(!i||i.acs.length===0){X("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),re.exit(1);return}re.stdout.write(`${AY(i)} -`),re.exit(0)}function SBe(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=i.path?` ${i.path}`:"";re.stdout.write(` [${i.detector}]${o} \u2014 ${lse(i.message,140)} -`)}n.length>3&&re.stdout.write(` \u2026 and ${n.length-3} more finding(s) +`),K.exit(s.length>0?1:0);return}if(!t){H("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),K.exit(1);return}let i=FX(n,t,e.ac,r);if(!i||i.acs.length===0){H("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),K.exit(1);return}K.stdout.write(`${zX(i)} +`),K.exit(0)}function WZe(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=i.path?` ${i.path}`:"";K.stdout.write(` [${i.detector}]${o} \u2014 ${Sae(i.message,140)} +`)}n.length>3&&K.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&re.stdout.write(` ${lse(e.trim(),160)} -`)}}function lse(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function wBe(t){let e=se();re.stdout.write(`${PY(e,".",{internal:t.internal})} -`),re.exit(0)}function xBe(t){let e=yk(t);X("note",`route \u2192 ${e}`,t),re.exit(e==="unknown"?1:0)}var $Be={refine:"clarify",panel:"status",drive:"run"};function kBe(t){let e=t?$Be[t]:void 0;e&&re.stderr.write(`cladding: '${t}' is now '${e}' \u2014 the old verb is removed in 0.7 -`)}function EBe(){let t=new jL;return t.name("clad").description("Reference Ironclad CLI").version("0.6.3"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init \uACB0\uC81C SaaS for B2B`) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").action(lBe),t.command("run [goal]").alias("drive").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(uBe),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(dBe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(mBe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(hBe),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(_Be),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(fBe),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(vBe),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((e,r)=>bBe(e,r)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(pBe),t.command("status").alias("panel").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").action(wBe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(yBe),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").action(e=>e4(e)),t.command("route ").description("Classify a natural-language prompt to a verb").action(xBe),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(aK),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(cBe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").action(l4),t.command("clarify [answer...]").alias("refine").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, e.g. `clad clarify \uBC95\uC778 \uC0AC\uC5C5\uC790\uB9CC`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(K8),t}var ABe=!!globalThis.__CLADDING_BUNDLED,TBe=ABe||import.meta.url===`file://${re.argv[1]}`;TBe&&(kBe(re.argv[2]),EBe().parse());export{$Be as RENAMED_VERBS,gBe as TIER_STAGES,EBe as createProgram,kBe as printVerbDeprecationNotice,_Be as runCheckCommand,wL as runCheckStages,fBe as runCheckpointCommand,yBe as runContextCommand,vBe as runDoneCommand,lBe as runInitCommand,bBe as runOracleCommand,pBe as runRollbackCommand,xBe as runRouteCommand,uBe as runRunCommand,cBe as runServeCommand,mBe as runSetupCommand,wBe as runStatusCommand,dBe as runSyncCommand,hBe as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&K.stdout.write(` ${Sae(e.trim(),160)} +`)}}function Sae(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function KZe(t){let e=J();K.stdout.write(`${qX(e,".",{internal:t.internal})} +`),K.exit(0)}function JZe(t){let e=Qk(t);H("note",`route \u2192 ${e}`,t),K.exit(e==="unknown"?1:0)}var YZe={refine:"clarify",panel:"status",drive:"run"};function XZe(t){let e=t?YZe[t]:void 0;e&&K.stderr.write(`cladding: '${t}' is now '${e}' \u2014 the old verb is removed in 0.7 +`)}function QZe(){let t=new B2;t.name("clad").description("Reference Ironclad CLI").version("0.6.3"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init \uACB0\uC81C SaaS for B2B`) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").action(CZe),t.command("run [goal]").alias("drive").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(DZe),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(NZe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(FZe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(zZe),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(ZZe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(jZe),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(GZe),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>VZe(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(MZe),t.command("status").alias("panel").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").action(KZe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(UZe),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>qZe(r,n)),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>BZe(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full per-feature report as JSON").action(r=>HZe(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>aX(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>cX()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{lX(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").action(r=>a6(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(JZe),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(nJ),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(RZe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").action(g6),t.command("clarify [answer...]").alias("refine").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, e.g. `clad clarify \uBC95\uC778 \uC0AC\uC5C5\uC790\uB9CC`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(ZY),t}var eGe=!!globalThis.__CLADDING_BUNDLED,tGe=eGe||import.meta.url===`file://${K.argv[1]}`;tGe&&(XZe(K.argv[2]),QZe().parse());export{YZe as RENAMED_VERBS,LZe as TIER_STAGES,QZe as createProgram,XZe as printVerbDeprecationNotice,ZZe as runCheckCommand,O2 as runCheckStages,jZe as runCheckpointCommand,UZe as runContextCommand,GZe as runDoneCommand,qZe as runImpactCommand,BZe as runInferDepsCommand,CZe as runInitCommand,HZe as runMeasureCommand,VZe as runOracleCommand,MZe as runRollbackCommand,JZe as runRouteCommand,DZe as runRunCommand,RZe as runServeCommand,FZe as runSetupCommand,KZe as runStatusCommand,NZe as runSyncCommand,zZe as runUpdateCommand}; diff --git a/plugins/codex/skills/developer/SKILL.md b/plugins/codex/skills/developer/SKILL.md index ad9766d3..2dea2636 100644 --- a/plugins/codex/skills/developer/SKILL.md +++ b/plugins/codex/skills/developer/SKILL.md @@ -71,6 +71,15 @@ Before writing code, grep `spec.yaml::project.ai_hints`: - Style / philosophy concern → file for `reviewer`. - Production metric anomaly → file for `observability`. +## Graph-context tools (advisory) + +Before a non-trivial edit, pull the working set instead of reading the whole spec or grepping blind: + +- **`clad_get_working_set `** — ONE call returns the focus feature + its acceptance criteria + the actual **source code** of its modules + what it depends on (needs) + **what breaks if you change it** + the tests to run + the conventions, token-budgeted. Your default orientation for a feature. +- **`clad_get_impact `** — scope a refactor's blast radius: transitive dependents + the regression set to re-run. + +Advisory (no detector enforces it) — but after your edits the hook auto-surfaces the impact (the PostToolUse card), so the blast radius is never invisible. + ## User-facing language (Soft Shell) Any string your code writes to stdout / a log a user reads must use feature titles, never `F-NNN` (or `F-` for v0.3.9+ features); stage names (`Drift`, `UAT`), never `stage_X.Y`. Use `src/ui/softShell.ts` (`featureLabel`, `haltMessage`, `gateLabel`). The audit log keeps the raw ids — those are for replay, not for users. diff --git a/plugins/codex/skills/planner/SKILL.md b/plugins/codex/skills/planner/SKILL.md index 8ca312dd..1433f870 100644 --- a/plugins/codex/skills/planner/SKILL.md +++ b/plugins/codex/skills/planner/SKILL.md @@ -45,6 +45,10 @@ When authoring a new feature or scenario, also check `spec.yaml::project.ai_hint `ai_hints` is the project-scoped SSoT for AI behavior policy and overrides this prompt for the specific project. +## Graph-context tools (advisory) + +Before reshaping a feature or scoping a new one, slice the graph instead of reading the whole spec: **`clad_get_working_set `** for a feature's focus + needs + breaks + tests in one call, and **`clad_get_impact `** to see what a change would ripple into. Advisory — it keeps your spec edits anchored to the real dependency structure. + ## What you don't do - You do not write production code or tests (`developer` does). - You do not pass philosophical judgement (`reviewer` does). diff --git a/scripts/build.mjs b/scripts/build.mjs index d5e284ca..c260e088 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -73,5 +73,26 @@ for (const f of readdirSync('src/agents')) { personaCount++; } +// Bundle the 3D graph viewer (vanilla three.js + jsm addons + the pure stellar/layout +// cores) into ONE offline IIFE asset. `clad graph export --format html` inlines it via +// viewer-shell.ts, so the exported file renders with ZERO network. `three` is a +// devDependency — bundled here at build time, never installed by end users (the shipped +// dist/ already carries the bundle). styles.css is copied alongside (read as text too). +mkdirSync('dist/viewer', {recursive: true}); +await build({ + entryPoints: ['src/graph/viewer/main.ts'], + bundle: true, + platform: 'browser', + target: 'es2020', + format: 'iife', + outfile: 'dist/viewer/app.js', + minify: true, + legalComments: 'none', +}); +copyFileSync('src/graph/viewer/styles.css', 'dist/viewer/styles.css'); +const viewerCount = 2; + chmodSync('dist/clad.js', 0o755); -console.log(`cladding: built dist/clad.js + dist/schema.json + ${personaCount} personas → dist/agents/`); +console.log( + `cladding: built dist/clad.js + dist/schema.json + ${personaCount} personas → dist/agents/ + ${viewerCount} viewer asset(s) → dist/viewer/`, +); diff --git a/spec.yaml b/spec.yaml index e2c46dd1..e9af8430 100644 --- a/spec.yaml +++ b/spec.yaml @@ -13,7 +13,7 @@ project: description: "Reference implementation of the Ironclad harness for AI-coupled software." version: "0.6.3" repository: "https://github.com/qwerfunch/cladding" - intent_summary: "Make AI-coupled development measurably safer and more honest — 38 drift detectors + 4-tier SSoT governance + A/B-measurable cladding-vs-vanilla evaluation." + intent_summary: "Make AI-coupled development measurably safer and more honest — 40 drift detectors + 4-tier SSoT governance + A/B-measurable cladding-vs-vanilla evaluation." deliverable: path: ./bin/clad smoke_args: ["--version"] @@ -43,11 +43,14 @@ project: - when: "Iron Law stage logic + I/O orchestration" prefer: "pure stage core + CLI wrapper (e.g. runDrift → drift.ts CLI entry)" over: "mixed stage runner with embedded process.exit / stdout" + - when: "before a non-trivial edit to a feature or module" + prefer: "slice the working set first — clad_get_working_set (focus + module code + forward needs + backward breaks + tests to run), or clad_get_impact to scope the blast radius" + over: "reading the whole spec by hand or editing blind" # Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand. inventory: - features: 181 + features: 199 scenarios: 2 - capabilities: 5 - test_files: 149 - last_synced: "2026-06-29" + capabilities: 6 + test_files: 170 + last_synced: "2026-07-01" diff --git a/spec/_doc-links.yaml b/spec/_doc-links.yaml new file mode 100644 index 00000000..ed81bc59 --- /dev/null +++ b/spec/_doc-links.yaml @@ -0,0 +1,17 @@ +# Cladding · Tier C — generated doc→spec / doc→doc link index (`clad sync`). Do not edit by hand. +# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution. +schema: "0.1" +docs: + "docs/README.md": + doc_links: ["docs/ssot-model.md", "spec/README.md", "src/agents/README.md"] + "docs/conventions.md": + doc_links: ["docs/code-style.md"] + "docs/glossary.md": + features: [F-1d23a6, F-7ce18e, F-b84c38] + "docs/project-context.md": + features: [F-4db939, F-ba2e05] + doc_links: ["docs/ab-evaluation/README.md", "docs/ssot-model.md", "docs/ssot-testing.md"] + "docs/ssot-audit.md": + features: [F-a4b512, F-f44d1b, F-f6d13e] + "docs/ssot-testing.md": + doc_links: ["docs/ssot-model.md"] diff --git a/spec/architecture.yaml b/spec/architecture.yaml index 2466437e..430ee00e 100644 --- a/spec/architecture.yaml +++ b/spec/architecture.yaml @@ -24,6 +24,7 @@ layers: - oracle - router - ui + - graph - - stages - adapters - - drive @@ -51,6 +52,16 @@ forbidden_imports: to: cli - from: changelog to: serve + # graph (foundation) derives a knowledge graph from the spec — it must stay a + # pure reader importable by cli AND serve without dragging stage runners in. + - from: graph + to: stages + - from: graph + to: drive + - from: graph + to: cli + - from: graph + to: serve - from: stages to: drive - from: stages diff --git a/spec/attestation.yaml b/spec/attestation.yaml index cd44a2ca..30682e08 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -6,19 +6,19 @@ attested: F-001: 1eb56cee6b065fbe F-002: c116a9d32f862ee9 - F-003: 8eac74ade368173f + F-003: c9578f9a6e70dcdf F-004: 791125e674b98fb5 F-005: 70c3b7166f297bff F-006: 488cb6f2d452a286 F-007: d1c159c46d5a454f F-008: 86cb22d725182847 F-009: 80831c8be1440e79 - F-00eb1a: 072b5d8bbd3a62d3 + F-00eb1a: 4dfd6110051f8854 F-010: 049a2581168f569f F-011: efd71e966a937fab F-012: e009b9eb07addd30 F-013: 082bfb079fecf10b - F-0144b9: 0e4a1cbe2378a1cd + F-0144b9: f6844cefd13558a6 F-014: 00bab4a06108f736 F-015: 7152b82df32808d7 F-016: 26a5ad16a7b1be3c @@ -28,6 +28,7 @@ attested: F-020: 2c5f4a94e3e57e9b F-021: 8a1a82a59a1c45c7 F-022: 8f596a1c737f6d42 + F-02343cd1: d784725ede52b89c F-023: 0c14948e5a91bb0f F-024: f67a86816b06f8ee F-025: 187339b684896b8e @@ -41,23 +42,23 @@ attested: F-033: 3177e977ab79eca7 F-034: 848cb1fa18cb21ec F-035: fb4a11bd47de8e4b - F-036: aa3a179718915c1f + F-036: 13bab7557e1ea56e F-037: 7f811c5c8bc0e8e3 F-038: 1338100beadb15a6 F-039: 2e60f3d899b72d7f - F-040: c01ba9f1336b0580 + F-040: 5b5f28dd8cd6116f F-041: cddb50fc41e49066 F-042: d1f661281bb9fb6e F-043: 2c5f4a94e3e57e9b - F-044: c456621089a5b109 + F-044: f1f04e4b5b2d3495 F-045: b494c9a80442ac20 F-046: 4b563fce74b6bb4b - F-047: 9172bb5bf584e5e1 - F-048: 3d87c28993099f01 + F-047: baf5a2dbb9bb5a4b + F-048: 5eb521bf95085326 F-049: 444a75986c1c3430 - F-051: 9ccc567a8f89437f + F-051: e057c85411aef654 F-052: 61e043371b9f7c71 - F-053: b9f8a88e60fd5c6d + F-053: 13a90cd08aec07ae F-054: 5f5d30500bd8cd7f F-055: 157fca55d153df4e F-056: bd6fbdcb028e67f2 @@ -68,118 +69,133 @@ attested: F-061: c16123610e8fe7fc F-062: 0ab83282a7f7b1ef F-063: 76a719993cc71fa8 - F-064: 3c8fea16a4289bcc + F-064: e95fd5542876b020 F-065: e6ed3ef916201947 - F-066: d6c134dbb94025f5 + F-066: 512896be3294c6e4 F-067: 6e6dbd05bf314b56 F-068: 058091774fa65ef8 - F-069: 3f0e74bdc8680a30 + F-069: 052b13a5c674cee2 + F-06dfdad6: d8cc4a26e7dcb40d F-070: e50bb5d3addc7720 F-071: 3183a483a8015d4c F-072: 44e1d39139c816cc - F-073: 83ebc371980602d1 - F-074: 27db161619be249e - F-075: 70fe44939bcbda65 - F-076: ef63ce344fe4a89a - F-077: 129e697604813bc2 + F-073: 58d93b52fab740f0 + F-074: 76e417df25401130 + F-075: 13a6000a97e8bccd + F-076: 648a419ba5188057 + F-077: 45ce19677f61eb01 F-078: 334bf94b687ccedb - F-079: 6ee7fe9680f5730e + F-079: 2c61a0933db45c03 F-080: 1c19da74d32894e6 F-081: 248f9660cfb1b02b F-098d3b: 42d61bf806ce462b - F-09d68b: bb62c8aab14d7ead - F-0ed2db: c6417aa133389b5d + F-09d68b: 499ba028a0e1a853 + F-0ed2db: f94e2f45a16ff99c + F-0f2984d0: c056097ce738905c F-12d740: 84ad71574d306c81 + F-15999130: 894b484b7a93690c + F-16138071: 2fa01b05ac010d3d F-16746b: 2f98a1261b9b1fc2 F-17df0a: 915d13b33258d3fc - F-18e951: df7bd67676e86ef5 - F-1c9166: 59221d71617a91ba - F-1d23a6: 6431b5a84f096b93 + F-18e951: d907c170a230e052 + F-1c9166: c72ece4c25cc4748 + F-1d23a6: 82d3612a46c451f1 F-1edb38: 64283112a3ab96ce - F-24062d: 48f26bb1c77234d2 + F-24062d: 2ed911310532a4d5 F-245bd5: a8372aeb83acc411 + F-2be3e3bb: c056097ce738905c F-2de65d: 84ad71574d306c81 - F-315fd7: 5a555f824e4bc642 + F-315fd7: c3b042c80fa7c187 F-31eeb8: d88a9880d29ae411 - F-32b1e0: 752c6fc6597a1711 - F-3788c2: 0c1ae99c0cd756ab + F-32b1e0: 2c7d1b1bdd1cf09f + F-3788c2: af9778dea8687b29 F-37b4a8: e067655bad681488 - F-3a5339: 0a1979737368613b - F-3b3690: 66c098ef8c25ad29 - F-40327b: 394b4ecbd20ed23c - F-417ff0: 2ed14fe2c70c8509 - F-42af48: d5c989097f3ba811 + F-3a5339: db57c9dd1b83ec01 + F-3b3690: 6a36aad282d36f3a + F-40327b: 8295358f7b813c8a + F-417ff0: 9f36cd13dd95a54f + F-42af48: 7702447a407758a1 F-43d8e3: bbea25941e2b675d - F-4747ef: ae95a19aa0a0311d - F-4db939: 1ee1a30f68e6fb16 + F-4747ef: c255a18b6849d002 + F-4db939: b2c386ca4e18c117 F-50ff43: fac674314685a912 - F-551a1c: d5da7c6d3384c80d - F-56abaa: 2cfc34ff58be51f3 - F-570a3f: d782269396829529 + F-551a1c: 250f2e1c9ada0e65 + F-569f4b37: a550b84ba5fe46eb + F-56abaa: 3f00789377ca5c21 + F-570a3f: 68262e0d3c6138b5 F-59f093: 26735424fba6308c - F-5b9f9f: 9b66ee02892b2c8c + F-5b188856: 92b72281c248eba3 + F-5b9f9f: 227f303511991d2f F-5d3ed2: 9452eac28760fb99 F-5f6b45: 15323c4f5b619de7 + F-64a5c159: 881cc310270363c0 F-65814a: 2136c8b8c94ef535 - F-67d2e9: ca0b7b032b8e045a - F-67e33f: b75ed84e5ec41d29 - F-6d943d: 16c54797409363c1 + F-67d2e9: c7e5fe6bb82556ce + F-67e33f: c599ca55780cd294 + F-6d943d: 67b4d9e0f1436cec F-6f80e7: 0c0e5b71ae22cc26 - F-7076f7: 0104e51794073d4a - F-78b50d: b15718ce8ae8b640 + F-7076f7: 7e819e0d440f3ffe + F-7794a6bc: 5c88878b4cf0d845 + F-77f7ead0: 3f8cd4feeece1abd + F-78b50d: 688e6afe2352a034 F-7afbd4: 18ce48352bee0fce - F-7ce18e: 699b2bbed18d9b07 + F-7ce18e: fbddabff28897bfb F-7fa4a7: 19b7709a0b2202e3 - F-80d19d: 9db68e7621f0d615 - F-836a90: d975e600851e58f5 + F-80d19d: 9b587bc3e90c9012 + F-836a90: 691f4112e7bd8de4 F-8f419e: f3473746f4e252bc - F-904495a5: 3c4ab94f03c49847 - F-9064ff: db581e7d99186ea6 + F-904495a5: df76ea47a5da2c61 + F-9064ff: 96680045c3072a2c F-94dda4: 8dfb0267c45534f9 - F-95a096: c6ca03ea8b16a112 - F-96700032: 8a11572c62fcdfcb - F-99c6e5: ae91823dc74c17d8 - F-9a3b61: 4baa26103a280acc - F-9b643e: 334970c0f773a0f0 - F-9d168287: 8f9a869b35db81b1 + F-95a096: 4c7b844669411617 + F-96250595: 846ab496e40cdd48 + F-96700032: 5ae97b4c82c14acc + F-99c6e5: 8a8724852f1d6059 + F-9a3b61: 786eeefef2d25138 + F-9b643e: 481f62faedad4872 + F-9d168287: 073c7b63978b49e6 F-a04cd9: e65d87671306d305 - F-a4b512: 34ccde833d13ab83 - F-a5228c: b407fc818b113c71 + F-a4b512: d136f2a1bbc4383a + F-a5228c: ecfdaebebaf47498 F-aa7197: 7f561e4f3c902716 - F-ae61c1: 9bfd87053198f4a1 + F-ae61c1: 7c3c8622e5375754 F-aee1da: a6d7525a6c547877 F-aee61f: e009b9eb07addd30 + F-af45042a: 9c61ca116a28cbb6 F-af96b1: e75ca2cb3412a7a5 F-b2094740: f379bf4feef6771a F-b43066: 9402b630adcf1eae F-b61449: 7095ce00662e987d - F-b84c38: f6f9872d6ebb6424 - F-b99577: 169718adb64f1207 - F-ba2e05: 103982ec4919449a + F-b84c38: 00b925a04a463b34 + F-b99577: 8b6682671c6ffced + F-ba2e05: 158e77c8af32514a F-ba4b7a: c282e0e915ed547c - F-bb15e6: aa1c717495114d0b - F-bd07d7: 32e18ba16bebfb28 - F-bdcd90: dd2e36b95d38e4cd - F-c037ae: 82b68cbd9f6d927c - F-c2c996: 2061234fb3d860b5 - F-c48eb2: 2b35fe6581096524 + F-bb15e6: 22f2cc3a1414525e + F-bd07d7: 4bf7e1baddf5d754 + F-bdcd90: 487ac0a3fe38ad4f + F-c037ae: cf5818babf24c8ba + F-c2c996: 3149719c5fcc3047 + F-c48eb2: eb7ba4f65cf022a6 F-c4c5ae: 18200d79542ae22e F-c8aef8: 02e07f929a1d0ded F-cd0415: 9cf6ce40e2a8b381 F-cfba0c: 077c03b8a96f562b - F-d12edf: 0bf470bf39dbeb53 - F-d2c806: 407d9bc7c62c120e + F-d12edf: c19aa5d1007e0b8f + F-d2c806: 9eb53919b2ffb8eb F-d3bde4: 915d13b33258d3fc - F-d49585: 7f0a55feda4a1357 - F-d7312b: a5c30a6e29fa450f + F-d49585: 0f8e40d12224786e + F-d6b93648: d08154bbd93f6325 + F-d7312b: 27d203dd864933ee F-d8223c: 0501e9564231899b F-d980359c: 8f1559276afc5c03 F-dd51b42c: 496eeffa2641169d F-dddb89: f5625354e55eba9b - F-e0f6c7: 3a140f9430a7c550 + F-e0f6c7: 51249903f736ea32 F-eb732f: d8abb536ff850a7a - F-ef2fd9: 4da05cead2099ba1 + F-ee47fc2b: adb87c97b8ccf6e1 + F-ee5f643e: fa1ef01e49744590 + F-ef2fd9: b3a1dcd1e750a714 F-f334fa: 5207f35968a0c9b2 - F-f44d1b: 7db43f2420012c41 + F-f44d1b: 62e0779d9c0ef11f F-f6d13e: fb5c242416832024 - F-fcece7: 4f0efe6a1b532e00 + F-fcece7: ce9967822b5a2ebe diff --git a/spec/capabilities.yaml b/spec/capabilities.yaml index 6fa08488..26a5c274 100644 --- a/spec/capabilities.yaml +++ b/spec/capabilities.yaml @@ -10,7 +10,7 @@ source: spec.yaml capabilities: - id: drift-detection title: "Drift detection" - summary: "38 detectors across spec ↔ code ↔ test axes; the load-bearing core of cladding" + summary: "40 detectors across spec ↔ code ↔ test axes; the load-bearing core of cladding" surface: feature features: [F-99c6e5, F-3788c2, F-f44d1b, F-a4b512] - id: harness-cli @@ -33,3 +33,8 @@ capabilities: summary: "Measures cladding vs vanilla Claude Code across 8 structural + 2 outcome dimensions" surface: feature features: [F-4db939, F-ba2e05] + - id: knowledge-graph + title: "Knowledge graph (spec↔code↔doc)" + summary: "Always-current, bidirectional graph over the SSoT: reverse-index backlinks, blast-radius impact queries, doc↔spec/doc link integrity, and viewer exports (mermaid/Obsidian/DOT/JSON) + hub stats. Retrieval/traceability, not correctness." + surface: tool + features: [F-ee47fc2b, F-7794a6bc, F-ee5f643e, F-569f4b37, F-02343cd1, F-64a5c159, F-8234ec3c, F-04f50847, F-af45042a] diff --git a/spec/features/doc-graph-links-ee5f643e.yaml b/spec/features/doc-graph-links-ee5f643e.yaml new file mode 100644 index 00000000..68a93474 --- /dev/null +++ b/spec/features/doc-graph-links-ee5f643e.yaml @@ -0,0 +1,44 @@ +id: F-ee5f643e +slug: doc-graph-links +title: "Doc graph — doc→spec (F-id) + doc→doc (.md) link index and integrity, scoped to avoid example/fixture false positives" +status: done +modules: + - src/spec/doc-references.ts + - src/stages/detectors/doc-reference-integrity.ts + - src/stages/detectors/index.ts + - src/cli/clad.ts +acceptance_criteria: + - id: AC-5c0ae481 + ears: event + condition: "when clad sync runs (extractDocReferences)" + action: "scan docs/**/*.md (excluding fixture/benchmark dirs), strip code spans, and collect per-doc F-id references and resolved relative .md link targets, then write spec/_doc-links.yaml" + response: "the doc↔spec↔doc edges become a greppable Tier-C index ('which docs explain feature X') that the graph export and the LLM can read, regenerated every sync" + text: "When clad sync runs, the system shall extract per-doc F-id references and resolved relative .md links from docs/**/*.md (excluding fixture dirs, skipping code spans) and write them to spec/_doc-links.yaml deterministically." + test_refs: ["tests/spec/doc-references.test.ts#extracts F-ids and resolved .md links, excluding fixture dirs and code spans"] + notes: "## Why\n85 doc F-id refs + 26 doc↔doc links were validated by nothing — a renamed feature silently rotted prose. This is the 'all documents connected, always current' half of the graph." + - id: AC-cd5c3e00 + ears: unwanted + condition: "if a doc's relative .md link resolves to no file on disk" + action: "emit a DOC_LINK_INTEGRITY error naming the doc and the missing target" + response: "moved/renamed docs can no longer leave silent dead links" + text: "If a doc's relative .md link resolves to no file, DOC_LINK_INTEGRITY shall emit an error naming the doc and the missing target." + test_refs: ["tests/stages/detectors/doc-reference-integrity.test.ts#a dead relative .md link is an error"] + - id: AC-3f1644f5 + ears: unwanted + condition: "if a scoped doc references an F-id that resolves to no feature in the spec" + action: "emit a DOC_LINK_INTEGRITY warn naming the doc and the unknown id" + response: "a doc citing an archived/renamed feature is surfaced (blocks under --strict) instead of rotting silently" + text: "If a scoped doc references an unknown F-id, DOC_LINK_INTEGRITY shall warn, naming the doc and the id." + test_refs: ["tests/stages/detectors/doc-reference-integrity.test.ts#an unresolved F-id in a normal doc is a warn"] + - id: AC-f6f6188a + ears: unwanted + condition: "if a doc carries the clad-doc-links: ignore marker" + action: "exempt that doc from F-id resolution so its illustrative example ids never flag, while still checking its relative .md links" + response: "teaching docs full of example ids stay green without disabling dead-link checking" + text: "If a doc carries the clad-doc-links: ignore marker, the system shall exempt it from F-id resolution but still validate its .md links." + test_refs: ["tests/spec/doc-references.test.ts#an opted-out doc yields no features but still yields doc_links"] + - id: AC-a08b70e9 + ears: ubiquitous + text: "Fixture/benchmark dirs (docs/ab-evaluation*, docs/dogfood, docs/benchmarks) and code spans (fenced and inline) shall be excluded from F-id extraction, so fixture-namespace ids and format examples never produce findings." + test_refs: ["tests/spec/doc-references.test.ts#fixture dirs and code-span ids are excluded"] + notes: "## Why\nGround-truth: 16/36 doc F-ids legitimately don't resolve — fixture-project ids + format examples like `F-abc123`. Scoping is what keeps the detector honest (zero false-RED on cladding-self)." diff --git a/spec/features/graph-color-groups-5b188856.yaml b/spec/features/graph-color-groups-5b188856.yaml new file mode 100644 index 00000000..0024c4f1 --- /dev/null +++ b/spec/features/graph-color-groups-5b188856.yaml @@ -0,0 +1,33 @@ +id: F-5b188856 +slug: graph-color-groups +title: "graph viewer color system — hue=kind only, grouped spec(blue)/code(orange)/test(green)/docs(pink); skill is a doc" +status: done +depends_on: + - F-77f7ead0 + - F-64a5c159 +modules: + - src/graph/stellar.ts + - src/graph/viewer-shell.ts + - src/graph/viewer/main.ts + - src/graph/viewer/styles.css +acceptance_criteria: + - id: AC-590579 + ears: ubiquitous + text: "A node's color shall encode KIND only — never tier. semanticHue ignores tier and returns the kind hue (or DEFAULT_NODE when kind is absent), removing the prior tier/kind double-encoding where one blue meant both 'feature' and 'tier A'." + test_refs: + - "tests/graph/stellar.test.ts#kind always wins — tier never touches the node hue (double-encoding removed)" + - "tests/graph/stellar.test.ts#a tier-only node (no kind) falls back to DEFAULT_NODE — tier is not a hue" + notes: "## Why\nThe sidebar showed the same blue labeled both 'Spec·sealed' (tier A) and 'feature' (kind) because semanticHue let tier win over kind. Tier is derivable from kind (feature→A, capability→B, code→none), so encoding both in one hue was redundant AND collided (feature+scenario both blue; tier-C teal ≈ skill turquoise). Hue now carries exactly one axis: kind. Tier moves to the sidebar filter + tooltip." + - id: AC-6b822a + ears: ubiquitous + text: "KIND_COL shall be a grouped palette readable as zones on the near-black galaxy: SPEC=blue family (feature/scenario/capability), module=orange anchor, test=green anchor, DOCS=pink family (doc/skill). skill (SKILL.md, a document) shall sit in the DOCS pink arc (≈300-340°), NOT the code/test zone; all hues stay above the bloom luminance floor." + test_refs: + - "tests/graph/stellar.test.ts#KIND_COL has the seven declared kinds (spec=blue · module=orange · test=green · docs=pink)" + - "tests/graph/stellar.test.ts#skill sits in the DOCS pink family (≈300-340° hue), not the CODE/TEST zone" + notes: "## Why\nUser anchors: spec=blue, module=orange, test=green (strong, instantly-separable). The rest adjust around them — SPEC a blue family, DOCS a pink family — so the group reads at a glance while each member stays distinct (luminance + small hue step). skill was turquoise (read as code); it is .md, so it belongs with doc. Palette verified by simulation: Y≥125 floor, colorblind 4-group separation, hub-whitening within-family distinctness. Honest residuals (accepted): module orange sits near the health-burn arc (disambiguated by the burn's 2.2-3× pulse vs static node), and orange↔green is the textbook red-green colorblind pair (conceptually adjacent code↔test, luminance backstop)." + - id: AC-21ae30 + ears: ubiquitous + text: "The viewer sidebar shall present ONE color legend, grouping kinds into spec/code/test/docs zone sections; the SSoT tier section shall be a swatch-less filter (no competing color legend)." + test_refs: + - "tests/graph/viewer.test.ts#sidebar groups kinds into spec/code/test/docs zones and labels tiers as a filter" + notes: "## Why\nPreviously two colored legends (tiers + kinds) used overlapping colors, so the same blue appeared in both with different labels. With hue=kind, the kinds legend is the sole color key (grouped by zone so it teaches the spec/code/test/docs split), and tier becomes a filter rendered without a color swatch." diff --git a/spec/features/graph-context-wiring-d6b93648.yaml b/spec/features/graph-context-wiring-d6b93648.yaml new file mode 100644 index 00000000..3cabf528 --- /dev/null +++ b/spec/features/graph-context-wiring-d6b93648.yaml @@ -0,0 +1,36 @@ +id: F-d6b93648 +slug: graph-context-wiring +title: "Graph-context wiring — auto impact card on edits + advisory nudge so the working set is actually used" +status: done +depends_on: + - F-06dfdad6 + - F-7794a6bc +modules: + - src/cli/hook.ts + - spec.yaml + - src/agents/developer.md + - src/agents/planner.md +acceptance_criteria: + - id: AC-ee0f17 + ears: event + condition: "when a source-file Edit/Write/MultiEdit completes (PostToolUse) and the file touches a feature" + action: "emit a one-line impact card — the owning feature(s) + how many downstream features could break + how many regression tests to run — appended to (not replacing) the existing drift nudge; degrade to silence on any error and never block the edit" + response: "the AI automatically sees the blast radius of what it just edited, without having to call a tool" + text: "When a source edit completes, the system shall append a one-line impact card (owner + breaks + tests) derived from the impact slice, never blocking and degrading to silence on error." + test_refs: + - "tests/cli/impact-card.test.ts#formatImpactCard renders owner, breaks, and tests for a touched file" + - "tests/cli/impact-card.test.ts#formatImpactCard is empty when the file touches no feature" + notes: "## Why\nThe working set (F-06dfdad6) is a PULL tool the AI must remember to call. This is the PUSH half: PostToolUse is the only plain-text lane (PreToolUse is JSON-only — sim finding), so the blast radius is surfaced automatically AFTER the edit. The pure formatter is what's pinned; the hook I/O wiring is manual-smoke." + - id: AC-e49483 + ears: state + condition: "while the edit's changed-text magnitude is below the tiny-edit threshold" + action: "skip the impact card (a one-character typo fix should not surface the whole dependency graph)" + response: "no impact-card noise for trivial edits" + text: "While an edit's changed-char magnitude is below the threshold, the system shall not emit an impact card." + test_refs: + - "tests/cli/impact-card.test.ts#editMagnitude measures Edit, Write, and MultiEdit changed-char size" + - id: AC-a42705 + ears: ubiquitous + text: "The project's ai_hints.preferred_patterns and the developer + planner personas shall direct agents to slice the working set (clad_get_working_set) / scope the blast radius (clad_get_impact) BEFORE a non-trivial edit, over reading the whole spec or editing blind — advisory guidance (no detector enforces it)." + test_refs: + - "tests/cli/impact-card.test.ts#ai_hints and the developer persona steer agents to the working-set tools" diff --git a/spec/features/graph-efficiency-measure-16138071.yaml b/spec/features/graph-efficiency-measure-16138071.yaml new file mode 100644 index 00000000..0c2a9535 --- /dev/null +++ b/spec/features/graph-efficiency-measure-16138071.yaml @@ -0,0 +1,35 @@ +id: F-16138071 +slug: graph-efficiency-measure +title: "clad measure — deterministically quantify the search + context efficiency the graph provides per feature" +status: done +depends_on: + - F-06dfdad6 + - F-96250595 +modules: + - src/optimizer/measurement.ts + - src/cli/clad.ts +acceptance_criteria: + - id: AC-493895 + ears: event + condition: "when measureGraphEfficiency runs over a spec with module files" + action: "for each feature compute the working-set token size, the naive baseline (shard + full text of all its module files), the dependency depth + edges the graph resolves, and the iterative slice's coverage + stop reason; aggregate to medians/p95" + response: "a per-feature + aggregate efficiency report quantifying what the graph hands you vs what you'd reconstruct by hand" + text: "When measureGraphEfficiency runs, the system shall produce per-feature and aggregate context-efficiency (slice vs naive tokens), search-efficiency (depth/edges), and regression-coverage metrics." + test_refs: + - "tests/optimizer/measurement.test.ts#computes the slice-vs-naive context ratio per feature" + - "tests/optimizer/measurement.test.ts#aggregates median shrink factor, search depth, and coverage" + notes: "## Why\nThe graph tooling's goal is search/context efficiency + stable dev at scale, NOT agent correctness — four correctness-framed A/Bs were NULL on the wrong axis. This measures the right axis DETERMINISTICALLY (no agent, no NULL risk). Measured on vapt (698-edge graph): median working-set 3028 tok vs naive 14442 = 4.1x smaller context. ## Honest scope\nUpper bound of what the infrastructure CAN provide vs ONE naive baseline (shard+all-modules) — NOT proof a strong agent adopts it (A/Bs show strong agents grep regardless)." + - id: AC-612e57 + ears: ubiquitous + text: "Measurement shall be pure + deterministic given the spec and an injected file reader (no direct fs in the core; reader injected like code-excerpt), and shall never throw on a feature that resolves to a lookup miss (skip it)." + test_refs: + - "tests/optimizer/measurement.test.ts#is deterministic for identical spec and file contents" + - "tests/optimizer/measurement.test.ts#skips lookup misses without throwing" + - id: AC-d18961 + ears: event + condition: "when the MCP/CLI surface registers commands" + action: "expose `clad measure` (table + --json) reusing measureGraphEfficiency, without altering existing verbs" + response: "the efficiency report is runnable from the CLI" + text: "When the CLI registers, the system shall add a `measure` verb that prints the efficiency report." + test_refs: + - "tests/cli/clad.test.ts#returns a Command with all 22 verbs registered (work removed in 0.6.0; hook F-1d23a6, context F-d2c806, impact F-7794a6bc, infer-deps F-2be3e3bb, measure F-16138071, graph F-569f4b37, changelog F-904495a5)" diff --git a/spec/features/graph-export-viz-569f4b37.yaml b/spec/features/graph-export-viz-569f4b37.yaml new file mode 100644 index 00000000..5e6df625 --- /dev/null +++ b/spec/features/graph-export-viz-569f4b37.yaml @@ -0,0 +1,47 @@ +id: F-569f4b37 +slug: graph-export-viz +title: "Knowledge-graph model + export (mermaid / Obsidian vault / DOT / JSON) + hub stats — see the graph in best-in-class viewers" +status: done +modules: + - src/graph/model.ts + - src/graph/render.ts + - src/graph/stats.ts + - src/cli/graph.ts + - src/cli/clad.ts +acceptance_criteria: + - id: AC-0b21a485 + ears: event + condition: "when buildGraph is called with a loaded spec and project root" + action: "assemble a typed knowledge graph from the spec, the reverse-index, and the doc-link index" + response: "one in-memory graph carries feature/module/test/scenario/capability/doc nodes and depends_on/touches/covers/binds/implements/references/links edges — the unified SSoT graph every exporter and the LLM read" + text: "When buildGraph is called, the system shall assemble a deterministic typed knowledge graph (feature/module/test/scenario/capability/doc nodes; depends_on/touches/covers/binds/implements/references/links edges) from the spec + reverse-index + doc-link index." + test_refs: ["tests/graph/model.test.ts#assembles nodes and edges from spec, reverse-index, and doc links"] + notes: "## Why\nThe edges already exist scattered (forward in shards, backward in the reverse-index, doc edges in _doc-links). buildGraph is the single materialization every viewer + query reads. Pure, derived, deterministic." + - id: AC-0afdbdc6 + ears: event + condition: "when clad graph export runs with --format mermaid, dot, or json" + action: "render the (optionally focused) graph to stdout in that format" + response: "the user sees the graph in GitHub-native mermaid, Graphviz, or any JSON graph viewer — no bespoke UI to build" + text: "When clad graph export --format mermaid|dot|json runs, the system shall render the graph to stdout in that format, deterministically." + test_refs: ["tests/graph/render.test.ts#renders deterministic mermaid, dot, and json"] + - id: AC-a5a942b7 + ears: event + condition: "when clad graph export runs with --format obsidian --out " + action: "write a vault of one markdown note per node with [[wikilinks]] for outgoing edges and a Backlinks section for incoming" + response: "the user opens the folder in Obsidian and navigates the whole spec↔code↔doc graph visually, in a tool they already use" + text: "When clad graph export --format obsidian --out runs, the system shall write a markdown-vault (one note per node, [[wikilinks]] + Backlinks) renderable as a graph in Obsidian." + test_refs: ["tests/graph/render.test.ts#obsidian vault emits one note per node with wikilinks and backlinks"] + - id: AC-f8676994 + ears: event + condition: "when clad graph stats runs" + action: "report node and edge counts by kind plus the highest-degree nodes (hubs)" + response: "humans and the LLM see what is load-bearing (the bright hubs) so they prioritise carefully around it" + text: "When clad graph stats runs, the system shall report node/edge counts by kind and the top hubs by degree." + test_refs: ["tests/graph/stats.test.ts#counts nodes and edges by kind and ranks hubs by degree"] + - id: AC-d95b03ac + ears: event + condition: "when a --focus (with optional --depth N) is supplied to export" + action: "restrict the graph to that node's N-hop neighborhood in both directions before rendering" + response: "a focused, legible subgraph (the neighborhood that matters) instead of an unreadable full-repo hairball" + text: "When --focus is supplied, the system shall restrict the exported graph to the focus node's N-hop (forward+backward) neighborhood." + test_refs: ["tests/graph/model.test.ts#subgraph restricts to the focus node neighborhood within depth"] diff --git a/spec/features/graph-html-viewer-02343cd1.yaml b/spec/features/graph-html-viewer-02343cd1.yaml new file mode 100644 index 00000000..b5f56eaa --- /dev/null +++ b/spec/features/graph-html-viewer-02343cd1.yaml @@ -0,0 +1,38 @@ +id: F-02343cd1 +slug: graph-html-viewer +title: "Bespoke HTML graph viewer — SSoT 4-tier colors + slug labels + self-contained canvas force render (offline export)" +status: done +modules: + - src/graph/model.ts + - src/graph/render.ts + - src/graph/viewer-shell.ts + - src/cli/graph.ts + - src/cli/clad.ts +acceptance_criteria: + - id: AC-5bab5d89 + ears: event + condition: "when buildGraph builds feature, scenario, capability, and doc nodes" + action: "assign each a SSoT tier (feature/scenario=A, capability=B, doc=parsed from its first-line `Cladding · Tier X` banner with a known-filename fallback, module/test=none) and label feature nodes by slug" + response: "the graph carries the 4-tier governance structure + readable slug identifiers so any viewer can color by tier and show slugs" + text: "When buildGraph builds nodes, the system shall assign a tier (A to features/scenarios, B to capabilities, the banner-parsed tier to docs, none to modules/tests) and label feature nodes by slug (falling back to title then id)." + test_refs: ["tests/graph/viewer.test.ts#assigns tier by kind and parses doc banner; feature label prefers slug"] + notes: "## Why\nUser: color each SSoT layer differently + show feature slug not F-id. tier is computed at graph-build time (derived, not stored in Spec); banner regex + fallback map is deterministic. Feature.slug already exists + is unique (SLUG_CONFLICT)." + - id: AC-a00ff60c + ears: ubiquitous + text: "getTierColor shall map each tier (A/B/C/D) and the non-tier code class to a distinct stable color, and getTierLegend shall summarize live per-tier counts, so the 4-tier architecture is legible with a legend." + test_refs: ["tests/graph/viewer.test.ts#tier color mapping is stable and the legend counts per tier"] + - id: AC-ba8f9036 + ears: event + condition: "when toHtmlShell is called with a graph" + action: "return a single self-contained HTML string embedding the graph data and a dependency-free canvas force-directed renderer (tier colors, slug labels, status opacity) plus a sidebar (search, kind+tier filters with counts, legend, Calm/Live, theme, labels)" + response: "the user opens one offline file (no CDN, no server, no build) and sees a living, navigable, tier-colored graph" + text: "When toHtmlShell is called, the system shall return a single self-contained, offline HTML string (no external script/CDN) embedding the graph data + a zero-dependency canvas force renderer with tier colors, slug labels, status opacity, and an interactive sidebar." + test_refs: ["tests/graph/viewer.test.ts#emits one self-contained offline html embedding the graph, deterministically"] + notes: "## Decision\nHand-rolled compact canvas force (charge/spring/center) instead of vendoring force-graph: truest to zero-dep ethos, no inlined blob / no re-vendor maintenance / no supply-chain surface, full aesthetic control, ~30-50KB output. Layout is presentation (not gate-tested), so physics determinism is a non-issue." + - id: AC-1aeddbd7 + ears: event + condition: "when clad graph export runs with --format html" + action: "render via toHtmlShell and write a single .html to --out (error if --out missing)" + response: "a frozen, shareable, offline snapshot of the graph in one file" + text: "When clad graph export --format html runs, the system shall write a single self-contained .html via toHtmlShell to the mandatory --out path." + test_refs: ["tests/graph/viewer.test.ts#emits one self-contained offline html embedding the graph, deterministically"] diff --git a/spec/features/graph-live-health-af45042a.yaml b/spec/features/graph-live-health-af45042a.yaml new file mode 100644 index 00000000..4828478b --- /dev/null +++ b/spec/features/graph-live-health-af45042a.yaml @@ -0,0 +1,27 @@ +id: F-af45042a +slug: graph-live-health +title: "KILLER — live SSoT conformance on the graph: nodes show drift-detector health, healing in real time" +status: done +modules: + - src/stages/graph-health.ts + - src/cli/graph-serve.ts + - src/cli/graph.ts + - src/graph/viewer-shell.ts + - src/graph/viewer/main.ts +acceptance_criteria: + - id: AC-2590c81a + ears: event + condition: "when nodeHealth is computed for a graph and project root" + action: "run cladding's drift detectors and map each finding to the graph node it concerns (a module/test/doc path → that node; an F-id in the message → the feature node), aggregating worst severity per node" + response: "each node carries its live spec↔code conformance — the gate's truth, per node" + text: "When nodeHealth runs, the system shall map each drift finding to a graph node (path→module/test/doc, F-id→feature) and return per-node worst severity + which detectors fired." + test_refs: ["tests/graph/health.test.ts#maps an untested done-AC finding to its feature node", "tests/graph/health.test.ts#a healthy feature (resolving test_ref) is absent from the health map"] + notes: "## Why\nTHE KILLER: only cladding (spec-SSoT + 38 detectors) can tell, per node, whether spec↔code↔test↔doc conformance holds. Lives in stages/ (imports detectors; graph→stages is forbidden, stages→graph is fine)." + - id: AC-3d67e1c9 + ears: event + condition: "when clad graph serve receives GET /health.json (and on every fs.watch refresh)" + action: "recompute nodeHealth from the current spec and return it live; the viewer overlays problem nodes (error=red pulse / warn=amber) and a conformance pill, smoothly re-coloring on SSE refresh" + response: "the graph becomes a LIVE conformance map — break the spec↔code bond and a node flares; fix it and it heals, in real time" + text: "When clad graph serve serves /health.json (live, watch-refreshed), the viewer shall overlay problem-node health and heal smoothly as drift is fixed." + test_refs: ["tests/graph/health.test.ts#returns a plain object keyed by graph node id"] + notes: "## Decision\nDefault is the pretty 6-color graph; health is an OVERLAY (problem nodes pulse), so healthy/new repos stay beautiful. The wow = the live red→green heal. Static export embeds a stamped snapshot." diff --git a/spec/features/graph-serve-live-64a5c159.yaml b/spec/features/graph-serve-live-64a5c159.yaml new file mode 100644 index 00000000..d5f90f65 --- /dev/null +++ b/spec/features/graph-serve-live-64a5c159.yaml @@ -0,0 +1,32 @@ +id: F-64a5c159 +slug: graph-serve-live +title: "Live graph view — clad graph serve (http + fs.watch + SSE auto-reload) + clad_get_graph MCP" +status: done +modules: + - src/cli/graph-serve.ts + - src/cli/clad.ts + - src/serve/server.ts +acceptance_criteria: + - id: AC-6618e320 + ears: event + condition: "when clad graph serve runs" + action: "boot a node:http server (stdlib, zero dep) whose GET / serves the viewer over the live graph, GET /graph.json returns the freshly recomputed graph JSON, and GET /events is a text/event-stream SSE channel" + response: "the user opens localhost once and the view reflects the CURRENT spec on every load — no re-export; build the view once, develop, it stays live" + text: "When clad graph serve runs, the system shall serve GET / (live viewer), GET /graph.json (freshly recomputed graph), and GET /events (SSE stream) from a stdlib node:http server." + test_refs: ["tests/cli/graph-serve.test.ts#serves the live viewer, a fresh graph json, and an SSE events stream"] + notes: "## Why\nUser reframe: the graph is a live derivation of the spec, so the view must auto-update as development proceeds, not be a re-exported snapshot. buildGraph is pure/stateless — recompute per request = always live, no stale-trap." + - id: AC-94d847fb + ears: event + condition: "when a watched spec or doc file changes while the server is running" + action: "debounce briefly then broadcast an SSE refresh event to all connected viewers" + response: "open browsers reload to the updated graph automatically — develop and the graph follows" + text: "When a watched spec/doc file changes, the server shall (debounced) broadcast an SSE refresh so connected viewers auto-update." + test_refs: ["tests/cli/graph-serve.test.ts#a watched-file change broadcasts an SSE refresh"] + notes: "## Decision\nnode:fs.watch (stdlib) on spec/ + docs/, ~400ms debounce (fs.watch is platform-racy; debounce coalesces). No stale-trap: server always recomputes; if it dies the connection closes (visible)." + - id: AC-236bcc1e + ears: event + condition: "when a host calls the clad_get_graph MCP tool" + action: "return the live knowledge-graph JSON (optionally focused) so agents read the current graph without a subprocess" + response: "an LLM references the always-current spec↔code↔doc graph in one call" + text: "When clad_get_graph is called, the system shall return the live graph JSON (nodes+edges, optionally a --focus neighborhood) with schema_version." + test_refs: ["tests/serve/server.test.ts#clad_get_graph returns the live graph; a focus miss is isError"] diff --git a/spec/features/graph-viewer-galaxy-8234ec3c.yaml b/spec/features/graph-viewer-galaxy-8234ec3c.yaml new file mode 100644 index 00000000..c2645038 --- /dev/null +++ b/spec/features/graph-viewer-galaxy-8234ec3c.yaml @@ -0,0 +1,30 @@ +id: F-8234ec3c +slug: graph-viewer-galaxy +title: "Graph viewer — radial galaxy layout + always-on ambient animation + bloom/glow UX overhaul" +status: archived +archived_at: "2026-06-29T00:00:00Z" +archive_reason: "Superseded by graph-viewer-obsidian (F-04f50847): the radial-by-degree layout, the global-rotation ambient, and edge particles were replaced by a continuous tension simulation with hover-pause; bloom + click-focus carried forward." +superseded_by: F-04f50847 +modules: [] +acceptance_criteria: + - id: AC-d092db6f + ears: event + condition: "when the viewer settles the layout" + action: "apply a radial-galaxy force (degree-weighted: high-degree hubs pulled toward the center, low-degree leaves toward the rim) plus charge + springs so the graph converges to a circular galaxy" + response: "the gathered graph reads as one circular mass with the load-bearing hubs forming a bright core — the shape people expect from this kind of graph" + text: "When the viewer settles, the system shall apply a degree-weighted radial force so the graph converges to a circular galaxy (hubs central, leaves on the rim) with finite, bounded positions." + test_refs: ["tests/graph/viewer-render.test.ts#settles into finite bounded positions with hubs pulled toward the center"] + notes: "## Why\nUser: 'these graphs are usually circular (when nodes gather it forms a circle)'. Radial-by-degree also encodes meaning: central = most-depended-on." + - id: AC-bec33744 + ears: ubiquitous + response: "the graph feels alive even at rest; Calm gives a still image on demand" + text: "While idle (not interacting), the viewer shall keep a low-cost ambient animation alive — a slow global rotation plus node breathing, edge particles, and hub glow pulse — and a Calm toggle shall freeze it for static reading." + test_refs: ["tests/graph/viewer-render.test.ts#runs an ambient animation loop when idle"] + notes: "## Decision\nAmbient is O(n)/O(edges) DRAW only (rotation is a free global transform); physics stays burst-only. Default = ambient ON (idle animates), Calm = freeze." + - id: AC-c4dc13ea + ears: event + condition: "when the viewer renders a frame" + action: "draw every visible node with a bloom/glow pass over a deep-space background, and support click-to-focus (persistent neighborhood highlight + smooth recenter)" + response: "an extreme, legible visualization — glowing nodes on a dark field, click a node to study its neighborhood" + text: "When the viewer renders, the system shall draw every visible node (with a bloom glow pass) and support click-to-focus selection with a smooth recenter." + test_refs: ["tests/graph/viewer-render.test.ts#draws every visible node to the canvas"] diff --git a/spec/features/graph-viewer-obsidian-04f50847.yaml b/spec/features/graph-viewer-obsidian-04f50847.yaml new file mode 100644 index 00000000..5b83b001 --- /dev/null +++ b/spec/features/graph-viewer-obsidian-04f50847.yaml @@ -0,0 +1,29 @@ +id: F-04f50847 +slug: graph-viewer-obsidian +title: "Obsidian-grade viewer — continuous tension physics + hover-pause + force sliders + 6-color distinction" +status: archived +archived_at: "2026-06-29T00:00:00Z" +archive_reason: "Superseded by webgl-stellar-viewer (F-77f7ead0): the hand-rolled 2D canvas viewer (continuous tension sim, hover-pause, force sliders) was replaced by a real three.js WebGL galaxy (instanced sphere stars + UnrealBloom, OrbitControls + idle auto-rotate) to match the referenced DeusData/codebase-memory-mcp design. The 6-color hue distinction carried forward (now hue × degree-luminosity); drag-tension / hover-pause / force-sliders were dropped for OrbitControls." +superseded_by: F-77f7ead0 +modules: [] +acceptance_criteria: + - id: AC-906052ea + ears: event + condition: "when the user drags a node, and continuously while settling" + action: "run a continuous low-alpha simulation with an alphaTarget thermostat — drag reheats (alphaTarget≈0.3) so connected nodes follow elastically; hover pauses the simulation (motion freezes); release decays alpha to rest; no global rotation; frame-time normalized" + response: "the web stretches/recoils with real tension on drag, freezes under the cursor on hover, settles slowly and smoothly" + text: "When the user drags a node the system shall reheat a continuous simulation so connected nodes follow elastically; on hover it shall pause the simulation; and it shall apply no global rotation." + test_refs: ["tests/graph/viewer-render.test.ts#hover pauses the simulation and drag reheats it"] + notes: "## Why\nFrozen layout had no tension; hover must stop motion; rotation un-Obsidian; too fast. Replaced burst+freeze+rotation with continuous alpha thermostat + dt normalization + center-only pull (radial-by-degree removed)." + - id: AC-8ea2f245 + ears: event + condition: "when the user adjusts a force slider (중심 장력 / 반발력 / 링크 장력 / 링크 거리)" + action: "live-update the corresponding simulation coefficient and persist it" + response: "the layout retunes in real time (Obsidian-style 장력 controls), persisted across reloads" + text: "When a force slider changes, the system shall live-update the matching coefficient (center/repel/link strength/link distance) and persist it." + test_refs: ["tests/graph/viewer-render.test.ts#force sliders retune live simulation coefficients"] + - id: AC-51d974a7 + ears: ubiquitous + text: "Node color shall separate all classes: SSoT tiers A/B/C/D in distinct hues AND code/test/doc in their own distinct colors, so the node classes are distinguishable at a glance." + test_refs: ["tests/graph/viewer-render.test.ts#nodeColor separates tiers and code/test/doc"] + notes: "## Why\nTiers needed clearer separation + code/test/doc were all gray. nodeColor = tier hue if tiered (A blue/B purple/C teal/D amber) else kind color (module orange/test green/doc pink)." diff --git a/spec/features/impact-blast-radius-7794a6bc.yaml b/spec/features/impact-blast-radius-7794a6bc.yaml new file mode 100644 index 00000000..c399ee5b --- /dev/null +++ b/spec/features/impact-blast-radius-7794a6bc.yaml @@ -0,0 +1,45 @@ +id: F-7794a6bc +slug: impact-blast-radius +title: "Blast-radius impact query — backward slice (what breaks if I change X) over MCP + CLI" +status: done +modules: + - src/optimizer/reverse-slice.ts + - src/serve/server.ts + - src/cli/clad.ts +acceptance_criteria: + - id: AC-9980c9b0 + ears: event + condition: "when buildImpactSlice is called with a feature id or slug" + action: "walk the reverse-index transitive dependents and assemble the blast radius" + response: "the caller gets, in one call, the focus feature, its transitive dependents (id+title+status summaries), the union of scenarios bound to focus or any dependent, the deduped union of their test_refs (the regression set to run), and the union of impacted module paths" + text: "When buildImpactSlice is called with a feature id or slug, the system shall return the focus feature plus its transitive dependents (summaries), the union of bound scenarios, the deduped union of test_refs (regression set), and the union of impacted module paths." + test_refs: ["tests/optimizer/reverse-slice.test.ts#feature query returns focus, transitive dependents, scenarios, test_refs union, impacted modules"] + notes: "## Why\nThis is the missing backward complement of clad_get_context: forward answers 'what does this need', impact answers 'what breaks if I change this'. The regression-test union is the LLM's safe-refactor set in a long project." + - id: AC-3f4f7202 + ears: event + condition: "when the query is a module path" + action: "resolve it through the many-to-many moduleOwners to every feature that touches the file, then compute the blast radius from that owner set" + response: "changing a shared file surfaces ALL features that touch it and everything downstream, not just one owner" + text: "When the query is a module path, the system shall resolve it via the many-to-many moduleOwners to all owning features and compute the blast radius from that owner set, naming the module and its owners in the focus descriptor." + test_refs: ["tests/optimizer/reverse-slice.test.ts#module path query resolves all owners (many-to-many) and computes blast radius"] + - id: AC-6a73f6b1 + ears: unwanted + condition: "if the query resolves to no feature and no module owner" + action: "return a not_found result naming the three accepted lookup forms" + response: "a miss teaches the caller the contract instead of returning an empty blast radius" + text: "If the query resolves to nothing, the system shall return a not_found result naming the accepted forms (feature id, slug, module path)." + test_refs: ["tests/optimizer/reverse-slice.test.ts#a miss returns not_found naming the accepted forms"] + - id: AC-7596b1b6 + ears: event + condition: "when an optional depth is supplied" + action: "bound the transitive dependent walk to that many hops and emit every collection in stable sorted order" + response: "hub features stay queryable (bounded result) and identical spec state yields byte-identical slices (cacheable, diffable)" + text: "When an optional depth is supplied, the system shall bound the dependent walk to that many hops, and for identical spec state the slice shall be deterministic (stable ordering)." + test_refs: ["tests/optimizer/reverse-slice.test.ts#depth bounds the dependent walk and output is deterministic"] + - id: AC-c463ed55 + ears: event + condition: "when a host calls the clad_get_impact MCP tool (or the CLI runs clad impact) with a query" + action: "return the blast-radius slice as JSON carrying schema_version" + response: "an agent gets the impact set for one change in one call; a miss is reported as an error result naming the accepted forms" + text: "When clad_get_impact / clad impact is called with a query, the system shall return the blast-radius slice with schema_version, and report a miss as an error result." + test_refs: ["tests/serve/server.test.ts#clad_get_impact returns the blast-radius slice; a miss is isError"] diff --git a/spec/features/infer-depends-on-2be3e3bb.yaml b/spec/features/infer-depends-on-2be3e3bb.yaml new file mode 100644 index 00000000..03316235 --- /dev/null +++ b/spec/features/infer-depends-on-2be3e3bb.yaml @@ -0,0 +1,36 @@ +id: F-2be3e3bb +slug: infer-depends-on +title: "Infer feature depends_on from the code import graph — populate the graph edge cladding never produced" +status: done +depends_on: + - F-7794a6bc +modules: + - src/optimizer/infer-depends-on.ts + - src/cli/clad.ts +acceptance_criteria: + - id: AC-ffcc0e + ears: event + condition: "when inferDependsOn runs over a spec whose features declare modules with import statements" + action: "for each feature, extract imports from its module files, resolve each import to the feature(s) that own the imported file (via the reverse-index module-owners), and emit a feature→feature depends_on edge to the owning feature when it is different from the importer" + response: "the dependency graph cladding never auto-produced is reconstructed from real code coupling — a project authored without hand-written depends_on gets a populated graph" + text: "When inferDependsOn runs, the system shall emit a feature→feature edge for each import that resolves to a module owned by a different feature." + test_refs: + - "tests/optimizer/infer-depends-on.test.ts#infers A->B when A's module imports a file owned by B" + - "tests/optimizer/infer-depends-on.test.ts#emits no edge for stdlib/third-party/unowned imports" + - "tests/optimizer/infer-depends-on.test.ts#never emits a self-edge when a feature imports its own module" + notes: "## Why\nMeasured gap: depends_on is load-bearing for the whole graph layer (prune/context/impact/iterative/drive) but PRODUCED by nothing — clad_create_feature/scan/onboarding never emit it, no detector flags its absence. doverunner-vapt (174 features, cladding-authored) had 0 edges → all graph tools returned empty. This reconstructs edges deterministically from the import graph (vapt: 0 → 698 edges, 157/174 features). ## Honesty\nThis POPULATES the graph (a precondition for any graph value); it is NOT a correctness claim. It does not auto-write the spec — it produces reviewable suggestions (anti-self-cert: a human merges the edges)." + - id: AC-84b71a + ears: state + condition: "while an import resolves to a module co-owned by more than maxOwnerAmbiguity features (default 1)" + action: "skip that import as an ambiguous (weak) signal rather than emitting an edge to every co-owner" + response: "shared/utility modules don't explode the graph with spurious fan-out; only unambiguous single-owner imports become edges by default" + text: "While an imported module is owned by more than maxOwnerAmbiguity features, the system shall not emit an edge for it." + test_refs: + - "tests/optimizer/infer-depends-on.test.ts#skips imports of modules owned by multiple features by default" + notes: "## Why\nMeasured: vapt has 129/434 multi-owner modules (one shared by 23 features). Counting every co-owner tripled edges (4357) with noise; capping at 1 unambiguous owner gives a clean 698 (median 4/feature)." + - id: AC-4e0fd0 + ears: ubiquitous + text: "Inference shall be deterministic and pure given the spec + injected file contents (no direct fs in the core; the reader is injected like code-excerpt), and shall separate NEW edges from those already declared in depends_on so callers surface only the additions." + test_refs: + - "tests/optimizer/infer-depends-on.test.ts#is deterministic for identical spec and file contents" + - "tests/optimizer/infer-depends-on.test.ts#separates already-declared edges from new suggestions" diff --git a/spec/features/infer-deps-dynamic-flag-0f2984d0.yaml b/spec/features/infer-deps-dynamic-flag-0f2984d0.yaml new file mode 100644 index 00000000..6490db7e --- /dev/null +++ b/spec/features/infer-deps-dynamic-flag-0f2984d0.yaml @@ -0,0 +1,25 @@ +id: F-0f2984d0 +slug: infer-deps-dynamic-flag +title: "infer-deps flags dynamic-import files — honest recall: surface what static extraction cannot see" +status: done +depends_on: + - F-2be3e3bb +modules: + - src/optimizer/infer-depends-on.ts + - src/cli/clad.ts +acceptance_criteria: + - id: AC-d7c33b + ears: event + condition: "when inferDependsOn scans a module that uses dynamic/runtime imports (importlib.import_module, __import__, getattr-based, or require())" + action: "record that module path in dynamicImportFiles (sorted, deduped) — its dependencies cannot be extracted by static regex, so edges from it may be under-reported" + response: "the recall gap is surfaced for manual review, not silently dropped" + text: "When a module uses dynamic imports, the system shall list its path in dynamicImportFiles so the under-reported edges are visible, not hidden." + test_refs: + - "tests/optimizer/infer-depends-on-dynamic.test.ts#flags a module with dynamic imports in dynamicImportFiles" + - "tests/optimizer/infer-depends-on-dynamic.test.ts#leaves dynamicImportFiles empty when all imports are static" + notes: "## Why\nThe final vapt graph-traversal test measured inference recall at ~70-75% — the biggest remaining gap was dynamic imports (importlib/getattr) that regex extraction can't see (e.g. catalog/tool_inventory.py). Rather than silently miss them, surface the files so a maintainer reviews them by hand. Honest-recall, not a precision change (static edges from the same files are still inferred). clad infer-deps prints dynamic_import_files." + - id: AC-1781e6 + ears: ubiquitous + text: "dynamicImportFiles shall be deterministic (sorted) and additive — it does not change which edges are inferred, only reports which files carry untrackable dependencies; clad infer-deps surfaces it as dynamic_import_files." + test_refs: + - "tests/optimizer/infer-depends-on-dynamic.test.ts#dynamicImportFiles is deterministic and does not alter inferred edges" diff --git a/spec/features/inferable-depends-on-detector-15999130.yaml b/spec/features/inferable-depends-on-detector-15999130.yaml new file mode 100644 index 00000000..d38f6513 --- /dev/null +++ b/spec/features/inferable-depends-on-detector-15999130.yaml @@ -0,0 +1,28 @@ +id: F-15999130 +slug: inferable-depends-on-detector +title: "INFERABLE_DEPENDS_ON detector — flag (info) when code imports cross feature boundaries but depends_on is unrecorded" +status: done +depends_on: + - F-2be3e3bb +modules: + - src/stages/detectors/inferable-depends-on.ts + - src/stages/detectors/index.ts +acceptance_criteria: + - id: AC-40564f + ears: event + condition: "when the drift stage runs on a project whose features import across feature boundaries without declaring the matching depends_on" + action: "emit a SINGLE info-severity finding naming how many features + edges are inferable, pointing at `clad infer-deps`; emit nothing when there are no undeclared inferable edges" + response: "the empty-dependency-graph gap is surfaced (never silently) without ever failing the gate" + text: "When undeclared import-inferable depends_on edges exist, the detector shall emit exactly one info finding; otherwise none." + test_refs: + - "tests/stages/detectors/inferable-depends-on.test.ts#emits one info finding when undeclared inferable edges exist" + - "tests/stages/detectors/inferable-depends-on.test.ts#emits nothing when the dependency graph is fully declared" + notes: "## Why\nThe depends_on gap had TWO holes — 'produced by nothing' (closed by F-2be3e3bb clad infer-deps) and 'absence flagged by nothing'. This closes the second: without it, infer-deps is a latent tool nobody runs (the same trap that left the graph empty). ## Non-hostile by design\nINFO severity = never fails the gate even under --strict (which fails on error+warn only); a single AGGREGATE finding (not 157 per-feature) so real projects that never hand-authored depends_on aren't spammed or blocked." + - id: AC-e80942 + ears: unwanted + condition: "if the spec is unreadable, has no features, or no cross-feature imports" + action: "safe-degrade to zero findings without throwing" + response: "the detector never breaks the drift stage on an empty/!invalid/import-less project" + text: "If inference cannot run or finds nothing, the detector shall return no findings and never throw." + test_refs: + - "tests/stages/detectors/inferable-depends-on.test.ts#safe-degrades to no findings on an import-less or empty spec" diff --git a/spec/features/iterative-impact-slice-96250595.yaml b/spec/features/iterative-impact-slice-96250595.yaml new file mode 100644 index 00000000..663eb75c --- /dev/null +++ b/spec/features/iterative-impact-slice-96250595.yaml @@ -0,0 +1,37 @@ +id: F-96250595 +slug: iterative-impact-slice +title: "Iterative graph-anchored impact slice — widen from depth 1 until a deterministic sufficiency stop, self-describing" +status: done +depends_on: + - F-7794a6bc + - F-06dfdad6 +modules: + - src/optimizer/iterative-slice.ts + - src/optimizer/working-set.ts +acceptance_criteria: + - id: AC-77a026 + ears: event + condition: "when buildIterativeImpactSlice is called for a feature whose blast radius reaches beyond one hop" + action: "expand the impact radius hop-by-hop from initialDepth and stop at the first depth where a deterministic sufficiency criterion holds — coverage ≥ threshold, OR the ring added zero new dependents (exhaustion), OR two consecutive hops each added < the marginal-yield threshold" + response: "a narrow (1-hop) miss is automatically widened to capture the deeper dependents, while an already-complete radius stops immediately at depth 1 (no wasted expansion)" + text: "When buildIterativeImpactSlice runs, the system shall expand from initialDepth and stop at the first depth meeting a deterministic sufficiency criterion (coverage / exhaustion / marginal-yield), widening narrow misses but not over-expanding complete ones." + test_refs: + - "tests/optimizer/iterative-slice.test.ts#widens a narrow miss: a 2-hop dependent chain reaches depth 2" + - "tests/optimizer/iterative-slice.test.ts#stops at depth 1 when the radius is already complete" + - "tests/optimizer/iterative-slice.test.ts#stops on exhaustion when the reachable graph boundary is hit" + notes: "## Why\nFixed depth=1 (buildImpactSlice) under-reports 2nd-hop dependents — the 'narrow miss' that surfaced in the working-set A/Bs. ## Calibration\nDefault criteria (coverage 0.9 + marginal-yield 0.05 + exhaustion; NOT 'target-nodes') were chosen by simulating 522 cladding-self queries: 'target-nodes' fired at depth 1 everywhere (test_refs ride along immediately) and stopped at ~50% coverage = false completeness. Honest limit: cladding's large fan-out hubs never reach 90% coverage at any depth → they stop on marginal-yield/max-depth with an honest partial coverage, which is correct (giving all ~100 dependents would be noise)." + - id: AC-f77588 + ears: ubiquitous + text: "The result shall be self-describing and deterministic: it carries depthUsed, a stoppedBy reason, and a coverage fraction (radius ∩ all-known-dependents); identical spec state yields byte-identical results so a host can cache and diff it. A coverage/exhaustion stop shall never report coverage below the threshold (no false completeness)." + test_refs: + - "tests/optimizer/iterative-slice.test.ts#reports depthUsed, stoppedBy, and coverage" + - "tests/optimizer/iterative-slice.test.ts#is deterministic for identical spec state" + - "tests/optimizer/iterative-slice.test.ts#a coverage or exhaustion stop never reports coverage below the threshold" + - id: AC-4c8e3f + ears: event + condition: "when buildIterativeImpactSlice is queried with an unresolved id/slug/module" + action: "return the same not_found miss shape as buildImpactSlice (single source of truth for the miss contract)" + response: "callers handle the miss identically whether they used the fixed or the iterative slice" + text: "When the query resolves to no feature, the system shall return the canonical buildImpactSlice not_found miss." + test_refs: + - "tests/optimizer/iterative-slice.test.ts#an unresolved query returns the canonical not_found miss" diff --git a/spec/features/reverse-index-core-ee47fc2b.yaml b/spec/features/reverse-index-core-ee47fc2b.yaml new file mode 100644 index 00000000..121a98b2 --- /dev/null +++ b/spec/features/reverse-index-core-ee47fc2b.yaml @@ -0,0 +1,33 @@ +id: F-ee47fc2b +slug: reverse-index-core +title: "Reverse-edge index — backlinks (dependents, module owners, test citations) derived from the spec, memoized per instance" +status: done +modules: + - src/spec/reverse-index.ts +acceptance_criteria: + - id: AC-ea650cce + ears: event + condition: "when buildReverseIndex is called with a loaded spec" + action: "invert depends_on, modules, and acceptance_criteria test_refs into three maps derived purely from the spec without mutating it" + response: "callers get O(1) reverse lookups (direct dependents, module owners, test citations) instead of re-walking every shard per query" + text: "When buildReverseIndex is called with a loaded spec, the system shall produce three reverse maps — featureId→direct-dependent ids, module-path→owning-feature-id set, and test-file-path→citing-feature-id set — derived purely from the spec without mutating it." + test_refs: ["tests/spec/reverse-index.test.ts#inverts depends_on into a direct-dependents map"] + notes: "## Why\npruneToFeature walks depends_on UP (ancestors) only; there is no reverse lookup, so 'what depends on me / which features touch this file / which feature owns this test' force a full shard scan per query. This is the backlink seam the whole graph layer reuses." + - id: AC-5b48c3c7 + ears: ubiquitous + response: "zero added cost after the first call; cache lifetime ties to the run-scoped spec object so it can never go stale" + text: "The reverseIndexOf accessor shall memoize the reverse index per spec instance (WeakMap-keyed), so repeated calls within one run reuse the first computation and never re-walk the feature set." + test_refs: ["tests/spec/reverse-index.test.ts#memoizes per spec instance"] + notes: "## Decision\nWeakMap memo, NOT a mutable field on the readonly Spec. Cache is keyed by the spec object primeSpecCache already holds one-per-run, so it is auto-invalidated when the spec is replaced and GC-collected with it. No changes to types.ts/load.ts/drift.ts." + - id: AC-17365b3c + ears: ubiquitous + text: "Module ownership shall be many-to-many: a module path declared by N features shall map to the full set of N feature ids, reflecting that `modules` records every feature that touches a file, not exclusive ownership." + test_refs: ["tests/spec/reverse-index.test.ts#maps each module path to all owning features (many-to-many)"] + notes: "## Why\nGround-truth: 131/338 module paths in cladding-self are claimed by 2+ features. `modules` is a touched-by edge. A uniqueness check would be wrong; the value is the many-to-many co-change query." + - id: AC-7db4f09d + ears: unwanted + condition: "if a test_ref carries a recognised non-path prefix (derived:/fixture:/script:/self-dogfood:) or a #anchor suffix" + action: "exclude prefixed pseudo-refs from the citation index and key real refs by their path part only (anchor stripped)" + response: "the citation index maps clean test-file paths to citing features, never anchors or non-path pseudo-refs" + text: "If a test_ref carries a recognised non-path prefix or a #anchor, the system shall exclude prefixed pseudo-refs from the citation index and key real refs by path only (anchor stripped)." + test_refs: ["tests/spec/reverse-index.test.ts#skips prefixed pseudo-refs and strips anchors in test citations"] diff --git a/spec/features/webgl-stellar-viewer-77f7ead0.yaml b/spec/features/webgl-stellar-viewer-77f7ead0.yaml new file mode 100644 index 00000000..296d7877 --- /dev/null +++ b/spec/features/webgl-stellar-viewer-77f7ead0.yaml @@ -0,0 +1,46 @@ +id: F-77f7ead0 +slug: webgl-stellar-viewer +title: "WebGL stellar galaxy viewer — real three.js + UnrealBloom over the SSoT graph (semantic hue × degree luminosity), live health" +status: done +modules: + - src/graph/stellar.ts + - src/graph/layout3d.ts + - src/graph/viewer/main.ts + - src/graph/viewer/styles.css +acceptance_criteria: + - id: AC-1a2b3c4d + ears: ubiquitous + text: "Node color shall encode meaning as HUE (SSoT tier A/B/C/D, else kind feature/scenario/capability/module/test/doc) while DEGREE drives LUMINOSITY (load-bearing hubs mixed toward white), and the final per-instance color shall be boosted above 1.0 so the bloom pass renders the excess as a glow corona." + test_refs: + - "tests/graph/stellar.test.ts#a healthy hub blooms (at least one channel > 1.0)" + - "tests/graph/stellar.test.ts#norm=1 channels >= norm=0 channels, at least one strictly greater" + - "tests/graph/stellar.test.ts#module, test and doc kinds are three distinct colors" + notes: "## Why\nUser: 'go identical to the reference design' (DeusData/codebase-memory-mcp). The reference colors stars BY DEGREE and boosts color >1.0 (meshBasicMaterial toneMapped=false) so UnrealBloom catches the corona. We keep cladding's VALUE — hue still encodes SSoT tier/kind — and fold the stellar luminosity on top (more information than the reference). ## Caveat\nThe WebGL scene itself (three.js InstancedMesh + UnrealBloomPass strength 1.2/radius 0.6/threshold 0.3 + OrbitControls + 60s idle auto-rotate) lives in src/graph/viewer/main.ts and is NOT headless-testable (no WebGL in vitest) — it is verified by manual browser smoke. These ACs pin the pure, tested cores (stellar.ts color math, layout3d.ts) that the scene consumes; this is deliberately NOT a vacuous green." + - id: AC-2b3c4d5e + ears: event + condition: "when a node carries live drift (a health override) versus when it is healthy" + action: "color the drift node as a red (error) / amber (warn) burn above 1.0 — the brightest thing in the field — and restore its tier/kind hue when the drift clears on an SSE refresh" + response: "drift flares red/amber brighter than any healthy star and heals back to its semantic hue in real time" + text: "When a node has drift, the system shall override its color to a red/amber burn brighter than any healthy node, and restore the semantic hue once the drift is fixed." + test_refs: + - "tests/graph/stellar.test.ts#error drift is the brightest: its max channel > any healthy node max channel" + - "tests/graph/stellar.test.ts#error red channel exceeds 1.0" + notes: "## Why\nThe live killer (F-af45042a) carried into the WebGL viewer: the color contract (drift = brightest burn) is pinned here; the SSE live-refresh/heal wiring is in main.ts (manually verified)." + - id: AC-3c4d5e6f + ears: event + condition: "when the viewer computes node positions for the graph" + action: "run a deterministic FNV-seeded 3D force layout (per-kind sphere shells + repulsion/edge-springs/anchor, displacement-capped) yielding finite, bounded positions identical for the same graph" + response: "a readable 3D galaxy you orbit, with reproducible positions (offline-export byte stability)" + text: "When the layout runs, the system shall compute finite, bounded (±4000), deterministic 3D positions for every node." + test_refs: + - "tests/graph/layout3d.test.ts#every coordinate is finite" + - "tests/graph/layout3d.test.ts#default opts: abs(coord) <= 4000" + - "tests/graph/layout3d.test.ts#two calls with identical input are deep-equal" + - id: AC-4d5e6f70 + ears: ubiquitous + text: "Edges shall render as additive filaments colored by edge kind, with intensity scaled by focus — same-cluster brighter than cross when idle, both-endpoints-highlighted brightest, and skipped entirely when a highlight is active and neither endpoint is in it." + test_refs: + - "tests/graph/stellar.test.ts#known kind maps to its color" + - "tests/graph/stellar.test.ts#no highlight, same kind -> 0.25" + - "tests/graph/stellar.test.ts#highlight active, both endpoints hi -> 0.5" + - "tests/graph/stellar.test.ts#highlight active, neither hi -> 0 (skip)" diff --git a/spec/features/working-set-assembler-06dfdad6.yaml b/spec/features/working-set-assembler-06dfdad6.yaml new file mode 100644 index 00000000..286c14ed --- /dev/null +++ b/spec/features/working-set-assembler-06dfdad6.yaml @@ -0,0 +1,58 @@ +id: F-06dfdad6 +slug: working-set-assembler +title: "Working-set assembler — one token-budgeted, code-bearing context payload (forward+backward fused) for LLM dev" +status: done +depends_on: + - F-d2c806 + - F-7794a6bc +modules: + - src/optimizer/working-set.ts + - src/optimizer/code-excerpt.ts + - src/serve/server.ts +acceptance_criteria: + - id: AC-62d89e + ears: event + condition: "when buildWorkingSet is called with a feature id, slug, or module path" + action: "resolve the focus feature; for a module path claimed by multiple features pick the alphabetically-first owner id as focus and list all co-owners; for an unrecognized query return a not_found miss" + response: "a deterministic focus resolution that never throws on bad input" + text: "When buildWorkingSet runs, the system shall resolve the focus from id/slug/module (module multi-owner → alphabetically-first owner + co-owners listed) or return a not_found miss." + test_refs: + - "tests/optimizer/working-set.test.ts#resolves id, slug, and module path (multi-owner picks first + lists co-owners)" + - "tests/optimizer/working-set.test.ts#unknown query returns a not_found miss" + notes: "## Why\nFreeze F-d2c806's buildContextSlice + clad_get_context (schema_version=1, existing tests) — this is an ADDITIVE buildWorkingSet, never a mutation of the existing slice (sim verdict: backward-compat blocker)." + - id: AC-d2b3c8 + ears: ubiquitous + text: "The working set shall fuse, in one structured payload: must-edit (focus feature + full ACs), needs (forward depends_on ancestors), breaks-if-changed (direct backward dependents + the regression test union), verify (scenarios + test_refs + oracle_refs + EARS unwanted/state high-risk AC flags), and guidance (ai_hints preferred_patterns) — so one call replaces the forward+backward two-call dance and the hand-grep." + test_refs: + - "tests/optimizer/working-set.test.ts#fuses forward needs + backward breaks + verify + guidance into one payload" + - "tests/optimizer/working-set.test.ts#flags EARS unwanted/state acceptance criteria as high-risk" + - id: AC-42bd08 + ears: event + condition: "when the working set includes a focus module's source" + action: "read it through a path-safe reader — resolve within cwd, allow only a code-extension whitelist, return a binary/too-large/missing marker instead of throwing, and clip long files with a truncation marker" + response: "the LLM sees the actual code to edit, safely and bounded (no path traversal, no binary dump, no budget blowout)" + text: "When source is included, the system shall read it via a cwd-bounded, extension-whitelisted, clipping reader that degrades to a marker on binary/missing/oversize." + test_refs: + - "tests/optimizer/code-excerpt.test.ts#reads a code file clipped to the budget with a truncation marker" + - "tests/optimizer/code-excerpt.test.ts#rejects path traversal and non-whitelisted/binary/missing files safely" + - id: AC-05ea70 + ears: unwanted + condition: "if the assembled payload would exceed the token budget (default 3000, configurable)" + action: "clip droppable sections in priority order — distant transitive ancestors, then code excerpts — and record what was dropped in budget.truncated[]; the focus (must-edit + ACs) is always retained" + response: "the droppable sections shrink to fit the budget and the LLM is told what was omitted; the focus is never dropped (so a focus larger than the cap is reported, not truncated)" + text: "While the payload would exceed the token budget, the system shall clip droppable sections (ancestors then code) and record budget.truncated[]; the focus is always retained even if it alone exceeds the cap." + test_refs: + - "tests/optimizer/working-set.test.ts#enforces the token budget and records what was truncated" + - id: AC-c2cef0 + ears: event + condition: "when the MCP server registers its tools" + action: "expose a NEW clad_get_working_set tool (leaving clad_get_context and its schema_version untouched), and enumerate the skill node kind in clad_get_graph's description" + response: "hosts get the richer working set opt-in, with zero change to the existing context tool" + text: "When tools register, the system shall add clad_get_working_set without altering clad_get_context, and clad_get_graph's description shall list the skill kind." + test_refs: + - "tests/serve/server.test.ts#registers clad_get_working_set without touching clad_get_context" + - id: AC-833f1c + ears: ubiquitous + text: "For identical spec state and identical file contents, buildWorkingSet shall produce byte-identical structural ordering (stable sorts, no timestamps/random) so a host can cache and diff it." + test_refs: + - "tests/optimizer/working-set.test.ts#is deterministic for identical spec + files" diff --git a/spec/index.yaml b/spec/index.yaml index e2fdc335..f254aa46 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -26,6 +26,7 @@ features: F-020: {slug: F-020, status: done, modules: 1} F-021: {slug: F-021, status: done, modules: 1} F-022: {slug: F-022, status: done, modules: 1} + F-02343cd1: {slug: graph-html-viewer, status: done, modules: 5} F-023: {slug: F-023, status: done, modules: 6} F-024: {slug: F-024, status: done, modules: 1} F-025: {slug: F-025, status: done, modules: 1} @@ -53,6 +54,7 @@ features: F-047: {slug: F-047, status: done, modules: 5} F-048: {slug: F-048, status: done, modules: 3} F-049: {slug: F-049, status: done, modules: 7} + F-04f50847: {slug: graph-viewer-obsidian, status: archived, modules: 0} F-051: {slug: F-051, status: done, modules: 5} F-052: {slug: F-052, status: done, modules: 5} F-053: {slug: F-053, status: done, modules: 6} @@ -72,6 +74,7 @@ features: F-067: {slug: F-067, status: done, modules: 3} F-068: {slug: F-068, status: done, modules: 4} F-069: {slug: F-069, status: done, modules: 5} + F-06dfdad6: {slug: working-set-assembler, status: done, modules: 3} F-070: {slug: F-070, status: done, modules: 2} F-071: {slug: F-071, status: done, modules: 3} F-072: {slug: F-072, status: done, modules: 2} @@ -87,7 +90,10 @@ features: F-098d3b: {slug: detector-count-auto-recompute, status: done, modules: 1} F-09d68b: {slug: clad-refine, status: done, modules: 7} F-0ed2db: {slug: ai-hints-consumer-instructions, status: done, modules: 11} + F-0f2984d0: {slug: infer-deps-dynamic-flag, status: done, modules: 2} F-12d740: {slug: atomic-ac-evidence-fanout, status: done, modules: 1} + F-15999130: {slug: inferable-depends-on-detector, status: done, modules: 2} + F-16138071: {slug: graph-efficiency-measure, status: done, modules: 2} F-16746b: {slug: enforcement-triggers, status: done, modules: 3} F-17df0a: {slug: scan-artifacts-llm-refinement, status: done, modules: 3} F-18e951: {slug: drift-baseline-cleanup, status: done, modules: 7} @@ -96,6 +102,7 @@ features: F-1edb38: {slug: scan-refactor, status: done, modules: 13} F-24062d: {slug: spec-id-hash-filename-and-lookup, status: done, modules: 3} F-245bd5: {slug: dogfood-recovery-v0-3-16, status: done, modules: 2} + F-2be3e3bb: {slug: infer-depends-on, status: done, modules: 2} F-2de65d: {slug: drive-auto-rollback, status: done, modules: 1} F-315fd7: {slug: scenario-coverage-detector, status: done, modules: 2} F-31eeb8: {slug: scan-bfs-walk, status: done, modules: 2} @@ -112,23 +119,29 @@ features: F-4db939: {slug: ab-evaluation, status: done, modules: 9} F-50ff43: {slug: meta-integrity-skip-when-absent, status: done, modules: 2} F-551a1c: {slug: oracle-cost-lever, status: done, modules: 4} + F-569f4b37: {slug: graph-export-viz, status: done, modules: 5} F-56abaa: {slug: intent-aware-init, status: done, modules: 5} F-570a3f: {slug: mcp-structural-channel, status: done, modules: 1} F-59f093: {slug: multidev-integration-test-and-scenario-regex, status: done, modules: 3} + F-5b188856: {slug: graph-color-groups, status: done, modules: 4} F-5b9f9f: {slug: spec-yaml-inventory-and-hints, status: done, modules: 6} F-5d3ed2: {slug: postmortem-on-rollback, status: done, modules: 2} F-5f6b45: {slug: init-path-intent, status: done, modules: 2} + F-64a5c159: {slug: graph-serve-live, status: done, modules: 3} F-65814a: {slug: sentinel-miss-telemetry, status: done, modules: 3} F-67d2e9: {slug: strict-skip-policy, status: done, modules: 2} F-67e33f: {slug: spec-id-multi-dev-safety, status: done, modules: 7} F-6d943d: {slug: version-bump-script, status: done, modules: 2} F-6f80e7: {slug: claude-code-dogfood, status: done, modules: 1} F-7076f7: {slug: smoke-probe-demand, status: done, modules: 3} + F-7794a6bc: {slug: impact-blast-radius, status: done, modules: 3} + F-77f7ead0: {slug: webgl-stellar-viewer, status: done, modules: 4} F-78b50d: {slug: project-context-drift-detector, status: done, modules: 2} F-7afbd4: {slug: clad-done-gated-transition, status: done, modules: 1} F-7ce18e: {slug: glossary-naming-convention, status: done, modules: 7} F-7fa4a7: {slug: mcp-sampling-dispatcher, status: done, modules: 1} F-80d19d: {slug: setup-command, status: done, modules: 7} + F-8234ec3c: {slug: graph-viewer-galaxy, status: archived, modules: 0} F-836a90: {slug: link-capability-tool, status: done, modules: 2} F-8f419e: {slug: smoke-legacy-liveness, status: done, modules: 1} F-904495a5: {slug: changelog-render, status: done, modules: 5} @@ -136,6 +149,7 @@ features: F-90d054: {slug: init-host-autowire, status: archived, modules: 0} F-94dda4: {slug: scan-polyglot, status: done, modules: 2} F-95a096: {slug: ops-visibility-polish, status: done, modules: 3} + F-96250595: {slug: iterative-impact-slice, status: done, modules: 2} F-96700032: {slug: unverified-ac-junit, status: done, modules: 4} F-99c6e5: {slug: cladding-self-fixes, status: done, modules: 13} F-9a3b61: {slug: ab-ext-uncommit-demos, status: done, modules: 3} @@ -148,6 +162,7 @@ features: F-ae61c1: {slug: ab-tm-query-domain-fix, status: done, modules: 3} F-aee1da: {slug: scan-residuals, status: done, modules: 3} F-aee61f: {slug: scan-roots-from-architecture, status: done, modules: 1} + F-af45042a: {slug: graph-live-health, status: done, modules: 5} F-af96b1: {slug: no-vacuous-green-gate-contract, status: done, modules: 6} F-b2094740: {slug: lint-config-detection, status: done, modules: 1} F-b43066: {slug: model-defaults-refresh, status: done, modules: 6} @@ -171,6 +186,7 @@ features: F-d2c806: {slug: get-context-slice, status: done, modules: 3} F-d3bde4: {slug: capabilities-yaml-llm-extract, status: done, modules: 3} F-d49585: {slug: gate-golden-matrix, status: done, modules: 2} + F-d6b93648: {slug: graph-context-wiring, status: done, modules: 4} F-d7312b: {slug: scenario-hash-model, status: done, modules: 5} F-d8223c: {slug: blind-author-agent, status: done, modules: 1} F-d980359c: {slug: junit-multiframework-matching, status: done, modules: 2} @@ -178,6 +194,8 @@ features: F-dddb89: {slug: ears-validation-at-creation, status: done, modules: 4} F-e0f6c7: {slug: smoke-disposition-spine, status: done, modules: 3} F-eb732f: {slug: spec-authoring-anti-hollow, status: done, modules: 2} + F-ee47fc2b: {slug: reverse-index-core, status: done, modules: 1} + F-ee5f643e: {slug: doc-graph-links, status: done, modules: 4} F-ef2fd9: {slug: ab-ext-dashboard, status: done, modules: 7} F-f334fa: {slug: ab-ext-scenarios-emit, status: done, modules: 3} F-f44d1b: {slug: hollow-governance-detector, status: done, modules: 2} diff --git a/src/agents/developer.md b/src/agents/developer.md index ad9766d3..2dea2636 100644 --- a/src/agents/developer.md +++ b/src/agents/developer.md @@ -71,6 +71,15 @@ Before writing code, grep `spec.yaml::project.ai_hints`: - Style / philosophy concern → file for `reviewer`. - Production metric anomaly → file for `observability`. +## Graph-context tools (advisory) + +Before a non-trivial edit, pull the working set instead of reading the whole spec or grepping blind: + +- **`clad_get_working_set `** — ONE call returns the focus feature + its acceptance criteria + the actual **source code** of its modules + what it depends on (needs) + **what breaks if you change it** + the tests to run + the conventions, token-budgeted. Your default orientation for a feature. +- **`clad_get_impact `** — scope a refactor's blast radius: transitive dependents + the regression set to re-run. + +Advisory (no detector enforces it) — but after your edits the hook auto-surfaces the impact (the PostToolUse card), so the blast radius is never invisible. + ## User-facing language (Soft Shell) Any string your code writes to stdout / a log a user reads must use feature titles, never `F-NNN` (or `F-` for v0.3.9+ features); stage names (`Drift`, `UAT`), never `stage_X.Y`. Use `src/ui/softShell.ts` (`featureLabel`, `haltMessage`, `gateLabel`). The audit log keeps the raw ids — those are for replay, not for users. diff --git a/src/agents/planner.md b/src/agents/planner.md index 8ca312dd..1433f870 100644 --- a/src/agents/planner.md +++ b/src/agents/planner.md @@ -45,6 +45,10 @@ When authoring a new feature or scenario, also check `spec.yaml::project.ai_hint `ai_hints` is the project-scoped SSoT for AI behavior policy and overrides this prompt for the specific project. +## Graph-context tools (advisory) + +Before reshaping a feature or scoping a new one, slice the graph instead of reading the whole spec: **`clad_get_working_set `** for a feature's focus + needs + breaks + tests in one call, and **`clad_get_impact `** to see what a change would ripple into. Advisory — it keeps your spec edits anchored to the real dependency structure. + ## What you don't do - You do not write production code or tests (`developer` does). - You do not pass philosophical judgement (`reviewer` does). diff --git a/src/cli/clad.ts b/src/cli/clad.ts index 82557dd6..06d25aa7 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -7,6 +7,7 @@ // CLI behavior. import process from 'node:process'; +import {readFileSync} from 'node:fs'; import {Command} from 'commander'; @@ -21,6 +22,11 @@ import {runClarifyCommand} from './clarify.js'; import {runHostSetup} from '../init/host-setup.js'; import {recordEvent} from '../events/log.js'; import {buildContextSlice} from '../optimizer/context-slice.js'; +import {buildImpactSlice} from '../optimizer/reverse-slice.js'; +import {inferDependsOn} from '../optimizer/infer-depends-on.js'; +import {measureGraphEfficiency} from '../optimizer/measurement.js'; +import {runGraphExportCommand, runGraphStatsCommand} from './graph.js'; +import {runGraphServeCommand} from './graph-serve.js'; import {strictSkipViolations} from '../stages/skip-policy.js'; import {runArch} from '../stages/arch.js'; import {runAudit} from '../stages/audit.js'; @@ -43,6 +49,7 @@ import {staleSpecification} from '../stages/detectors/stale-specification.js'; import {findLatestCheckpoint, recordCheckpoint, recordRollback} from '../core/checkpoint.js'; import {maintainDeliverable} from '../spec/deliverable-detect.js'; import {computeInventory, writeInventoryToSpecYaml, writeFeatureIndex} from '../spec/inventory.js'; +import {writeDocLinksYaml} from '../spec/doc-references.js'; import {repairTestRefs} from '../spec/test-ref-repair.js'; import {writeAttestation} from '../spec/attestation.js'; import {buildBlindPayload, renderBlindBrief} from '../oracle/payload.js'; @@ -233,6 +240,7 @@ export function runSyncCommand(opts: {proposeArchive?: boolean} = {}): void { const inventory = computeInventory('.'); writeInventoryToSpecYaml('.', inventory); writeFeatureIndex('.'); // F-37b4a8 — 1-file feature lookup at scale + writeDocLinksYaml('.'); // F-doc-graph — doc→spec/doc link index (Tier C) // F-c037ae — heal annotation drift before it rejects correct features: // unique-basename repair of moved test_ref paths + derived: suggestions // (which never satisfy a mandate — see MISSING_TESTS/UNTESTED_AC). @@ -568,6 +576,84 @@ export function runContextCommand(query: string): void { } } +/** Handler for `clad impact ` (F-7794a6bc) — print the blast-radius slice. */ +export function runImpactCommand(query: string, opts: {depth?: string} = {}): void { + try { + const spec = loadSpec(); + const depth = opts.depth !== undefined ? Number(opts.depth) : undefined; + const slice = buildImpactSlice(spec, query, {depth}); + process.stdout.write(`${JSON.stringify(slice, null, 2)}\n`); + process.exit('not_found' in slice ? 1 : 0); + } catch (err) { + pulse('fail', 'impact', (err as Error).message); + process.exit(1); + } +} + +/** + * `clad infer-deps` (F-2be3e3bb) — reconstruct feature depends_on edges from the code import + * graph and print them as REVIEWABLE suggestions (does not write the spec — a human merges the + * edges, anti-self-cert). Surfaces the dependency graph cladding never auto-produced. + */ +export function runInferDepsCommand(opts: {ambiguity?: string} = {}): void { + try { + const spec = loadSpec(); + const ambiguity = opts.ambiguity !== undefined ? Number(opts.ambiguity) : undefined; + const read = (p: string): string | null => { + try { + return readFileSync(p, 'utf8'); + } catch { + return null; + } + }; + const result = inferDependsOn(spec, read, ambiguity !== undefined ? {maxOwnerAmbiguity: ambiguity} : {}); + process.stdout.write( + `${JSON.stringify({suggestions: result.suggestions, new_edges: result.edges.length, already_declared: result.alreadyDeclared.length, dynamic_import_files: result.dynamicImportFiles}, null, 2)}\n`, + ); + process.exit(0); + } catch (err) { + pulse('fail', 'infer-deps', (err as Error).message); + process.exit(1); + } +} + +/** + * `clad measure` (F-16138071) — deterministically report the search + context efficiency the + * graph provides per feature: working-set tokens vs the naive (shard + all module files) + * baseline, the dependency depth/edges it resolves for you, and the regression-set coverage. + * No agent, no test run — measures what the infrastructure CAN provide (an upper bound vs one + * naive baseline), not whether an agent adopts it. + */ +export function runMeasureCommand(opts: {json?: boolean} = {}): void { + try { + const spec = loadSpec(); + const read = (p: string): string | null => { + try { + return readFileSync(p, 'utf8'); + } catch { + return null; + } + }; + const r = measureGraphEfficiency(spec, read, '.'); + if (opts.json) { + process.stdout.write(`${JSON.stringify(r, null, 2)}\n`); + } else { + const lines = [ + `graph efficiency · ${r.measured}/${r.featureCount} features`, + ` context: working-set ${r.context.medianSliceTokens} tok vs naive ${r.context.medianNaiveTokens} tok = ${r.context.medianShrinkFactor}x smaller (median)`, + ` search: median ${r.search.medianDepth} hop(s) resolved (p95 ${r.search.p95Depth}), median ${r.search.medianEdges} edge(s)/feature (max hub ${r.search.maxEdges})`, + ` stability: median blast-radius coverage ${r.stability.medianCoverage}, median ${r.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(r.stability.byStopReason)}`, + ` (deterministic upper bound vs the shard+all-modules baseline — not an agent-adoption measurement)`, + ]; + process.stdout.write(`${lines.join('\n')}\n`); + } + process.exit(0); + } catch (err) { + pulse('fail', 'measure', (err as Error).message); + process.exit(1); + } +} + export function runCheckCommand(opts: {internal?: boolean; strict?: boolean; tier?: string; json?: boolean; feature?: string}): void { let focusModules: readonly string[] | undefined; if (opts.feature) { @@ -835,6 +921,47 @@ export function createProgram(): Command { .description('Print the context slice for one feature — id (F-…), slug, or module path (F-d2c806)') .action(runContextCommand); + program + .command('impact ') + .description('Print the blast radius for a change — what depends on a feature/file + the tests to re-run (F-7794a6bc)') + .option('--depth ', 'bound the dependent walk to N hops (default: the full transitive radius)') + .action((query, opts) => runImpactCommand(query, opts)); + + program + .command('infer-deps') + .description('Suggest feature depends_on edges from the code import graph — the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.') + .option('--ambiguity ', 'emit edges for imports owned by ≤ N features (default 1 = unambiguous single-owner only)') + .action((opts) => runInferDepsCommand(opts)); + + program + .command('measure') + .description('Report the search + context efficiency the graph provides per feature — working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.') + .option('--json', 'emit the full per-feature report as JSON') + .action((opts) => runMeasureCommand(opts)); + + const graph = program + .command('graph') + .description('Render the spec↔code↔doc knowledge graph for a viewer, or report its shape (F-569f4b37)'); + graph + .command('export') + .description('Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out') + .option('--format ', 'mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)') + .option('--focus ', 'restrict to a feature/file node’s neighborhood (id, slug, or module path)') + .option('--depth ', 'neighborhood radius around --focus (default: unbounded)') + .option('--out ', 'write to a file (or, for obsidian, a vault dir — default .cladding/graph)') + .action((opts) => runGraphExportCommand(opts)); + graph + .command('stats') + .description('Report node/edge counts by kind and the top hubs by degree') + .action(() => runGraphStatsCommand()); + graph + .command('serve') + .description('Serve a LIVE graph at localhost — recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)') + .option('--port ', 'port to listen on (default 3000)') + .action((opts) => { + void runGraphServeCommand(opts); + }); + program .command('changelog') .description( diff --git a/src/cli/graph-serve.ts b/src/cli/graph-serve.ts new file mode 100644 index 00000000..60a07c37 --- /dev/null +++ b/src/cli/graph-serve.ts @@ -0,0 +1,172 @@ +// Cladding · CLI · live graph server — F-64a5c159 +// +// `clad graph serve` is the LIVE view: the graph is a pure derivation of the +// spec, so instead of re-exporting a snapshot, we serve it and recompute on +// every request. A stdlib node:http server (zero deps) serves the viewer at +// `/`, the freshly-computed graph at `/graph.json`, and an SSE stream at +// `/events`. node:fs.watch on spec/ + docs/ broadcasts a debounced refresh so +// open browsers auto-reload as development proceeds — build the view once, it +// stays live. No stale-trap: the server always recomputes from the live spec; +// if it dies, the connection closes (visible), not silently stale. + +import {createServer, type ServerResponse} from 'node:http'; +import {existsSync, watch, type FSWatcher} from 'node:fs'; +import {join} from 'node:path'; + +import {buildGraph} from '../graph/model.js'; +import {toJson} from '../graph/render.js'; +import {toHtmlShell} from '../graph/viewer-shell.js'; +import {nodeHealth} from '../stages/graph-health.js'; +import {loadSpec} from '../spec/load.js'; +import {pulse} from '../ui/pulse.js'; + +export interface GraphServer { + readonly port: number; + /** Push an SSE `refresh` to every connected viewer (also fired by file watching). */ + broadcast(): void; + close(): Promise; +} + +/** + * Boots the live graph HTTP server bound to localhost. Recomputes buildGraph on + * every request (always current). Resolves once listening. `port: 0` lets the + * OS pick a free port (used by tests). + */ +export function createGraphServer(opts: {readonly port?: number; readonly cwd?: string} = {}): Promise { + const cwd = opts.cwd ?? '.'; + const clients = new Set(); + const liveGraph = (): ReturnType => buildGraph(loadSpec(cwd), cwd); + const broadcast = (): void => { + for (const c of clients) { + try { + c.write('data: refresh\n\n'); + } catch { + clients.delete(c); + } + } + }; + + const server = createServer((req, res) => { + const path = (req.url ?? '/').split('?')[0]; + try { + if (path === '/graph.json') { + res.writeHead(200, {'Content-Type': 'application/json', 'Cache-Control': 'no-store'}); + res.end(toJson(liveGraph())); + return; + } + if (path === '/health.json') { + // KILLER: live spec↔code conformance from cladding's drift detectors, per node. + res.writeHead(200, {'Content-Type': 'application/json', 'Cache-Control': 'no-store'}); + res.end(JSON.stringify(nodeHealth(liveGraph(), cwd))); + return; + } + if (path === '/events') { + res.writeHead(200, { + 'Content-Type': 'text/event-stream', + 'Cache-Control': 'no-cache', + Connection: 'keep-alive', + }); + res.write(': connected\n\n'); + clients.add(res); + req.on('close', () => clients.delete(res)); + return; + } + if (path === '/' || path === '/index.html') { + // The viewer self-wires SSE (EventSource('events')) and re-fetches graph/health + // on refresh — health-only changes heal smoothly, structural changes reload. + res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-store'}); + res.end(toHtmlShell(liveGraph())); + return; + } + res.writeHead(404, {'Content-Type': 'text/plain'}); + res.end('not found'); + } catch (err) { + // Headers may already be sent (e.g. an SSE stream) — only set status if not. + if (!res.headersSent) res.writeHead(500, {'Content-Type': 'text/plain'}); + try { + res.end((err as Error).message); + } catch { + /* socket already gone */ + } + } + }); + + // Debounced file watching → SSE refresh (fs.watch is platform-racy; coalesce). + let timer: ReturnType | null = null; + const onChange = (): void => { + if (timer) clearTimeout(timer); + timer = setTimeout(broadcast, 400); + }; + const watchers: FSWatcher[] = []; + for (const dir of ['spec', 'docs']) { + const abs = join(cwd, dir); + if (!existsSync(abs)) continue; + try { + watchers.push(watch(abs, {recursive: true}, onChange)); + } catch { + /* recursive watch unsupported on this platform → skip (manual refresh still works) */ + } + } + // SSE keep-alive (proxies/firewalls drop idle connections >60s). + const ka = setInterval(() => { + for (const c of clients) { + try { + c.write(': keep-alive\n\n'); + } catch { + clients.delete(c); + } + } + }, 30000); + if (typeof ka.unref === 'function') ka.unref(); + + return new Promise((resolve) => { + server.listen(opts.port ?? 0, '127.0.0.1', () => { + const addr = server.address(); + const port = typeof addr === 'object' && addr ? addr.port : (opts.port ?? 0); + resolve({ + port, + broadcast, + close: () => + new Promise((done) => { + if (timer) clearTimeout(timer); + clearInterval(ka); + for (const w of watchers) { + try { + w.close(); + } catch { + /* already closed */ + } + } + for (const c of clients) { + try { + c.end(); + } catch { + /* already closed */ + } + } + clients.clear(); + server.close(() => done()); + // Force idle keep-alive sockets shut so close() resolves promptly (Node 18.2+). + if (typeof server.closeAllConnections === 'function') server.closeAllConnections(); + }), + }); + }); + }); +} + +/** Handler for `clad graph serve` — boots the live server and keeps the process alive. */ +export async function runGraphServeCommand(opts: {readonly port?: string; readonly cwd?: string} = {}): Promise { + const port = opts.port !== undefined ? Number(opts.port) : 3000; + try { + const srv = await createGraphServer({port, cwd: opts.cwd ?? '.'}); + pulse( + 'pass', + 'graph', + `live graph at http://localhost:${srv.port} — edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`, + ); + // The server + watchers keep the event loop alive until Ctrl-C. + } catch (err) { + pulse('fail', 'graph', (err as Error).message); + process.exit(1); + } +} diff --git a/src/cli/graph.ts b/src/cli/graph.ts new file mode 100644 index 00000000..90b1c399 --- /dev/null +++ b/src/cli/graph.ts @@ -0,0 +1,100 @@ +// Cladding · CLI · graph export + stats — F-569f4b37 +// +// `clad graph export` renders the knowledge graph to a best-in-class viewer +// (mermaid / dot / json to stdout; obsidian to a vault dir). `clad graph stats` +// prints counts + hubs. The heavy lifting is pure (src/graph/*); this is glue. + +import {mkdirSync, writeFileSync} from 'node:fs'; +import {dirname, join} from 'node:path'; + +import {buildGraph, resolveNodeId, subgraph} from '../graph/model.js'; +import {toDot, toJson, toMermaid, toObsidianVault} from '../graph/render.js'; +import {toHtmlShell} from '../graph/viewer-shell.js'; +import {nodeHealth} from '../stages/graph-health.js'; +import {graphStats, renderStats} from '../graph/stats.js'; +import {loadSpec} from '../spec/load.js'; +import {pulse} from '../ui/pulse.js'; + +export type GraphFormat = 'mermaid' | 'dot' | 'json' | 'obsidian' | 'html'; + +export interface GraphExportOptions { + readonly format?: string; + readonly focus?: string; + readonly depth?: string; + readonly out?: string; +} + +/** Handler for `clad graph export`. */ +export function runGraphExportCommand(opts: GraphExportOptions = {}): void { + try { + const format = (opts.format ?? 'mermaid') as GraphFormat; + const spec = loadSpec(); + let graph = buildGraph(spec, '.'); + + if (opts.focus) { + const focusId = resolveNodeId(spec, graph, opts.focus); + if (!focusId) { + pulse('fail', 'graph', `no node matches '${opts.focus}' — try a feature id (F-…), slug, or module path`); + process.exit(1); + return; + } + const depth = opts.depth !== undefined ? Number(opts.depth) : Infinity; + graph = subgraph(graph, focusId, depth); + } + + if (format === 'obsidian') { + const outDir = opts.out ?? '.cladding/graph'; + const vault = toObsidianVault(graph); + for (const [rel, content] of vault) { + const abs = join(outDir, rel); + mkdirSync(dirname(abs), {recursive: true}); + writeFileSync(abs, content, 'utf8'); + } + pulse('pass', 'graph', `wrote ${vault.size} note(s) to ${outDir} — open it as an Obsidian vault`); + process.exit(0); + return; + } + + if (format === 'html') { + if (!opts.out) { + pulse('fail', 'graph', '--format html requires --out (a single self-contained .html file)'); + process.exit(1); + return; + } + const html = toHtmlShell(graph, nodeHealth(graph, '.')); + mkdirSync(dirname(opts.out), {recursive: true}); + writeFileSync(opts.out, html, 'utf8'); + pulse('pass', 'graph', `wrote a self-contained viewer to ${opts.out} — open it in a browser (offline)`); + process.exit(0); + return; + } + + const rendered = format === 'dot' ? toDot(graph) : format === 'json' ? toJson(graph) : toMermaid(graph); + if (opts.out) { + mkdirSync(dirname(opts.out), {recursive: true}); + writeFileSync(opts.out, rendered, 'utf8'); + pulse('pass', 'graph', `wrote ${format} graph to ${opts.out}`); + process.exit(0); + } else { + // Flush before exit: on a pipe, stdout.write is async — exiting on the next + // line truncates output larger than the OS pipe buffer (~64 KiB on macOS). + // Exit from the write callback so the full payload drains first. + process.stdout.write(rendered, () => process.exit(0)); + } + } catch (err) { + pulse('fail', 'graph', (err as Error).message); + process.exit(1); + } +} + +/** Handler for `clad graph stats`. */ +export function runGraphStatsCommand(): void { + try { + const graph = buildGraph(loadSpec(), '.'); + // Flush before exit (see runGraphExportCommand) so piped output never truncates. + process.stdout.write(renderStats(graphStats(graph)), () => process.exit(0)); + } catch (err) { + pulse('fail', 'graph', (err as Error).message); + process.exit(1); + } +} diff --git a/src/cli/hook.ts b/src/cli/hook.ts index 2a95e13b..5c8b80e0 100644 --- a/src/cli/hook.ts +++ b/src/cli/hook.ts @@ -36,6 +36,8 @@ import {suggestIntent} from '../router/intent.js'; import {runArch} from '../stages/arch.js'; import {runDrift} from '../stages/drift.js'; import {runSecret} from '../stages/secret.js'; +import {buildImpactSlice, type ImpactSlice} from '../optimizer/reverse-slice.js'; +import {loadSpec} from '../spec/load.js'; // --- shared helpers ---------------------------------------------------- @@ -354,10 +356,37 @@ function isWatchedSourcePath(filePath: string): boolean { return SOURCE_FILE_EXT.test(filePath); } +const MIN_EDIT_CHARS = 40; // below this an edit is too trivial to warrant an impact card + +/** Approximate changed-char magnitude of an Edit/Write/MultiEdit tool input (tiny-edit guard). */ +export function editMagnitude(toolInput: unknown): number { + const t = asRecord(toolInput); + if (typeof t.content === 'string') return t.content.length; // Write + if (Array.isArray(t.edits)) { + return (t.edits as unknown[]).reduce((n, e) => n + asString(asRecord(e).new_string).length, 0); // MultiEdit + } + return asString(t.new_string).length; // Edit +} + +/** + * One-line impact card from a resolved slice — owning feature(s) + how many downstream + * features could break + how many regression tests to run. '' when the file touches no feature. + */ +export function formatImpactCard(slice: ImpactSlice, filePath: string): string { + const owners = slice.focus.owners ?? []; + const primary = slice.focus.id ?? owners[0]; + if (!primary) return ''; + const label = slice.focus.title ? `${primary} ${slice.focus.title}` : primary; + const co = owners.length > 1 ? ` (+${owners.length - 1} co-owner${owners.length > 2 ? 's' : ''})` : ''; + const breaks = slice.impacted.length > 0 ? ` · breaks ${slice.impacted.length} feature(s)` : ''; + const tests = slice.test_refs.length > 0 ? ` · run ${slice.test_refs.length} test(s)` : ''; + return `cladding impact: ${filePath} → ${label}${co}${breaks}${tests}`; +} + /** - * After a source edit, runs the drift detectors silently (debounced via - * `.cladding/hook-drift-ts`) and surfaces a one-line nudge ONLY when - * error-severity findings exist — ambient feedback, never a block. + * After a source edit (debounced via `.cladding/hook-drift-ts`): surfaces a one-line IMPACT + * card (the blast radius of the file just edited — the push half of clad_get_working_set) and, + * when error-severity drift exists, a drift nudge. Ambient feedback, never a block. */ function runPostToolUseDrift(input: unknown, cwd: string): string { const rec = asRecord(input); @@ -378,10 +407,21 @@ function runPostToolUseDrift(input: unknown, cwd: string): string { } catch { /* unwritable stamp → still run; worst case is an extra drift pass */ } + // Impact card: the blast radius of the file just edited (skip trivial edits; degrade to ''). + let card = ''; + if (editMagnitude(rec.tool_input) >= MIN_EDIT_CHARS) { + try { + const slice = buildImpactSlice(loadSpec(cwd), filePath); + if (!('not_found' in slice)) card = formatImpactCard(slice, filePath); + } catch { + /* spec unreadable → no card, still run drift */ + } + } const report = runDrift({cwd}); const errors = report.findings.filter((f) => f.severity === 'error'); - if (errors.length === 0) return ''; - return `cladding drift: ${errors.length} error(s) — ${errors[0].detector}: ${truncate(errors[0].message, 140)}`; + const drift = + errors.length === 0 ? '' : `cladding drift: ${errors.length} error(s) — ${errors[0].detector}: ${truncate(errors[0].message, 140)}`; + return [card, drift].filter(Boolean).join('\n'); } // --- dispatch + CLI wrapper --------------------------------------------- diff --git a/src/graph/layout3d.ts b/src/graph/layout3d.ts new file mode 100644 index 00000000..112b084e --- /dev/null +++ b/src/graph/layout3d.ts @@ -0,0 +1,207 @@ +// Cladding · graph · deterministic 3D force layout — F webgl-stellar-viewer +// +// The reference (DeusData/codebase-memory-mcp) computes positions server-side in C: +// a deterministic ring/anchor INITIALIZATION (per-node hash → concentric shells) plus a +// force pass (Barnes-Hut repulsion + linear edge springs + an anchor spring back to the +// seed, fixed iterations, a per-step displacement cap — no temperature, no community +// detection). We do the same in TS, scaled to cladding's ~721 nodes (plain O(n²) +// repulsion — no octree needed at this size), so the layout is: +// +// • DETERMINISTIC — every coordinate derives from FNV-1a(id); no Math.random / Date. +// Same graph → byte-identical positions (the offline-export reproducibility contract). +// • BOUNDED + FINITE — the anchor spring + a faint center pull keep nodes near their +// seed shell; each step clamps to ±BOUND and reseeds any NaN/Infinity. +// • CLUSTERED — kind chooses a base shell radius, so spec sits inner and code/test/doc +// fan outward — a readable 3D galaxy you orbit, hubs blazing (color is in stellar.ts). +// +// Pure + headless-tested (tests/graph/layout3d.test.ts). main.ts (WebGL) imports this +// exact function, so the tested layout is the shipped layout. + +export interface LayoutNode { + readonly id: string; + readonly kind?: string; +} +export interface LayoutEdge { + readonly from: string; + readonly to: string; +} +export type Vec3 = [number, number, number]; + +export interface Layout3dOptions { + /** Force-relaxation passes (default 140). */ + readonly iterations?: number; + /** Hard coordinate clamp (default 4000). */ + readonly bound?: number; +} + +// Force constants (tuned for ~700 nodes at the ~210..630 seed-shell scale). +const REPEL = 7000; // inverse-square charge magnitude +const FMAX = 34; // per-pair repulsion cap (stops near-coincident blow-ups) +const LINK = 0.02; // edge spring stiffness +const LINKDIST = 90; // edge spring rest length +const ANCHOR = 0.05; // pull back toward the deterministic seed (preserves shells) +const CENTER = 0.0015; // faint pull to origin (cohesion + guaranteed boundedness) +const MAXSTEP = 14; // per-iteration displacement cap (the reference's pseudo-cooling) + +// Kind → base shell radius: spec inner, code/test/doc outer (a readable galaxy). +const BAND: Readonly> = { + feature: 0, + capability: 40, + scenario: 70, + module: 150, + doc: 210, + test: 270, +}; + +/** FNV-1a 32-bit. */ +function hashStr(s: string): number { + let h = 2166136261; + for (let i = 0; i < s.length; i++) { + h ^= s.charCodeAt(i); + h = Math.imul(h, 16777619); + } + return h >>> 0; +} + +/** Deterministic seed position on a per-kind sphere shell (uniform over the sphere). */ +function seedOf(node: LayoutNode): Vec3 { + const h = hashStr(node.id); + const theta = ((h & 0xffff) / 0xffff) * Math.PI * 2; + const u = ((h >>> 16) & 0xff) / 255; + const phi = Math.acos(2 * u - 1); // uniform latitude + const jitter = ((h >>> 24) & 0xff) / 255; + const band = BAND[node.kind ?? ''] ?? 120; + const r = 210 + band + jitter * 150; + const sp = Math.sin(phi); + return [r * sp * Math.cos(theta), r * sp * Math.sin(theta), r * Math.cos(phi)]; +} + +/** + * Computes deterministic, finite, bounded 3D positions for the graph. + * Returns a plain object keyed by node id → [x, y, z]. + */ +export function computeLayout3d( + nodes: readonly LayoutNode[], + edges: readonly LayoutEdge[], + opts: Layout3dOptions = {}, +): Record { + const iterations = opts.iterations ?? 140; + const bound = opts.bound ?? 4000; + const n = nodes.length; + const out: Record = {}; + if (n === 0) return out; + + const idx: Record = {}; + const px = new Float64Array(n); + const py = new Float64Array(n); + const pz = new Float64Array(n); + const ax = new Float64Array(n); // anchors (seed) + const ay = new Float64Array(n); + const az = new Float64Array(n); + const deg = new Float64Array(n); + + for (let i = 0; i < n; i++) { + idx[nodes[i].id] = i; + const s = seedOf(nodes[i]); + px[i] = ax[i] = s[0]; + py[i] = ay[i] = s[1]; + pz[i] = az[i] = s[2]; + } + // Edge index list (only edges whose endpoints both resolve). + const es: number[] = []; + const et: number[] = []; + for (const e of edges) { + const a = idx[e.from]; + const b = idx[e.to]; + if (a === undefined || b === undefined || a === b) continue; + es.push(a); + et.push(b); + deg[a]++; + deg[b]++; + } + const mass = new Float64Array(n); + for (let i = 0; i < n; i++) mass[i] = 1 + Math.sqrt(deg[i]); + + const fx = new Float64Array(n); + const fy = new Float64Array(n); + const fz = new Float64Array(n); + + for (let iter = 0; iter < iterations; iter++) { + fx.fill(0); + fy.fill(0); + fz.fill(0); + + // Repulsion — O(n²) inverse-square, capped. + for (let i = 0; i < n; i++) { + const xi = px[i]; + const yi = py[i]; + const zi = pz[i]; + for (let j = i + 1; j < n; j++) { + let dx = xi - px[j]; + let dy = yi - py[j]; + let dz = zi - pz[j]; + let d2 = dx * dx + dy * dy + dz * dz; + if (d2 < 0.01) { + // near-coincident: nudge deterministically by index so they separate + dx = (i - j) % 2 === 0 ? 0.1 : -0.1; + dy = 0.07; + dz = 0.05; + d2 = dx * dx + dy * dy + dz * dz; + } + const inv = 1 / Math.sqrt(d2); + let f = REPEL / d2; + if (f > FMAX) f = FMAX; + const ux = dx * inv * f; + const uy = dy * inv * f; + const uz = dz * inv * f; + fx[i] += ux; + fy[i] += uy; + fz[i] += uz; + fx[j] -= ux; + fy[j] -= uy; + fz[j] -= uz; + } + } + // Attraction — linear edge springs toward rest length. + for (let k = 0; k < es.length; k++) { + const a = es[k]; + const b = et[k]; + const dx = px[b] - px[a]; + const dy = py[b] - py[a]; + const dz = pz[b] - pz[a]; + const d = Math.sqrt(dx * dx + dy * dy + dz * dz) || 0.01; + const f = ((d - LINKDIST) * LINK) / d; + const ux = dx * f; + const uy = dy * f; + const uz = dz * f; + fx[a] += ux; + fy[a] += uy; + fz[a] += uz; + fx[b] -= ux; + fy[b] -= uy; + fz[b] -= uz; + } + // Anchor spring (preserves the seed shell) + faint center pull; integrate, capped. + for (let i = 0; i < n; i++) { + fx[i] += (ax[i] - px[i]) * ANCHOR * mass[i] - px[i] * CENTER; + fy[i] += (ay[i] - py[i]) * ANCHOR * mass[i] - py[i] * CENTER; + fz[i] += (az[i] - pz[i]) * ANCHOR * mass[i] - pz[i] * CENTER; + const fm = Math.sqrt(fx[i] * fx[i] + fy[i] * fy[i] + fz[i] * fz[i]); + const speed = fm > MAXSTEP ? MAXSTEP / fm : 1; + let nx = px[i] + fx[i] * speed; + let ny = py[i] + fy[i] * speed; + let nz = pz[i] + fz[i] * speed; + if (!Number.isFinite(nx) || !Number.isFinite(ny) || !Number.isFinite(nz)) { + nx = ax[i]; + ny = ay[i]; + nz = az[i]; + } + px[i] = nx < -bound ? -bound : nx > bound ? bound : nx; + py[i] = ny < -bound ? -bound : ny > bound ? bound : ny; + pz[i] = nz < -bound ? -bound : nz > bound ? bound : nz; + } + } + + for (let i = 0; i < n; i++) out[nodes[i].id] = [px[i], py[i], pz[i]]; + return out; +} diff --git a/src/graph/model.ts b/src/graph/model.ts new file mode 100644 index 0000000000000000000000000000000000000000..daf0a54628401073ba7dd3ffdbe2c5face191425 GIT binary patch literal 9363 zcmbVSYi`^|65iiFMH>lrIQ9(3!M?|l4cU?ctsTj*93%@_(QwG7h8BmMWpgYEvVi>B z11$CoxkCQuC^^Y~Uv)Rhd1!;IVMt_mbyan}tEkaPz09K|$%+g0^H1uciWW0ITo&b3 zu9FKrv`h0c(YgBNhySR9;h+BexAc$GKm6svXoUaj-ApS&8WrW0j*=UtuQO8*l!>Fd z)|F1iDlMz4s7h2;s2bpAh8LrPL@#uanDeq25EFEn}trCTu7O>Ta*>fsbH?Fd6Xq;q>iU1OR}iI8-E}SM`UkA@j^3hH~i2cKvAjN6F{vW;*PPf53Kk^uIdOpzJemvj_Rd4 zsv()4`lNc+5aiKZW_d18Gzz;E>msVMQeNU{5lyo^t8e5L?D0mUM~~FWN%>CI85C8f zRH@@$MOB@pxF*c6jLpcHvL1?ghx4RAR=Yb!M=*UkFi*!pBM7;rTp9@XWi@X!)xsIA1GeCb%&mUp*V@CU;g!P|7_vv zav9IG5g?`fp1@hjS+KaIr+BCpFv`*bO(Fgk20m+LyGazbmg_lgY@u7ZZ-Tb=A;cl( zO&D>}-c#O_|2zzSH!^}R>I$0DN_?2cqHe)8mHSm*PT?pwYFT9eTg)kr(jX6J=OJ);&8;$VU+ z>`o2z!XT?+3MsJH98t>~H>5{^Cz>hmAsp$rERqPZO)evdW;C8rR?ux~3H%~bge2#u zMy1O^bOH=qXUMut}L64 zy4<>Kb>@BS>4R;gUimapM!)>b0R+28c*-H`KAyYfW-a1kTS!HULr6@dEA55d7(A8K?K3gfjrFM7$!T&f>!9RAte%+_xPQH9N9B#tB zba3;ix=i4y{m_M)cZd6L&tL2w9pTs8eJEh`{d@BWe)QQVV(R0?*Zg?=`6v7!;rHfo zaJoC(JL|unj-CqF$gnKG#cSqK5nUj)`tpe-tCY~p8i0x1rM8t-Fv|->iRz}|@zv4s zw@2rD$1l&xEkj|UuhiGk;!Epl14&TNf>YSTX-{gmsETJTlfEoQW+$`8OXgpJmycM;20&}Z(vy+>iyUT;2)Di|Y>ERn z#G8Y%*J)1t1q9#>&dQ+9zzfwFlcl%;L<(|JcH2-U%?SfrQ`(NDy+~W@nt08!i4$}B zZbGcq;M5fo`ctKIqk)_~UNK~lETXwqsnfRGUm_5tFjy2*%fc%k{6K}BlD7%zu6H2G z10?FbG7c&&5#EPUR54dgbp?g@!X84t@c0Q4#ZzOnfTc*(@ZnD`_?q6sAlddh0b7~? zXa`spVrUq9%R2pQuOFHPx`LqhzJP+i=$}40Q_r8P9%^vbn>Iwvfp67YLVc~{prI#0 z)CT)`6T9c9U!1APG$qs>%CkD2IgUqb0D%$S-$?IT-;Ju&KnvJ!KA)6_O=0Vh5O2+xxK`%c#TW4IM|1;l3!q`_y#u7!=Hf<~52sK406_|01FclB zqXGga`hexgJ;vJ(3Ih7+Se=NFw%O~Jim^?1W=kAv%Eo6lC0l3;?nKuP9#1arZ2+0E z?S5=Q33yhOFcpgilba*fXDAH{2grB$)yEQ<99fg@WDWQs6S4_WDFj8BC8$O0f`N5$ zVW0{zcciQideS9&O1t&sw&b>**H{tm6%1&Dv}N>C-vGzTTS&~P}8-;6xI1vX-@jVU{==wwJ^pjRhsTN>7BQJ?5~%FN9$T?i?X?Ya1?}lchV9 zh_`o+b0;2903+0&K@x@!PcdIon9D5?T#;-Lv8D)E)_bkZfIFmq8S^1q%(GfWDJNnK zbd5~u*w(^8;WvoiDGBx=)#EnFTg7*9Vsb*IreQlmS=Fg^0n3hfz^XoRjKw)LPdSLO zAJQQh?&;JxE>B0rj9kKOY;| zetoRwR+VJpo-1_F_x$+C`OgOPQEa)7;#e>02vfjwG^5aO7Omf;qXKjuJQl^$pUL!g z9omN#*UhZ8TaF!Gf}!9cq56z-=q{Jqs@&c12zm+7FEoBhRDm4u;_GnZoE4`R|G|T^G@$? z)KNoSNs5{yMEy8-?QX7U2_W_f?L>0V#lb~r6gu0QtH;}zb>c-`X-21 zMAdGz!h-q9L<&Kcz>Tn8^zIkdeTm@z5?0HU=XSfeI`h>3Av00twz)j3-hRl!$fqqE zH?czRK(cjYu@EE#bX4eDO(HXXDzLM|p~CNfuLShmen4>(1KC^m#D>~C7FRn+2J-EI zZwCn7d!DLP{f_jC7dS>6f5m&NMd4zgn9Q&)B%Z5VYxi!!rLz0A+FsI2=(p*!VQ{5d(#w#--&TA=%-X!pBfl;}kzuY^Fb8(7#Th4ir2%G4vGP&-5$ zxwdO-qHUw)x=2=N_UuT1-I(nyZF@kbStFl<2TIk1AESJ!P0&BX;H;{HAi@VfnF~d5 z-jE-{a{aQLW7MsKDV<-?cX8Un1qR3h#$u6d+(pHVx`B*~ef8;+ib58n8~a>z`*pdo zTbEKr2|KQByOk@UNS0Pe?mDn+`8DAc^>y3Ay+xL)vY2HSy21Xo0iLJh8Zwo8v09Q#S7nm88%7Z9PJ&x-GBLRe^06{fW$NRX-ox}-C}f4 zq`p8?3ydH!&MR!acg2bhg`6vHh!BI?-J?Cs_OauZxt8&p!dn?*TCO3-WsJJfET?h- ze2^&61Iu{9(PSO_NZn*Q$Mg_&uAVRI8++aD;{=Z@5R7BB+I9^r+O{77d-aUt%=uKJ z(P4qn1-=QQ8(BRmCBBpwmQ`zoc4%9O;jtA`40$50rUOx4yQgQ3QcurTdZiBxx@%Lc zPG{#@yH2h~Z=5dO5@}S@ELO$$=2(kcz zdD@Dpg9~e`nAj(6-~m*FMO=V*SoBz@;}F>0vvarLRHSt#M03PEoJ8Fwx^P=W!yTG4 zat&XvW*pG7+7?)!i#VZ1CL-XMG(47pw*dDn6v#DR^`~bHCuoVe-4U&=f;?t_eg&kM zQv6=j2ra9X2oZ{*@W!@lp28X|Biuye#~sSMm^x|Obuwrh(v=NcKl*OLzIhHsq}R2* z2X6lOF&_!zgNxkIMVPMbVt$9xJP54yw#-Vfv|XVX*SKqGp+BX?=9^RA;2{3a8cafh zT@$(B{-(@7%7}7lpk;i5#i+%9yhO)5V$&<1U2NwepJDp!B_kK*cohIPpJuur(wnIw z{``S-7)uY6mD$WaaX}dI#sTl&{BUE = { + A: {label: 'Spec', color: '#0066cc'}, // blue (the sealed SSoT layer — label kept plain) + B: {label: 'Design', color: '#7c3aed'}, // purple + C: {label: 'Derived', color: '#64748b'}, // slate + D: {label: 'Audit', color: '#f59e0b'}, // amber +}; +/** Color for non-tier nodes (modules, tests = code on disk). */ +export const CODE_COLOR = '#9ca3af'; // gray + +/** Node color by SSoT tier; code (no tier) falls back to the neutral. */ +export function getTierColor(tier?: Tier): string { + return tier ? TIER_META[tier].color : CODE_COLOR; +} + +export interface TierLegendEntry { + readonly key: Tier | 'code'; + readonly label: string; + readonly color: string; + readonly count: number; +} + +/** Per-tier node counts + colors for a legend (A/B/C/D then code), deterministic. */ +export function getTierLegend(graph: KnowledgeGraph): TierLegendEntry[] { + const count = (pred: (n: GraphNode) => boolean): number => graph.nodes.filter(pred).length; + const tiers: TierLegendEntry[] = (['A', 'B', 'C', 'D'] as const).map((t) => ({ + key: t, + label: TIER_META[t].label, + color: TIER_META[t].color, + count: count((n) => n.tier === t), + })); + tiers.push({key: 'code', label: 'Code', color: CODE_COLOR, count: count((n) => n.tier === undefined)}); + return tiers.filter((e) => e.count > 0); +} + +/** A mermaid/DOT-safe identifier derived from a node id. */ +function safeId(id: string): string { + return id.replace(/[^A-Za-z0-9]/g, '_'); +} + +/** A unique Obsidian note basename (kind-prefixed, filesystem-safe). */ +function noteName(node: GraphNode): string { + return `${node.kind}__${node.id.slice(node.kind.length + 1).replace(/[\\/]/g, '_')}`; +} + +const SHAPE: Record = { + feature: ['[', ']'], // rectangle + module: ['[(', ')]'], // cylinder (code on disk) + skill: ['[[', ']]'], // subroutine (a skill / verb) + test: ['([', '])'], // stadium + scenario: ['{{', '}}'], // hexagon + capability: ['((', '))'], // circle (high-level) + doc: ['>', ']'], // asymmetric (a note) +}; + +/** Mermaid `graph LR` of the (sub)graph, with per-tier color classes. */ +export function toMermaid(graph: KnowledgeGraph): string { + const lines: string[] = ['graph LR']; + for (const n of graph.nodes) { + const [open, close] = SHAPE[n.kind]; + const text = `${n.label}`.replace(/"/g, "'"); + lines.push(` ${safeId(n.id)}${open}"${text}"${close}`); + } + for (const e of graph.edges) { + lines.push(` ${safeId(e.from)} -->|${e.kind}| ${safeId(e.to)}`); + } + // Tier coloring: one classDef per tier present + a `code` class, then assign. + for (const {key, color} of getTierLegend(graph)) { + lines.push(` classDef ${key} fill:${color},stroke:${color},color:#fff;`); + const members = graph.nodes + .filter((n) => (key === 'code' ? n.tier === undefined : n.tier === key)) + .map((n) => safeId(n.id)); + if (members.length > 0) lines.push(` class ${members.join(',')} ${key};`); + } + return `${lines.join('\n')}\n`; +} + +/** Graphviz DOT digraph. */ +export function toDot(graph: KnowledgeGraph): string { + const lines: string[] = ['digraph cladding {', ' rankdir=LR;', ' node [shape=box];']; + for (const n of graph.nodes) { + lines.push(` "${n.id}" [label="${n.label.replace(/"/g, '\\"')}"];`); + } + for (const e of graph.edges) { + lines.push(` "${e.from}" -> "${e.to}" [label="${e.kind}"];`); + } + lines.push('}'); + return `${lines.join('\n')}\n`; +} + +/** Plain graph JSON ({nodes, edges}) for any programmatic / 3rd-party viewer. */ +export function toJson(graph: KnowledgeGraph): string { + return `${JSON.stringify(graph, null, 2)}\n`; +} + +/** + * Renders an Obsidian-compatible vault: a map of relative file path → markdown. + * Each node becomes one note carrying its kind/status, its outgoing edges as + * [[wikilinks]], and a Backlinks section listing incoming edges. + */ +export function toObsidianVault(graph: KnowledgeGraph): Map { + const byId = new Map(graph.nodes.map((n) => [n.id, n])); + const out = new Map(); + const inc = new Map(); + for (const e of graph.edges) { + (out.get(e.from) ?? out.set(e.from, []).get(e.from)!).push({other: e.to, kind: e.kind}); + (inc.get(e.to) ?? inc.set(e.to, []).get(e.to)!).push({other: e.from, kind: e.kind}); + } + + const link = (id: string): string => { + const n = byId.get(id); + return n ? `[[${noteName(n)}|${n.label}]]` : `[[${id}]]`; + }; + + const vault = new Map(); + for (const n of graph.nodes) { + const lines: string[] = [ + '---', + `kind: ${n.kind}`, + ...(n.tier ? [`tier: ${n.tier}`] : []), + ...(n.status ? [`status: ${n.status}`] : []), + `id: ${JSON.stringify(n.id)}`, + '---', + `# ${n.label}`, + '', + ]; + const outs = (out.get(n.id) ?? []).slice().sort(byEdgeView); + if (outs.length > 0) { + lines.push('## Links'); + for (const e of outs) lines.push(`- ${e.kind} → ${link(e.other)}`); + lines.push(''); + } + const ins = (inc.get(n.id) ?? []).slice().sort(byEdgeView); + if (ins.length > 0) { + lines.push('## Backlinks'); + for (const e of ins) lines.push(`- ${link(e.other)} → ${e.kind}`); + lines.push(''); + } + vault.set(`${n.kind}/${noteName(n)}.md`, `${lines.join('\n')}`); + } + return vault; +} + +interface GraphEdgeView { + readonly other: string; + readonly kind: EdgeKind; +} +function byEdgeView(a: GraphEdgeView, b: GraphEdgeView): number { + return a.kind.localeCompare(b.kind) || a.other.localeCompare(b.other); +} diff --git a/src/graph/stats.ts b/src/graph/stats.ts new file mode 100644 index 00000000..7143dcdc --- /dev/null +++ b/src/graph/stats.ts @@ -0,0 +1,72 @@ +// Cladding · graph · stats — F-569f4b37 +// +// Node/edge counts by kind + the highest-degree nodes ("hubs"). The hubs are +// what the bright centres in a force-graph represent: the load-bearing +// features/files that everything else hangs off. Surfacing them lets a human — +// and the LLM — know what to touch carefully in a long-lived project. + +import type {EdgeKind, KnowledgeGraph, NodeKind} from './model.js'; + +export interface HubEntry { + readonly id: string; + readonly kind: NodeKind; + readonly label: string; + readonly degree: number; +} + +export interface GraphStats { + readonly nodeCount: number; + readonly edgeCount: number; + readonly nodesByKind: Readonly>; + readonly edgesByKind: Readonly>; + /** Highest total-degree nodes (in + out), descending. */ + readonly hubs: readonly HubEntry[]; +} + +/** Computes counts + the top `topN` hubs by total (in+out) degree. */ +export function graphStats(graph: KnowledgeGraph, topN: number = 10): GraphStats { + const nodesByKind: Record = {}; + for (const n of graph.nodes) nodesByKind[n.kind] = (nodesByKind[n.kind] ?? 0) + 1; + + const edgesByKind: Record = {}; + const degree = new Map(); + for (const e of graph.edges) { + edgesByKind[e.kind] = (edgesByKind[e.kind] ?? 0) + 1; + degree.set(e.from, (degree.get(e.from) ?? 0) + 1); + degree.set(e.to, (degree.get(e.to) ?? 0) + 1); + } + + const hubs: HubEntry[] = graph.nodes + .map((n) => ({id: n.id, kind: n.kind, label: n.label, degree: degree.get(n.id) ?? 0})) + // Descending by degree; ties broken by id for determinism. + .sort((a, b) => b.degree - a.degree || a.id.localeCompare(b.id)) + .slice(0, topN); + + return { + nodeCount: graph.nodes.length, + edgeCount: graph.edges.length, + nodesByKind, + edgesByKind, + hubs, + }; +} + +/** A compact human-readable rendering of the stats (for `clad graph stats`). */ +export function renderStats(stats: GraphStats): string { + const kinds = (rec: Readonly>): string => + Object.keys(rec) + .sort() + .map((k) => `${k}=${rec[k]}`) + .join(' '); + const lines = [ + `nodes: ${stats.nodeCount} (${kinds(stats.nodesByKind)})`, + `edges: ${stats.edgeCount} (${kinds(stats.edgesByKind)})`, + 'hubs (top by degree):', + ...stats.hubs.map((h, i) => ` ${String(i + 1).padStart(2)}. [${h.kind}] ${h.label} — degree ${h.degree}`), + ]; + return `${lines.join('\n')}\n`; +} + +// EdgeKind is re-exported only to keep the public surface explicit for consumers +// that pattern-match on edge kinds when post-processing stats. +export type {EdgeKind}; diff --git a/src/graph/stellar.ts b/src/graph/stellar.ts new file mode 100644 index 00000000..dbcfbcc4 --- /dev/null +++ b/src/graph/stellar.ts @@ -0,0 +1,170 @@ +// Cladding · graph · stellar color math — F webgl-stellar-viewer +// +// Pure, headless-testable color logic for the WebGL galaxy viewer. The reference +// (DeusData/codebase-memory-mcp) colors stars BY DEGREE (blue-white giants → red +// dwarfs) and BOOSTS every instance color above 1.0 so an UnrealBloom pass picks up +// the excess as a glow corona (`meshBasicMaterial vertexColors toneMapped={false}`). +// +// We keep cladding's VALUE — node HUE still encodes meaning (SSoT tier A/B/C/D, or the +// kind feature/scenario/capability/module/test/doc) — and fold the reference's stellar +// idea on top: DEGREE drives LUMINOSITY (a node's core is mixed toward white the more +// load-bearing it is), and that brighter core in turn earns a stronger bloom boost. So +// hubs burn blue/violet/teal-white with a wide corona; leaves stay dim and hue-true. +// +// The viewer (src/graph/viewer/main.ts, WebGL, untestable headless) imports these exact +// functions, so what the tests pin is what ships. Colors are returned as linear RGB in +// 0..1 and MAY exceed 1.0 on purpose (that overflow is what blooms). + +/** A node as the color math needs it — only hue inputs. */ +export interface ColorNode { + readonly tier?: string; + readonly kind?: string; +} + +export type Rgb = readonly [number, number, number]; + +/** SSoT tier hue (A/B/C/D) — used only by the sidebar tier FILTER, no longer by node hue. */ +export const TIER_COL: Readonly> = { + A: '#3b82f6', // spec (sealed) — blue + B: '#a855f7', // design — violet + C: '#14b8a6', // derived — teal + D: '#f59e0b', // audit — amber +}; + +// Per-kind hue — the ONE thing a node's color encodes (tier no longer touches hue). +// Grouped by what the node IS, so the group reads at a glance on the near-black galaxy: +// SPEC = blue family (feature/scenario/capability) — similar blues, told apart by luminance +// CODE = orange (module) · TEST = green (test) — the two strong anchors, deliberately far apart +// DOCS = pink family (doc/skill) — skill is SKILL.md, a document, NOT code +// All hexes verified Y≥125 (bloom floor) and clear of the 0-45° health-burn arc, EXCEPT module +// orange (anchor, kept from the original) — the health burn pulses 2.2-3× so motion disambiguates. +export const KIND_COL: Readonly> = { + feature: '#4f8ef7', // SPEC — blue (anchor) + scenario: '#45b5ed', // SPEC — cyan-blue + capability: '#8f86f0', // SPEC — lavender-blue + module: '#f97316', // CODE — orange (anchor) + test: '#22c55e', // TEST — green (anchor) + doc: '#f368a8', // DOCS — rose + skill: '#f7a8e6', // DOCS — light pink (SKILL.md is a doc, not code) +}; + +/** Per-edge-kind hue (additive filaments). */ +export const EDGE_COL: Readonly> = { + depends_on: '#3b82f6', + touches: '#f97316', + covers: '#22c55e', + binds: '#22d3ee', + implements: '#a855f7', + references: '#ec4899', + links: '#64748b', +}; + +export const DEFAULT_NODE = '#9ca3af'; +export const DEFAULT_EDGE = '#1C8585'; // reference's DEFAULT_EDGE_COLOR + +/** "#rgb" or "#rrggbb" → linear RGB in 0..1. */ +export function hexToRgb01(hex: string): Rgb { + let h = String(hex).replace('#', ''); + if (h.length === 3) h = h[0] + h[0] + h[1] + h[1] + h[2] + h[2]; + const v = parseInt(h, 16) || 0; + return [((v >> 16) & 255) / 255, ((v >> 8) & 255) / 255, (v & 255) / 255]; +} + +/** + * The semantic hue (hex): KIND only, never tier. Encoding both tier and kind in one hue + * double-counted (tier is derivable from kind) and collided — same blue meant "feature" AND + * "tier A". Tier now lives in the sidebar filter + tooltip, not the node color. + */ +export function semanticHue(node: ColorNode): string { + return (node.kind && KIND_COL[node.kind]) || DEFAULT_NODE; +} + +/** Node sphere radius from degree — bounded so the biggest hub never dominates. */ +export function nodeRadius(deg: number): number { + return Math.min(15, 3 + Math.sqrt(Math.max(0, deg)) * 1.7); +} + +/** 0..1 luminosity from degree (the "stellar class": hubs → 1, leaves → 0). */ +export function degreeLuminosity(deg: number, maxDeg: number): number { + return maxDeg > 0 ? Math.max(0, Math.min(1, deg / maxDeg)) : 0; +} + +function mix(a: Rgb, b: Rgb, t: number): Rgb { + return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t]; +} + +const WHITE: Rgb = [1, 1, 1]; + +/** Core color: the hue mixed toward white by luminosity — hubs run hot/white. */ +export function coreColor(hue: Rgb, norm: number): Rgb { + return mix(hue, WHITE, 0.1 + 0.46 * Math.max(0, Math.min(1, norm))); +} + +/** + * Push color above 1.0 so the bloom pass renders the excess as a corona. + * Verbatim from the reference: boost = 1.2 + brightness*0.8 (1.2× red → 2.0× white). + * Because coreColor already whitens hubs, hubs land near 2.0× → big corona. + */ +export function bloomBoost(rgb: Rgb): Rgb { + const brightness = (rgb[0] + rgb[1] + rgb[2]) / 3; + const boost = 1.2 + brightness * 0.8; + return [rgb[0] * boost, rgb[1] * boost, rgb[2] * boost]; +} + +/** Drift override (the live killer): a node burns red (error) / amber (warn), far above 1.0. */ +export function healthOverride(severity: 'error' | 'warn', norm: number, pulse = 1): Rgb { + const base: Rgb = severity === 'error' ? [239 / 255, 68 / 255, 68 / 255] : [245 / 255, 158 / 255, 11 / 255]; + const mag = (2.2 + 0.8 * Math.max(0, Math.min(1, norm))) * pulse; // brightest things on screen + return [base[0] * mag, base[1] * mag, base[2] * mag]; +} + +export interface InstanceColorOpts { + readonly node: ColorNode; + readonly deg: number; + readonly maxDeg: number; + /** A highlight set is active and this node is NOT in it → dim (no boost). */ + readonly dimmed?: boolean; + /** Live drift on this node → burn instead of hue. */ + readonly health?: {readonly severity: 'error' | 'warn'} | null; + /** Pulse multiplier for the health burn (1 = steady). */ + readonly pulse?: number; +} + +/** + * The final per-instance linear RGB (may exceed 1.0 → blooms). Mutually exclusive + * branches, matching the reference: a node is dimmed (×0.15) OR burning OR boosted. + */ +export function instanceColor(opts: InstanceColorOpts): Rgb { + const hue = hexToRgb01(semanticHue(opts.node)); + const norm = degreeLuminosity(opts.deg, opts.maxDeg); + const core = coreColor(hue, norm); + if (opts.dimmed) return [core[0] * 0.15, core[1] * 0.15, core[2] * 0.15]; + if (opts.health) return healthOverride(opts.health.severity, norm, opts.pulse ?? 1); + return bloomBoost(core); +} + +/** Edge filament hue. */ +export function edgeColor(kind: string): string { + return EDGE_COL[kind] || DEFAULT_EDGE; +} + +export interface EdgeIntensityOpts { + readonly highlightActive: boolean; + readonly sourceHi: boolean; + readonly targetHi: boolean; + /** Endpoints share a kind (cladding's analogue of the reference's same-cluster). */ + readonly sameKind: boolean; +} + +/** + * Edge brightness scalar (premultiplied into the additive line color). Returns 0 when a + * highlight is active and neither endpoint is in it — the caller skips drawing that edge. + * Verbatim intensities from the reference EdgeLines. + */ +export function edgeIntensity(o: EdgeIntensityOpts): number { + if (o.highlightActive) { + if (!o.sourceHi && !o.targetHi) return 0; // skipped + return o.sourceHi && o.targetHi ? 0.5 : 0.04; + } + return o.sameKind ? 0.25 : 0.06; +} diff --git a/src/graph/viewer-shell.ts b/src/graph/viewer-shell.ts new file mode 100644 index 00000000..d2de333d --- /dev/null +++ b/src/graph/viewer-shell.ts @@ -0,0 +1,97 @@ +// Cladding · graph · self-contained HTML viewer shell — F-02343cd1 / F webgl-stellar-viewer +// +// toHtmlShell(graph) returns ONE offline HTML string: the graph data + the WebGL stellar +// galaxy viewer (the esbuild-bundled dist/viewer/app.js — three.js + jsm addons + the +// stellar/layout cores — plus styles.css, inlined as text). No CDN, no \n` + : ''; + return ` + + + + +cladding · knowledge graph + + + +
+ +
+ +
+
drag = orbit · scroll = zoom · click node = focus · hover = details
+ +${healthScript} + + +`; +} diff --git a/src/graph/viewer/main.ts b/src/graph/viewer/main.ts new file mode 100644 index 00000000..ffa34daa --- /dev/null +++ b/src/graph/viewer/main.ts @@ -0,0 +1,695 @@ +// Cladding · knowledge-graph viewer — REAL three.js stellar galaxy (F webgl-stellar-viewer) +// +// A faithful replication of DeusData/codebase-memory-mcp's WebGL look over cladding's own +// SSoT graph: instanced sphere "stars" whose colors are boosted >1.0 so an UnrealBloom pass +// renders the excess as a glow corona, additive edge filaments, deep-space background, +// OrbitControls + 60s idle auto-rotate. Vanilla three.js (no React) bundled offline by +// scripts/build.mjs (esbuild → dist/viewer/app.js, three vendored in, zero network). +// +// What stays cladding's: node HUE encodes meaning (SSoT tier / kind) while DEGREE drives +// luminosity (stellar.ts); and the LIVE KILLER — drift nodes BURN red/amber and heal on an +// SSE refresh (window.__CLADDING_HEALTH / clad graph serve's /health.json). +// +// This file is the WebGL glue and cannot run headless (no GL in vitest); the testable cores +// it imports — ../stellar and ../layout3d — are pinned by tests, so the tested math ships. +// +// eslint-disabled via src/graph/viewer/** ignore; tsc-excluded (DOM + three globals). + +import * as THREE from 'three'; +import {OrbitControls} from 'three/examples/jsm/controls/OrbitControls.js'; +import {EffectComposer} from 'three/examples/jsm/postprocessing/EffectComposer.js'; +import {RenderPass} from 'three/examples/jsm/postprocessing/RenderPass.js'; +import {UnrealBloomPass} from 'three/examples/jsm/postprocessing/UnrealBloomPass.js'; +import {OutputPass} from 'three/examples/jsm/postprocessing/OutputPass.js'; + +import {computeLayout3d} from '../layout3d'; +import {edgeColor, edgeIntensity, instanceColor, KIND_COL, nodeRadius, semanticHue} from '../stellar'; + +// What-I-write is what-renders: skip sRGB conversion so boosted (>1) linear colors bloom. +THREE.ColorManagement.enabled = false; + +(function () { + 'use strict'; + const G: any = (window as any).__CLADDING_GRAPH || {nodes: [], edges: [], legend: [], tierMeta: {}, codeColor: '#9ca3af'}; + let HEALTH: any = (window as any).__CLADDING_HEALTH || null; + + const canvas = document.getElementById('g') as HTMLCanvasElement; + if (!canvas) return; + + // ---- graph model: nodes, degree, adjacency ---- + const nodes: any[] = (G.nodes || []).map((n: any) => ({...n})); + const byId: Record = {}; + nodes.forEach((n, i) => { + n._i = i; + n.deg = 0; + byId[n.id] = n; + }); + const edges: any[] = (G.edges || []) + .map((e: any) => ({s: byId[e.from], t: byId[e.to], kind: e.kind})) + .filter((e: any) => e.s && e.t && e.s !== e.t); + const adj: Record> = {}; + nodes.forEach((n) => (adj[n.id] = {})); + edges.forEach((e) => { + e.s.deg++; + e.t.deg++; + adj[e.s.id][e.t.id] = 1; + adj[e.t.id][e.s.id] = 1; + }); + const maxDeg = nodes.reduce((m, n) => Math.max(m, n.deg), 1); + + // ---- WebGL renderer (graceful fallback if unavailable) ---- + let renderer: THREE.WebGLRenderer; + try { + renderer = new THREE.WebGLRenderer({canvas, antialias: false, alpha: false, powerPreference: 'high-performance'}); + } catch { + const stage = document.getElementById('stage') || document.body; + const msg = document.createElement('div'); + msg.setAttribute( + 'style', + 'position:fixed;inset:0;display:flex;align-items:center;justify-content:center;color:#8b949e;font:14px -apple-system,sans-serif;text-align:center;padding:24px', + ); + msg.textContent = 'This 3D graph needs WebGL — enable hardware acceleration or open it in a WebGL-capable browser.'; + stage.replaceChildren(msg); + return; + } + renderer.setPixelRatio(Math.min(1.5, Math.max(1, window.devicePixelRatio || 1))); + renderer.toneMapping = THREE.NoToneMapping; + + const scene = new THREE.Scene(); + scene.background = new THREE.Color(0x010204); // deep space (darker per user) — NO fog + const camera = new THREE.PerspectiveCamera(50, 1, 0.1, 100000); + camera.position.set(0, 0, 800); + scene.add(new THREE.AmbientLight(0xffffff, 0.5)); + const pl1 = new THREE.PointLight(0xffffff, 0.6); + pl1.position.set(500, 500, 500); + const pl2 = new THREE.PointLight(0x6040ff, 0.4); + pl2.position.set(-300, -200, -300); + scene.add(pl1, pl2); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.dampingFactor = 0.08; + controls.rotateSpeed = 0.5; + controls.zoomSpeed = 1.5; + controls.minDistance = 10; + controls.maxDistance = 50000; + controls.autoRotateSpeed = 0.4; + controls.autoRotate = false; + + // ---- deterministic 3D layout (tested in layout3d.ts) ---- + const pos = computeLayout3d( + nodes.map((n) => ({id: n.id, kind: n.kind})), + edges.map((e) => ({from: e.s.id, to: e.t.id})), + ); + nodes.forEach((n) => { + const p = pos[n.id] || [0, 0, 0]; + n.x = p[0]; + n.y = p[1]; + n.z = p[2]; + }); + // Pull the camera back to frame the WHOLE galaxy with margin (not zoomed-in/packed): + // distance to fit the cluster's bounding sphere in the vertical fov, ×1.4 breathing room. + let maxR = 1; + nodes.forEach((n) => { + const r = Math.hypot(n.x, n.y, n.z); + if (r > maxR) maxR = r; + }); + const initialDist = Math.min(50000, (maxR / Math.sin(((camera.fov * Math.PI) / 180) / 2)) * 1.12); + camera.position.set(0, 0, initialDist); + + // ---- nodes: one InstancedMesh of unit spheres; per-instance color via the geometry + // 'color' attribute (vertexColors path — exactly the reference's instancedBufferAttribute + // attach="geometry-attributes-color"). Values may exceed 1.0 → bloom corona. ---- + const geo = new THREE.SphereGeometry(1, 20, 16); + const mat = new THREE.MeshBasicMaterial({vertexColors: true, toneMapped: false}); + const mesh = new THREE.InstancedMesh(geo, mat, nodes.length); + mesh.frustumCulled = false; + const colorArr = new Float32Array(nodes.length * 3); + const colorAttr = new THREE.InstancedBufferAttribute(colorArr, 3); + geo.setAttribute('color', colorAttr); + scene.add(mesh); + const dummy = new THREE.Object3D(); + function writeColor(i: number, rgb: readonly number[]): void { + colorArr[i * 3] = rgb[0]; + colorArr[i * 3 + 1] = rgb[1]; + colorArr[i * 3 + 2] = rgb[2]; + } + + // ---- edges: one additive LineSegments ---- + const edgeGeo = new THREE.BufferGeometry(); + const edgeMat = new THREE.LineBasicMaterial({ + vertexColors: true, + transparent: true, + opacity: 0.22, // additive edges converge at the core → keep them faint so they don't wash out + blending: THREE.AdditiveBlending, + depthWrite: false, + toneMapped: false, + }); + const edgeLines = new THREE.LineSegments(edgeGeo, edgeMat); + edgeLines.frustumCulled = false; + scene.add(edgeLines); + const edgePos = new Float32Array(edges.length * 6); + const edgeCol = new Float32Array(edges.length * 6); + + // ---- post: UnrealBloom (strength=intensity, radius, threshold) + OutputPass ---- + const composer = new EffectComposer(renderer); + composer.addPass(new RenderPass(scene, camera)); + // strength / radius / threshold — tuned DOWN from the reference (1.2/0.6/0.3): with our + // ~726 boosted nodes the whole field bloomed ("너무 빛나"). A higher threshold means only + // the brightest (hub/whitened) stars glow; lower strength keeps it from washing out. + const bloom = new UnrealBloomPass(new THREE.Vector2(1, 1), 0.24, 0.4, 1.0); + composer.addPass(bloom); + composer.addPass(new OutputPass()); + + function fit(): void { + const w = canvas.clientWidth || window.innerWidth; + const h = canvas.clientHeight || window.innerHeight; + renderer.setSize(w, h, false); + composer.setSize(w, h); + bloom.setSize(w, h); + camera.aspect = w / h; + // Account for the fixed left sidebar (≈264px): shift the camera's optical center right by + // half the panel so the galaxy (centered on the origin) sits in the VISIBLE area, not under + // the panel. setViewOffset offsetX<0 moves the rendered content right. + const sidebar = w > 760 ? 280 : 0; + if (sidebar) camera.setViewOffset(w, h, -sidebar / 2, 0, w, h); + else camera.clearViewOffset(); + camera.updateProjectionMatrix(); + } + + // ---- view state ---- + const enabledKind: Record = {}; + const enabledTier: Record = {}; + ['feature', 'module', 'skill', 'test', 'scenario', 'capability', 'doc'].forEach((k) => (enabledKind[k] = true)); + ['A', 'B', 'C', 'D', 'code'].forEach((t) => (enabledTier[t] = true)); + // Display label for a kind in the UI (sidebar + tooltip). The spec calls a feature's files + // "modules", but to a reader those are just code — show "code". Data model is unchanged. + const kindLabel = (k: string): string => (k === 'module' ? 'code' : k); + let showLabels = true; // default ON (top-degree labels) + let healthOn = true; + let hoverId: string | null = null; + let selId: string | null = null; + let lastInteraction = 0; // set after boot + let driftIdx: number[] = []; + + const tierKey = (n: any): string => n.tier || 'code'; + const visible = (n: any): boolean => enabledKind[n.kind] && enabledTier[tierKey(n)]; + const focusNode = (): any => (selId && byId[selId]) || (hoverId && byId[hoverId]) || null; + const lit = (n: any, f: any): boolean => !f || n.id === f.id || !!adj[f.id][n.id]; + + // ---- build / rebuild instance matrices + colors + edges ---- + function rebuildMatrices(): void { + const f = focusNode(); + for (let i = 0; i < nodes.length; i++) { + const n = nodes[i]; + let s = nodeRadius(n.deg) * 0.78; + if (!visible(n)) s = 0; + else { + const dim = f && !lit(n, f); + if (dim) s *= 0.4; // reference 0.2/0.5 ratio + if (selId === n.id) s *= 1.7; + } + dummy.position.set(n.x, n.y, n.z); + dummy.scale.setScalar(s); + dummy.updateMatrix(); + mesh.setMatrixAt(i, dummy.matrix); + } + mesh.instanceMatrix.needsUpdate = true; + mesh.computeBoundingSphere(); + } + + function colorFor(n: any, pulse: number): [number, number, number] { + const f = focusNode(); + const dimmed = !!(f && !lit(n, f)); + const health = healthOn && HEALTH && HEALTH[n.id] ? {severity: HEALTH[n.id].severity} : null; + return instanceColor({node: n, deg: n.deg, maxDeg, dimmed, health, pulse}) as any; + } + + function rebuildColors(pulse: number): void { + for (let i = 0; i < nodes.length; i++) { + const n = nodes[i]; + writeColor(i, visible(n) ? colorFor(n, pulse) : [0, 0, 0]); + } + colorAttr.needsUpdate = true; + } + + function recomputeDrift(): void { + driftIdx = []; + if (!healthOn || !HEALTH) return; + for (let i = 0; i < nodes.length; i++) if (HEALTH[nodes[i].id] && visible(nodes[i])) driftIdx.push(i); + } + + function pulseDrift(pulse: number): void { + if (!driftIdx.length) return; + for (const i of driftIdx) writeColor(i, colorFor(nodes[i], pulse)); + colorAttr.needsUpdate = true; + } + + function rebuildEdges(): void { + const f = focusNode(); + const hl = !!f; + let k = 0; + for (let e = 0; e < edges.length; e++) { + const ed = edges[e]; + if (!visible(ed.s) || !visible(ed.t)) continue; + const sHi = !f || lit(ed.s, f); + const tHi = !f || lit(ed.t, f); + const inten = edgeIntensity({highlightActive: hl, sourceHi: sHi, targetHi: tHi, sameKind: ed.s.kind === ed.t.kind}); + if (inten <= 0) continue; + const c = hexToRgbArr(edgeColor(ed.kind)); + const r = c[0] * inten; + const g = c[1] * inten; + const b = c[2] * inten; + edgePos[k] = ed.s.x; + edgePos[k + 1] = ed.s.y; + edgePos[k + 2] = ed.s.z; + edgePos[k + 3] = ed.t.x; + edgePos[k + 4] = ed.t.y; + edgePos[k + 5] = ed.t.z; + edgeCol[k] = r; + edgeCol[k + 1] = g; + edgeCol[k + 2] = b; + edgeCol[k + 3] = r; + edgeCol[k + 4] = g; + edgeCol[k + 5] = b; + k += 6; + } + edgeGeo.setAttribute('position', new THREE.BufferAttribute(edgePos.slice(0, k), 3)); + edgeGeo.setAttribute('color', new THREE.BufferAttribute(edgeCol.slice(0, k), 3)); + } + + function hexToRgbArr(hex: string): [number, number, number] { + let h = hex.replace('#', ''); + if (h.length === 3) h = h[0] + h[0] + h[1] + h[1] + h[2] + h[2]; + const v = parseInt(h, 16) || 0; + return [((v >> 16) & 255) / 255, ((v >> 8) & 255) / 255, (v & 255) / 255]; + } + + function rebuildAll(): void { + rebuildMatrices(); + rebuildColors(1); + rebuildEdges(); + recomputeDrift(); + rebuildLabels(); + } + + // ---- labels: top-degree nodes as billboard sprites (gated by toggle) ---- + const labelGroup = new THREE.Group(); + scene.add(labelGroup); + function clearLabels(): void { + while (labelGroup.children.length) { + const c: any = labelGroup.children.pop(); + if (c.material) { + if (c.material.map) c.material.map.dispose(); + c.material.dispose(); + } + } + } + function makeLabel(text: string, hex: string, h = 11): THREE.Sprite { + const pad = 8; + const c = document.createElement('canvas'); + const cx = c.getContext('2d')!; + cx.font = '600 64px Inter, system-ui, sans-serif'; + const tw = cx.measureText(text).width; + c.width = Math.ceil(tw + pad * 2); + c.height = 80; + cx.font = '600 64px Inter, system-ui, sans-serif'; + cx.textBaseline = 'middle'; + cx.lineWidth = 11; + cx.strokeStyle = 'rgba(0,0,0,0.96)'; // stronger dark halo so labels read on the bright core too + cx.strokeText(text, pad, c.height / 2); + cx.fillStyle = hex; + cx.fillText(text, pad, c.height / 2); + const tex = new THREE.CanvasTexture(c); + tex.minFilter = THREE.LinearFilter; + tex.generateMipmaps = false; + const sp = new THREE.Sprite(new THREE.SpriteMaterial({map: tex, transparent: true, depthWrite: false, toneMapped: false})); + sp.scale.set((c.width / c.height) * h, h, 1); + sp.renderOrder = 20; + return sp; + } + function rebuildLabels(): void { + clearLabels(); + if (!showLabels) return; + const f = focusNode(); + let show: any[]; + if (f) { + // A node is selected/focused: ALWAYS label it, plus its lit neighbourhood — so the + // selected node's label is guaranteed visible and you can read what it connects to. + const neighbours = nodes.filter((n) => visible(n) && n.id !== f.id && lit(n, f)).sort((a, b) => b.deg - a.deg); + show = [f, ...neighbours].slice(0, 60); + } else { + show = nodes.filter(visible).sort((a, b) => b.deg - a.deg).slice(0, 30); + } + for (const n of show) { + const isFocus = !!f && n.id === f.id; + const text = isFocus ? n.label : n.label.length > 28 ? n.label.slice(0, 27) + '…' : n.label; + const sp = makeLabel(text, semanticHue(n), isFocus ? 15 : 11); // selected: full text, bigger + sp.position.set(n.x, n.y + nodeRadius(n.deg) * 0.8 + 8, n.z); + labelGroup.add(sp); + } + } + + // ---- raycast hover / click ---- + const raycaster = new THREE.Raycaster(); + const ndc = new THREE.Vector2(); + function pickAt(clientX: number, clientY: number): any { + const rc = canvas.getBoundingClientRect(); + ndc.x = ((clientX - rc.left) / rc.width) * 2 - 1; + ndc.y = -((clientY - rc.top) / rc.height) * 2 + 1; + raycaster.setFromCamera(ndc, camera); + const hits = raycaster.intersectObject(mesh); + for (const h of hits) { + const id = (h as any).instanceId; + if (id != null && visible(nodes[id])) return nodes[id]; + } + return null; + } + + // Small DOM builder — textContent auto-escapes, so we build nodes instead of + // concatenating raw HTML strings (the project's ai_hints forbids HTML injection). + function mkEl(tag: string, cls?: string): HTMLElement { + const e = document.createElement(tag); + if (cls) e.className = cls; + return e; + } + const tipEl = document.getElementById('tip'); + function showTip(n: any, clientX: number, clientY: number): void { + if (!tipEl) return; + if (!n) { + tipEl.style.display = 'none'; + return; + } + const c = semanticHue(n); + const tl = n.tier ? 'Tier ' + n.tier : 'code'; + const hv = HEALTH && HEALTH[n.id]; + const frag = document.createDocumentFragment(); + const title = mkEl('div', 't'); + title.textContent = n.label; + const meta = mkEl('div', 'm'); + const k = mkEl('span', 'k'); + k.style.background = c; + k.textContent = kindLabel(n.kind) + ' · ' + tl; + meta.appendChild(k); + if (n.status) meta.appendChild(document.createTextNode(' · ' + n.status)); + frag.append(title, meta); + if (hv) { + const w = mkEl('div', 'm'); + w.style.color = hv.severity === 'error' ? '#ef4444' : '#f59e0b'; + w.textContent = '⚠ ' + ((hv.detectors || []).join(', ') || hv.severity); + frag.appendChild(w); + } + if (n.detail && n.detail !== n.label) { + const d = mkEl('div', 'm'); + d.textContent = n.detail; + frag.appendChild(d); + } + const idd = mkEl('div', 'm'); + idd.textContent = n.id; + frag.appendChild(idd); + tipEl.replaceChildren(frag); + tipEl.style.display = 'block'; + tipEl.style.left = clientX + 14 + 'px'; + tipEl.style.top = clientY + 14 + 'px'; + } + + let downX = 0, + downY = 0; + renderer.domElement.addEventListener('pointermove', (ev: PointerEvent) => { + const n = pickAt(ev.clientX, ev.clientY); + const id = n ? n.id : null; + if (id !== hoverId) { + hoverId = id; + rebuildMatrices(); + rebuildColors(1); + rebuildEdges(); + recomputeDrift(); + if (!selId) rebuildLabels(); // hover behaves like click for labels (unless a selection is pinned) + } + showTip(n, ev.clientX, ev.clientY); + canvas.style.cursor = n ? 'pointer' : 'grab'; + }); + renderer.domElement.addEventListener('pointerdown', (ev: PointerEvent) => { + downX = ev.clientX; + downY = ev.clientY; + lastInteraction = perfNow(); + controls.autoRotate = false; + }); + renderer.domElement.addEventListener('pointerup', (ev: PointerEvent) => { + if (Math.abs(ev.clientX - downX) > 5 || Math.abs(ev.clientY - downY) > 5) return; // was a drag + const n = pickAt(ev.clientX, ev.clientY); + selId = n ? (selId === n.id ? null : n.id) : null; + if (selId) flyTo(byId[selId]); + rebuildAll(); + }); + renderer.domElement.addEventListener('wheel', () => { + lastInteraction = perfNow(); + controls.autoRotate = false; + }); + + // ---- fly-to: frame the node + its CONNECTED neighbours (not a fixed close dolly) ---- + let flyTarget: THREE.Vector3 | null = null; + let flyDist = 0; + function flyTo(n: any): void { + const set = nodes.filter((m) => visible(m) && (m.id === n.id || !!adj[n.id][m.id])); + let cx = 0, + cy = 0, + cz = 0; + for (const m of set) { + cx += m.x; + cy += m.y; + cz += m.z; + } + const c = new THREE.Vector3(cx / set.length, cy / set.length, cz / set.length); + let R = nodeRadius(n.deg); + for (const m of set) R = Math.max(R, c.distanceTo(new THREE.Vector3(m.x, m.y, m.z))); + flyTarget = c; + // fit the neighbourhood sphere in the vertical fov + margin; a floor stops leaf over-zoom. + flyDist = Math.min(50000, Math.max(140, (R / Math.sin(((camera.fov * Math.PI) / 180) / 2)) * 1.5)); + } + + // ---- sidebar ---- + function kindCounts(): Record { + const c: Record = {}; + nodes.forEach((n) => (c[n.kind] = (c[n.kind] || 0) + 1)); + return c; + } + function filterRow( + key: string, + name: string, + sw: string, + count: number, + store: Record, + noSwatch = false, + ): HTMLElement { + const row = document.createElement('label'); + row.className = 'row' + (store[key] ? '' : ' off') + (noSwatch ? ' noswatch' : ''); + const cb = document.createElement('input'); + cb.type = 'checkbox'; + cb.checked = !!store[key]; + cb.onchange = () => { + store[key] = cb.checked; + row.className = 'row' + (cb.checked ? '' : ' off'); + rebuildAll(); + }; + const nm = document.createElement('span'); + nm.className = 'nm'; + nm.textContent = name; + const ct = document.createElement('span'); + ct.className = 'ct'; + ct.textContent = String(count); + if (noSwatch) { + // Tier filter rows carry no color (tier isn't a hue) → checkbox + label only, no empty box. + row.append(cb, nm, ct); + } else { + const s = document.createElement('span'); + s.className = 'sw'; + s.style.background = sw; + row.append(cb, s, nm, ct); + } + return row; + } + // Kinds grouped by what the node IS — the color legend reads spec/code/test/docs at a glance. + const KIND_ZONES: ReadonlyArray = [ + ['spec', ['feature', 'scenario', 'capability']], + ['code', ['module']], + ['test', ['test']], + ['docs', ['doc', 'skill']], + ]; + function buildSidebar(): void { + const kc = kindCounts(); + KIND_ZONES.forEach(([zone, kinds]) => { + const box = document.getElementById('kinds-' + zone); + if (!box) return; + box.replaceChildren(); + kinds.forEach((k) => { + if (kc[k]) box.appendChild(filterRow(k, kindLabel(k), KIND_COL[k] || '#9ca3af', kc[k], enabledKind)); + }); + }); + const th = document.getElementById('tiers'); + if (th) { + th.replaceChildren(); + // Tier is a FILTER only now (no longer a node hue) → render without a misleading color swatch. + (G.legend || []).forEach((L: any) => th.appendChild(filterRow(L.key, L.label, 'transparent', L.count, enabledTier, true))); + } + } + function btn(id: string, on: boolean, fn: (b: HTMLElement) => void): void { + const b = document.getElementById(id); + if (!b) return; + if (on) b.classList.add('on'); + b.onclick = () => fn(b); + } + const sb = document.getElementById('search') as HTMLInputElement | null; + if (sb) + sb.addEventListener('input', () => { + const q = sb.value.trim().toLowerCase(); + if (!q) return; + const m = nodes.find((n) => visible(n) && (n.label.toLowerCase().includes(q) || n.id.toLowerCase().includes(q))); + if (m) { + selId = m.id; + flyTo(m); + rebuildAll(); + } + }); + btn('labels', showLabels, (b) => { + showLabels = !showLabels; + b.classList.toggle('on', showLabels); + rebuildLabels(); + }); + btn('health', healthOn, (b) => { + healthOn = !healthOn; + b.classList.toggle('on', healthOn); + rebuildColors(1); + recomputeDrift(); + refreshPill(); + }); + btn('theme', document.documentElement.classList.contains('light'), (b) => { + // 3D canvas stays deep-space (additive bloom needs it); theme restyles UI chrome only. + const lt = document.documentElement.classList.toggle('light'); + b.classList.toggle('on', lt); + try { + localStorage.setItem('clad_graph_theme', lt ? 'light' : 'dark'); + } catch { + /* ignore */ + } + }); + const rb = document.getElementById('reset'); + if (rb) + rb.onclick = () => { + selId = null; + hoverId = null; + flyTarget = null; + controls.target.set(0, 0, 0); + camera.position.set(0, 0, initialDist); + rebuildAll(); + }; + + // ---- conformance pill ---- + function refreshPill(): void { + const el = document.getElementById('impact'); + if (!el) return; + if (!HEALTH || !healthOn) { + el.style.display = 'none'; + return; + } + let bad = 0; + for (const k in HEALTH) if (Object.prototype.hasOwnProperty.call(HEALTH, k)) bad++; + const pct = Math.max(0, Math.round((1 - bad / (nodes.length || 1)) * 100)); + el.style.display = 'block'; + const dot = mkEl('span', 'dot'); + dot.style.background = bad ? '#f59e0b' : '#22c55e'; + el.replaceChildren(dot, document.createTextNode(' spec↔code ' + pct + '% in sync · ' + bad + ' drift')); + } + + // ---- live mode (clad graph serve): SSE refresh ---- + function applyHealth(h: any): void { + HEALTH = h && Object.keys(h).length ? h : null; + rebuildColors(1); + recomputeDrift(); + refreshPill(); + } + function liveWire(): void { + if (typeof fetch !== 'function' || typeof EventSource !== 'function') return; + fetch('graph.json', {cache: 'no-store'}) + .then((r) => { + if (!r.ok) return; // static export / file:// → embedded data only + const pull = (): void => { + fetch('health.json', {cache: 'no-store'}) + .then((r2) => (r2.ok ? r2.json() : null)) + .then(applyHealth) + .catch(() => undefined); + }; + pull(); + const es = new EventSource('events'); + es.onmessage = () => { + fetch('graph.json', {cache: 'no-store'}) + .then((r2) => (r2.ok ? r2.json() : null)) + .then((g2) => { + if (g2 && g2.nodes && g2.nodes.length !== nodes.length) { + location.reload(); + return; + } + pull(); // health-only → smooth heal + }) + .catch(() => undefined); + }; + }) + .catch(() => undefined); + } + + // ---- timing (perf.now, no Date in the hot loop) ---- + function perfNow(): number { + return typeof performance !== 'undefined' && performance.now ? performance.now() : 0; + } + + // ---- frame loop ---- + const t0 = perfNow(); + function frame(): void { + requestAnimationFrame(frame); + const t = (perfNow() - t0) / 1000; + controls.autoRotate = perfNow() - lastInteraction > 6000; // gently auto-rotate after 6s idle (was 60s) + controls.update(); + if (flyTarget) { + controls.target.lerp(flyTarget, 0.1); + const dir = camera.position.clone().sub(controls.target).normalize(); + const want = flyTarget.clone().add(dir.multiplyScalar(flyDist)); + camera.position.lerp(want, 0.08); + if (controls.target.distanceTo(flyTarget) < 1) flyTarget = null; + } + if (driftIdx.length) pulseDrift(0.6 + 0.4 * Math.sin(t * 2.6)); + composer.render(); + } + + // ---- boot ---- + try { + if (localStorage.getItem('clad_graph_theme') === 'light') document.documentElement.classList.add('light'); + } catch { + /* ignore */ + } + fit(); + buildSidebar(); + rebuildAll(); + refreshPill(); + liveWire(); + lastInteraction = perfNow(); + window.addEventListener('resize', fit); + frame(); + + // debug seam (no GL needed by callers): expose state + the pure cores used + try { + (window as any).__CLAD_VIEWER_DEBUG = { + nodeCount: nodes.length, + edgeCount: edges.length, + maxDeg, + get hoverId() { + return hoverId; + }, + get selId() { + return selId; + }, + positions: pos, + }; + } catch { + /* ignore */ + } +})(); diff --git a/src/graph/viewer/styles.css b/src/graph/viewer/styles.css new file mode 100644 index 00000000..d65d0446 --- /dev/null +++ b/src/graph/viewer/styles.css @@ -0,0 +1,67 @@ +/* Cladding · knowledge-graph viewer — styles (read as text, inlined into the export). */ +:root { + --bg: #0d1117; --panel: rgba(22,27,34,.92); --panel-border: #30363d; + --fg: #e6edf3; --muted: #8b949e; --accent: #f59e0b; --edge: rgba(139,148,158,.22); + --node-stroke: rgba(8,11,16,.85); +} +:root.light { + --bg: #f6f8fa; --panel: rgba(255,255,255,.94); --panel-border: #d0d7de; + --fg: #1f2328; --muted: #57606a; --accent: #bf6f00; --edge: rgba(80,90,100,.18); + --node-stroke: rgba(255,255,255,.9); +} +* { box-sizing: border-box; } +html, body { margin: 0; height: 100%; overflow: hidden; color: var(--fg); + font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; } +/* deep-space field so the additive node-bloom reads as a glowing galaxy */ +body { background: radial-gradient(ellipse 85% 75% at 55% 42%, #03050a 0%, #010204 55%, #000001 100%); } +:root.light body { background: radial-gradient(ellipse 80% 70% at 60% 44%, #ffffff 0%, #eef1f5 55%, #e3e8ee 100%); } +#stage { position: fixed; inset: 0; } +canvas { display: block; width: 100vw; height: 100vh; cursor: grab; } +canvas.grabbing { cursor: grabbing; } + +#side { position: fixed; top: 0; left: 0; bottom: 0; width: 264px; padding: 14px 14px 40px; + background: var(--panel); border-right: 1px solid var(--panel-border); backdrop-filter: blur(8px); + overflow-y: auto; transition: transform .2s ease; z-index: 5; } +#side.hidden { transform: translateX(-100%); } +#side h1 { font-size: 14px; margin: 0 0 2px; letter-spacing: .2px; } +#side .sub { color: var(--muted); font-size: 11px; margin-bottom: 12px; } +#side h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); + margin: 16px 0 6px; border-top: 1px solid var(--panel-border); padding-top: 12px; } +#search { width: 100%; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--panel-border); + background: var(--bg); color: var(--fg); font-size: 12px; } +.row { display: flex; align-items: center; gap: 7px; padding: 3px 0; cursor: pointer; user-select: none; } +.row input { accent-color: var(--accent); } +.row .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; } +.row .nm { flex: 1; } +.row .ct { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; } +.row.off .nm, .row.off .ct { opacity: .4; text-decoration: line-through; } +.zone { margin: 2px 0 6px; } +.zone h3 { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); + margin: 6px 0 1px; opacity: .65; font-weight: 600; } +.hint-inline { text-transform: none; letter-spacing: 0; opacity: .55; font-weight: 400; } +.toggles { display: flex; flex-wrap: wrap; gap: 6px; } +.toggles button { flex: 1 1 auto; padding: 6px 8px; border-radius: 7px; cursor: pointer; + border: 1px solid var(--panel-border); background: var(--bg); color: var(--fg); font-size: 11px; } +.toggles button.on { background: var(--accent); color: #111; border-color: var(--accent); } +/* force sliders (장력) */ +.slider { margin: 8px 0; } +.slider label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; } +.slider input[type=range] { width: 100%; height: 4px; -webkit-appearance: none; appearance: none; background: var(--panel-border); border-radius: 999px; outline: none; } +.slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); cursor: pointer; border: none; } +.slider input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--accent); cursor: pointer; border: none; } +/* conformance pill (live SSoT health) */ +#impact { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; display: none; + padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--panel-border); + font-size: 12px; font-variant-numeric: tabular-nums; box-shadow: 0 4px 16px rgba(0,0,0,.3); } +#impact .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; } +#tip { position: fixed; pointer-events: none; z-index: 9; max-width: 320px; padding: 8px 10px; + border-radius: 8px; background: var(--panel); border: 1px solid var(--panel-border); + box-shadow: 0 6px 24px rgba(0,0,0,.35); font-size: 12px; display: none; } +#tip .t { font-weight: 600; } +#tip .m { color: var(--muted); font-size: 11px; margin-top: 2px; } +#tip .k { display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: 10px; color: #fff; } +#burger { position: fixed; top: 12px; left: 12px; z-index: 6; width: 34px; height: 34px; display: none; + border-radius: 8px; border: 1px solid var(--panel-border); background: var(--panel); color: var(--fg); + cursor: pointer; font-size: 16px; } +#hint { position: fixed; right: 12px; bottom: 10px; color: var(--muted); font-size: 11px; z-index: 4; } +@media (max-width: 760px) { #side { transform: translateX(-100%); } #side.show { transform: none; } #burger { display: block; } } diff --git a/src/optimizer/code-excerpt.ts b/src/optimizer/code-excerpt.ts new file mode 100644 index 00000000..a571f80a --- /dev/null +++ b/src/optimizer/code-excerpt.ts @@ -0,0 +1,76 @@ +// Cladding · optimizer · path-safe source excerpt for the working set — F-06dfdad6 +// +// The working-set assembler must show an LLM the ACTUAL code of a focus feature's +// modules — but reading arbitrary paths from spec is a path-traversal + binary-dump + +// budget-blowout hazard. This reader NEVER throws: it returns an `omitted` reason for +// unsafe / unsupported / missing / binary / oversize paths, and clips long files to a +// char budget with a truncation marker. Pure given (path, cwd, budget) — readFileSync is +// the only impurity, kept out of the frozen pure context-slice (sim: backward-compat). + +import {readFileSync, statSync} from 'node:fs'; +import {extname, resolve, sep} from 'node:path'; + +/** Source-ish extensions we are willing to inline. Anything else -> omitted:'unsupported'. */ +const CODE_EXTS = new Set([ + '.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.py', '.rs', '.go', '.java', '.kt', '.kts', + '.cs', '.rb', '.php', '.swift', '.c', '.h', '.cpp', '.hpp', '.css', '.scss', '.sql', '.sh', + '.yaml', '.yml', '.json', '.md', '.toml', +]); + +/** Hard ceiling so a giant file is never slurped into memory before clipping. */ +const MAX_READ_BYTES = 2_000_000; + +/** A NUL byte marks the content as binary (skip inlining). */ +const NUL = String.fromCharCode(0); + +export interface CodeExcerpt { + readonly path: string; + /** The (possibly clipped) source — present only when readable + safe. */ + readonly text?: string; + /** True when `text` was clipped to the char budget. */ + readonly truncated?: boolean; + /** Why no text: 'unsafe-path' | 'unsupported' | 'missing' | 'binary' | 'too-large'. */ + readonly omitted?: string; + readonly bytes?: number; +} + +/** Project-consistent token estimate (chars / 4). */ +export function estTokens(s: string): number { + return Math.ceil(s.length / 4); +} + +/** True iff `rel` resolves inside `cwd` (rejects `..` escapes + absolute paths outside). */ +export function withinCwd(rel: string, cwd: string): boolean { + const root = resolve(cwd); + const abs = resolve(root, rel); + return abs === root || abs.startsWith(root + sep); +} + +/** + * Reads `rel` (relative to `cwd`) as a bounded, path-safe excerpt. Never throws. + * `maxChars` caps the included text; longer files are clipped with a marker. + */ +export function codeExcerpt(rel: string, cwd: string, maxChars: number): CodeExcerpt { + if (!withinCwd(rel, cwd)) return {path: rel, omitted: 'unsafe-path'}; + if (!CODE_EXTS.has(extname(rel).toLowerCase())) return {path: rel, omitted: 'unsupported'}; + const abs = resolve(cwd, rel); + let bytes: number; + try { + bytes = statSync(abs).size; + } catch { + return {path: rel, omitted: 'missing'}; + } + if (bytes > MAX_READ_BYTES) return {path: rel, omitted: 'too-large', bytes}; + let raw: string; + try { + raw = readFileSync(abs, 'utf8'); + } catch { + return {path: rel, omitted: 'missing', bytes}; + } + if (raw.includes(NUL)) return {path: rel, omitted: 'binary', bytes}; + const budget = Math.max(0, Math.floor(maxChars)); + if (raw.length <= budget) return {path: rel, text: raw, bytes}; + const marker = `\n/* ... clipped (${bytes} bytes total) ... */\n`; + const room = Math.max(0, budget - marker.length); + return {path: rel, text: raw.slice(0, room) + marker, truncated: true, bytes}; +} diff --git a/src/optimizer/infer-depends-on.ts b/src/optimizer/infer-depends-on.ts new file mode 100644 index 00000000..5f87466e --- /dev/null +++ b/src/optimizer/infer-depends-on.ts @@ -0,0 +1,186 @@ +// Cladding · optimizer · infer feature depends_on from the code import graph — F-2be3e3bb +// +// THE GAP this closes: `depends_on` (feature→feature edges) is the load-bearing input for the +// whole graph layer — prune / context-slice / working-set / reverse-slice / iterative-slice / +// drive ordering ALL walk it. But cladding PRODUCES it nowhere (clad_create_feature, scan, +// onboarding never emit it) and FLAGS its absence nowhere. So a real project authored with +// cladding (doverunner-vapt: 174 features) ships with ZERO edges — every graph tool returns +// an empty result. That is a precondition gap (the graph can't exist without edges), not a +// correctness claim. +// +// This module reconstructs the edges DETERMINISTICALLY from what IS present: each feature's +// `modules` (file paths) + the actual import statements in those files. If feature A's module +// imports a path owned by feature B (B ≠ A), then A depends_on B. Pure given the file +// contents (the impure read is injected, like code-excerpt.ts) — so it is headless-testable. +// +// Conservative by design (low false-positive, per the analysis): an edge is emitted ONLY when +// an import resolves to a file declared in ANOTHER feature's `modules`. Imports of stdlib / +// third-party / unowned files produce nothing. Resolution matches on MULTI-SEGMENT path/dotted +// keys only — a bare basename (e.g. `schemas`, `utils`) is too ambiguous (the same filename +// recurs across features) and was measured to triple the edge count with spurious links, so +// single-segment keys are excluded. + +import {reverseIndexOf} from '../spec/reverse-index.js'; +import type {Spec} from '../spec/types.js'; + +export interface InferredEdge { + readonly from: string; // feature id that imports + readonly to: string; // feature id that owns the imported module + readonly via: string; // the owned module path that was imported (evidence) +} + +export interface InferResult { + /** Deterministically-ordered inferred feature→feature edges (deduped). */ + readonly edges: readonly InferredEdge[]; + /** Edges already present in spec (from existing depends_on) — so callers can show only the NEW ones. */ + readonly alreadyDeclared: readonly InferredEdge[]; + /** Per-feature: the inferred `to` ids NOT yet in its depends_on (the suggested additions). */ + readonly suggestions: Readonly>; + /** + * Module files that use dynamic/runtime imports (importlib, __import__, getattr-based) — these + * carry dependencies that static regex CANNOT extract, so edges from them may be UNDER-reported. + * Surfaced (not silently dropped) so a maintainer knows which files to review by hand. Sorted. + */ + readonly dynamicImportFiles: readonly string[]; +} + +/** A reader that returns a module file's text, or null if unreadable. Injected (keeps this pure). */ +export type ModuleReader = (path: string) => string | null; + +export interface InferOptions { + /** + * Skip an import whose resolved key is owned by MORE than this many features (default 1). + * A module co-declared by many features is an ambiguous edge target — importing it does not + * mean depending on ALL of them. Measured on doverunner-vapt: capping at 1 owner yields ~420 + * clean edges; uncapped yields ~2200 with heavy fan-out noise from shared modules. + */ + readonly maxOwnerAmbiguity?: number; +} + +// Dynamic/runtime import patterns — dependencies static extraction cannot see (so a file with +// these may have UNDER-reported edges; we surface it for manual review rather than pretend it's complete). +const DYNAMIC_IMPORT = /\b(?:importlib\.import_module|importlib\.__import__|__import__\s*\(|import_module\s*\(|require\s*\(\s*[^'"\s)])/; + +// Import extractors per language family. Each returns the raw imported "specifier" strings. +const PY_IMPORT = /^\s*(?:from\s+([.\w]+)\s+import\b|import\s+([.\w]+))/gm; +const JS_IMPORT = /(?:^|\n)\s*(?:import\b[^'"]*from\s*['"]([^'"]+)['"]|import\s*['"]([^'"]+)['"]|(?:const|let|var)\s+[^=]+=\s*require\(\s*['"]([^'"]+)['"]\s*\))/g; + +/** Lowercase ext check. */ +function ext(p: string): string { + const i = p.lastIndexOf('.'); + return i >= 0 ? p.slice(i).toLowerCase() : ''; +} + +/** + * For every owned module path, register lookup keys that an import specifier could resolve to. + * Python: `backend/disciplines/sast/x.py` → dotted `disciplines.sast.x` AND `backend.disciplines.sast.x` + * (pythonpath roots make the leading dir optional) + the bare basename `x`. + * JS/TS: `src/a/b.ts` → `src/a/b`, `a/b`, and the basename `b` (relative imports resolve by basename/segment). + * Returns Map>. + */ +function buildResolveIndex(ownerByPath: ReadonlyMap>): Map> { + const idx = new Map>(); + const add = (key: string, owners: ReadonlySet): void => { + if (!key) return; + const set = idx.get(key) ?? new Set(); + for (const o of owners) set.add(o); + idx.set(key, set); + }; + for (const [path, owners] of ownerByPath) { + const e = ext(path); + const noExt = e ? path.slice(0, -e.length) : path; + const segs = noExt.split('/').filter(Boolean); + // Only MULTI-SEGMENT keys (≥2 path components): a bare basename is ambiguous across features. + const sep = e === '.py' ? '.' : '/'; + for (let start = 0; start <= segs.length - 2; start++) { + add(segs.slice(start).join(sep), owners); + } + } + return idx; +} + +/** Extracts import specifiers from a source file by language family. */ +function extractImports(source: string, fileExt: string): string[] { + const out: string[] = []; + if (fileExt === '.py') { + for (let m = PY_IMPORT.exec(source); m; m = PY_IMPORT.exec(source)) out.push(m[1] ?? m[2]); + PY_IMPORT.lastIndex = 0; + } else if (['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'].includes(fileExt)) { + for (let m = JS_IMPORT.exec(source); m; m = JS_IMPORT.exec(source)) out.push(m[1] ?? m[2] ?? m[3]); + JS_IMPORT.lastIndex = 0; + } + return out.filter(Boolean); +} + +/** Normalises an import specifier to candidate lookup keys (matching buildResolveIndex). */ +function importKeys(spec: string, fileExt: string): string[] { + // Multi-segment keys only (mirror buildResolveIndex — no ambiguous bare basename). + if (fileExt === '.py') { + const segs = spec.replace(/^\.+/, '').split('.').filter(Boolean); + const keys: string[] = []; + for (let start = 0; start <= segs.length - 2; start++) keys.push(segs.slice(start).join('.')); + return keys; + } + const clean = spec.replace(/\.(js|jsx|ts|tsx|mjs|cjs)$/i, '').replace(/^[./]+/, ''); + const segs = clean.split('/').filter(Boolean); + const keys: string[] = []; + for (let start = 0; start <= segs.length - 2; start++) keys.push(segs.slice(start).join('/')); + return keys; +} + +/** + * Infers feature→feature depends_on edges from the import graph of each feature's modules. + * `read` returns a module file's source (or null). Deterministic + pure given identical spec + * + identical file contents; edges + suggestions are sorted for byte-stable output. + */ +export function inferDependsOn(spec: Spec, read: ModuleReader, opts: InferOptions = {}): InferResult { + const maxAmbiguity = opts.maxOwnerAmbiguity ?? 1; + const ri = reverseIndexOf(spec); + const resolve = buildResolveIndex(ri.moduleOwners); + const features = spec.features ?? []; + + // edgeKey → InferredEdge (dedup; keep the first `via` for evidence, deterministically smallest) + const edgeMap = new Map(); + const dynamicFiles = new Set(); + for (const f of features) { + const fromId = f.id; + for (const modPath of f.modules ?? []) { + const fileExt = ext(modPath); + if (fileExt !== '.py' && !['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'].includes(fileExt)) continue; + const src = read(modPath); + if (src == null) continue; + if (DYNAMIC_IMPORT.test(src)) dynamicFiles.add(modPath); // edges may be under-reported here + for (const spec0 of extractImports(src, fileExt)) { + for (const key of importKeys(spec0, fileExt)) { + const owners = resolve.get(key); + if (!owners || owners.size > maxAmbiguity) continue; // ambiguous shared module → weak signal, skip + for (const ownerId of owners) { + if (ownerId === fromId) continue; // a feature importing its own module is not a dep + const k = `${fromId}${ownerId}`; + const existing = edgeMap.get(k); + if (!existing || modPath < existing.via) edgeMap.set(k, {from: fromId, to: ownerId, via: modPath}); + } + } + } + } + } + + const declared = new Map(features.map((f) => [f.id, new Set(f.depends_on ?? [])])); + const all = [...edgeMap.values()].sort( + (a, b) => a.from.localeCompare(b.from) || a.to.localeCompare(b.to), + ); + const edges: InferredEdge[] = []; + const already: InferredEdge[] = []; + const sugg: Record> = {}; + for (const e of all) { + if (declared.get(e.from)?.has(e.to)) already.push(e); + else { + edges.push(e); + (sugg[e.from] ??= new Set()).add(e.to); + } + } + const suggestions: Record = {}; + for (const [fid, set] of Object.entries(sugg)) suggestions[fid] = [...set].sort(); + + return {edges, alreadyDeclared: already, suggestions, dynamicImportFiles: [...dynamicFiles].sort()}; +} diff --git a/src/optimizer/iterative-slice.ts b/src/optimizer/iterative-slice.ts new file mode 100644 index 00000000..32c3e283 --- /dev/null +++ b/src/optimizer/iterative-slice.ts @@ -0,0 +1,136 @@ +// Cladding · optimizer · iterative graph-anchored impact slice — F-96250595 +// +// The fixed-depth impact slice (buildImpactSlice depth=1) has a real flaw: a feature whose +// breakage reaches a 2nd-hop dependent is under-reported at depth 1 (a "narrow miss"). This +// wraps buildImpactSlice in a SEED → WIDEN → STOP loop: start at depth 1, and expand the +// radius hop-by-hop until a DETERMINISTIC sufficiency criterion is met — then report WHY it +// stopped (`stoppedBy`) and HOW MUCH of the known blast radius it covers (`coverage`). The +// caller never has to blindly trust a fixed bound: the expansion is self-justifying and the +// result is self-describing. +// +// Pure + deterministic (no LLM, no test execution, no fs beyond what buildImpactSlice/spec +// already use): every stop criterion is a graph query over the spec's reverse-index. +// +// Stop criteria + DEFAULTS were calibrated on cladding-self (522 queries, two simulation +// rounds), NOT guessed: the originally-proposed 'target-nodes' default fired at depth 1 +// everywhere (test_refs ride along immediately) → it reproduced the fixed-depth behavior and +// stopped at ~50% coverage (false completeness). coverage(0.9) + marginal-yield(0.05) + +// exhaustion is what actually widens on narrow-misses, stops instantly when already complete, +// and degrades to an HONEST partial-coverage stop on cladding's large fan-out hubs (where no +// depth yields ≥90% — there, "report 79%, stop at diminishing returns" is the correct move). + +import {buildImpactSlice, collectDependents, type ImpactLookupMiss, type ImpactSlice} from './reverse-slice.js'; +import {reverseIndexOf} from '../spec/reverse-index.js'; +import type {Spec} from '../spec/types.js'; + +export type StopReason = 'exhaustion' | 'coverage' | 'marginal-yield' | 'max-depth'; + +export interface IterativeImpactOptions { + readonly initialDepth?: number; + readonly maxDepth?: number; + /** Stop once the radius covers this fraction of ALL known transitive dependents (default 0.9). */ + readonly coverageThreshold?: number; + /** Stop after two consecutive hops each add < this fraction of new nodes (default 0.05). */ + readonly marginYieldThreshold?: number; +} + +export interface IterativeImpactResult { + /** The impact slice at the depth where iteration stopped. */ + readonly slice: ImpactSlice; + /** Depth (hops) the radius was expanded to. */ + readonly depthUsed: number; + /** Which deterministic criterion ended the expansion. */ + readonly stoppedBy: StopReason; + /** Self-describing sufficiency signals — the caller decides whether to trust or widen further. */ + readonly analysis: { + /** The k-th ring added 0 new dependents → the reachable graph boundary was hit. */ + readonly frontierExhausted: boolean; + /** Fraction of all known transitive dependents now in the radius (0..1). */ + readonly coverage: number; + /** New-node fraction per hop: [yield@d1, yield@d2, …] — the expansion curve. */ + readonly marginalYields: readonly number[]; + /** Total transitive dependents reachable at unbounded depth (the coverage denominator). */ + readonly totalKnownDependents: number; + }; +} + +const DEFAULTS = {initialDepth: 1, maxDepth: 10, coverageThreshold: 0.9, marginYieldThreshold: 0.05}; + +/** Count of impacted dependents in a slice (0 for a module-with-no-dependents). */ +function impactedCount(slice: ImpactSlice): number { + return slice.impacted.length; +} + +/** + * Expands the impact radius from `initialDepth` outward, stopping at the first depth where a + * deterministic sufficiency criterion holds. Returns the slice at that depth plus the analysis + * that justifies the stop. Same not_found contract as buildImpactSlice on an unresolved query. + */ +export function buildIterativeImpactSlice( + spec: Spec, + query: string, + opts: IterativeImpactOptions = {}, +): IterativeImpactResult | ImpactLookupMiss { + const initialDepth = opts.initialDepth ?? DEFAULTS.initialDepth; + const maxDepth = opts.maxDepth ?? DEFAULTS.maxDepth; + const covT = opts.coverageThreshold ?? DEFAULTS.coverageThreshold; + const margT = opts.marginYieldThreshold ?? DEFAULTS.marginYieldThreshold; + + // Resolve once + establish the coverage denominator (all reachable dependents, unbounded). + const ri = reverseIndexOf(spec); + const byId = new Map((spec.features ?? []).map((f) => [f.id, f])); + let seedIds: string[] = []; + const direct = (spec.features ?? []).find((f) => f.id === query || (f as {slug?: string}).slug === query); + if (direct) seedIds = [direct.id]; + else { + const owners = ri.moduleOwners.get(query); + if (owners && owners.size > 0) seedIds = [...owners].filter((id): id is string => byId.has(id)); + } + if (seedIds.length === 0) { + // Delegate the canonical miss shape to buildImpactSlice (single source of truth). + const miss = buildImpactSlice(spec, query, {depth: 1}); + return 'not_found' in miss ? miss : (miss as never); + } + const totalKnown = collectDependents(seedIds, ri.dependents, Infinity).size; + + const yields: number[] = []; + let prevCount = 0; + let lastSlice: ImpactSlice | null = null; + + for (let depth = initialDepth; depth <= maxDepth; depth++) { + const slice = buildImpactSlice(spec, query, {depth}); + if ('not_found' in slice) return slice; // defensive; resolution already succeeded + lastSlice = slice; + const n = impactedCount(slice); + const added = n - prevCount; + const marginalYield = n > 0 ? added / n : 0; + yields.push(marginalYield); + const coverage = totalKnown > 0 ? n / totalKnown : 1; + const frontierExhausted = added === 0 && depth > initialDepth; + + const analysis = {frontierExhausted, coverage, marginalYields: [...yields], totalKnownDependents: totalKnown}; + + // Stop checks (deterministic; order = which reason is reported when several hold at once). + if (frontierExhausted) return {slice, depthUsed: depth, stoppedBy: 'exhaustion', analysis}; + if (coverage >= covT) return {slice, depthUsed: depth, stoppedBy: 'coverage', analysis}; + if (yields.length >= 2 && yields[yields.length - 1] < margT && yields[yields.length - 2] < margT) { + return {slice, depthUsed: depth, stoppedBy: 'marginal-yield', analysis}; + } + prevCount = n; + } + + // Hit the hard cap — report honestly (slice is the widest we computed). + const slice = lastSlice ?? (buildImpactSlice(spec, query, {depth: maxDepth}) as ImpactSlice); + const n = impactedCount(slice); + return { + slice, + depthUsed: maxDepth, + stoppedBy: 'max-depth', + analysis: { + frontierExhausted: false, + coverage: totalKnown > 0 ? n / totalKnown : 1, + marginalYields: [...yields], + totalKnownDependents: totalKnown, + }, + }; +} diff --git a/src/optimizer/measurement.ts b/src/optimizer/measurement.ts new file mode 100644 index 00000000..69302183 --- /dev/null +++ b/src/optimizer/measurement.ts @@ -0,0 +1,159 @@ +// Cladding · optimizer · graph efficiency measurement — F-16138071 +// +// The graph tooling's GOAL is search-efficiency + context-efficiency + stable dev at scale — +// NOT making an agent "smarter". Four correctness-framed A/Bs returned NULL, but correctness +// was never the goal. This measures what the goal actually is, DETERMINISTICALLY (no agent, no +// test run, no NULL risk): for every feature, what does the graph hand you FOR FREE vs what you +// would have to search/read by hand to reconstruct the same working context? +// +// • CONTEXT EFFICIENCY — working-set tokens vs the naive baseline (the feature shard + the +// full text of all its module files, which is what you'd load without the slice). The ratio +// is the context the slice saves you. +// • SEARCH EFFICIENCY — the dependency depth + edge count the graph resolves for you (each hop +// is a "find all dependents" round an agent would otherwise grep by hand). +// • STABILITY / REGRESSION-SET QUALITY — the iterative slice's stop reason + coverage: how +// much of the true blast radius the surfaced regression set covers, and how honestly it +// reports partial coverage. +// +// Pure given (spec, file reader). Reuses buildWorkingSet / buildIterativeImpactSlice / +// reverseIndexOf / estTokens — no new graph algorithm. The reader is injected (impure I/O stays +// out, like code-excerpt.ts), so this is headless-testable. +// +// HONEST SCOPE: this is the efficiency the infrastructure CAN provide (an upper bound vs one +// naive baseline) — NOT proof that a strong agent adopts it (the A/Bs show strong agents grep +// anyway). It answers "what does the graph give you", not "does the agent use it". + +import {estTokens} from './code-excerpt.js'; +import {buildIterativeImpactSlice} from './iterative-slice.js'; +import {buildWorkingSet} from './working-set.js'; +import {reverseIndexOf} from '../spec/reverse-index.js'; +import type {Spec} from '../spec/types.js'; + +export type ModuleReader = (path: string) => string | null; + +export interface FeatureEfficiency { + readonly id: string; + /** working-set payload tokens (what the slice hands you). */ + readonly sliceTokens: number; + /** naive baseline tokens: the shard + the full text of every module file. */ + readonly naiveTokens: number; + /** sliceTokens / naiveTokens — < 1 means the slice is smaller (the context it saves). */ + readonly contextRatio: number; + /** hops the iterative slice expanded (≈ grep rounds to reconstruct the radius by hand). */ + readonly searchDepth: number; + /** forward depends_on + backward dependents the graph resolves for you. */ + readonly edgesResolved: number; + /** iterative stop reason — coverage = confident, marginal-yield/max-depth = honest partial. */ + readonly stoppedBy: string; + /** fraction of the true transitive blast radius the surfaced regression set covers (0..1). */ + readonly coverage: number; + /** count of regression tests the slice hands you to run. */ + readonly regressionTests: number; +} + +export interface EfficiencyReport { + readonly featureCount: number; + readonly measured: number; // features that resolved (not miss) + readonly context: { + /** median sliceTokens / naiveTokens across measured features (< 1 = smaller). */ + readonly medianContextRatio: number; + /** median naive / slice (e.g. 6.0 = "6x smaller"). Infinity-safe. */ + readonly medianShrinkFactor: number; + readonly medianSliceTokens: number; + readonly medianNaiveTokens: number; + }; + readonly search: { + readonly medianDepth: number; + readonly p95Depth: number; + readonly medianEdges: number; + readonly maxEdges: number; + }; + readonly stability: { + readonly byStopReason: Readonly>; + readonly medianCoverage: number; + readonly medianRegressionTests: number; + }; + /** Per-feature rows (deterministically sorted by id) — for drill-down / audit. */ + readonly features: readonly FeatureEfficiency[]; +} + +function median(xs: readonly number[]): number { + if (xs.length === 0) return 0; + const s = [...xs].sort((a, b) => a - b); + const mid = Math.floor(s.length / 2); + return s.length % 2 ? s[mid] : (s[mid - 1] + s[mid]) / 2; +} +function percentile(xs: readonly number[], p: number): number { + if (xs.length === 0) return 0; + const s = [...xs].sort((a, b) => a - b); + return s[Math.min(s.length - 1, Math.floor((p / 100) * s.length))]; +} + +/** + * Measures the search/context/stability efficiency the graph provides for every feature. + * Deterministic given identical spec + file contents. + */ +export function measureGraphEfficiency(spec: Spec, read: ModuleReader, cwd = '.'): EfficiencyReport { + const ri = reverseIndexOf(spec); + const features = spec.features ?? []; + const rows: FeatureEfficiency[] = []; + + for (const f of features) { + const ws = buildWorkingSet(spec, f.id, {cwd}); + if ('not_found' in ws) continue; + const it = buildIterativeImpactSlice(spec, f.id); + const itOk = !('not_found' in it); + + // slice tokens = the assembled working-set payload. + const sliceTokens = estTokens(JSON.stringify(ws)); + // naive baseline = the shard object + the full text of every module file. + let naive = estTokens(JSON.stringify(f)); + for (const m of f.modules ?? []) { + const src = read(m); + if (src) naive += estTokens(src); + } + const forward = (f.depends_on ?? []).length; + const backward = ri.dependents.get(f.id)?.size ?? 0; + + rows.push({ + id: f.id, + sliceTokens, + naiveTokens: naive, + contextRatio: naive > 0 ? sliceTokens / naive : 1, + searchDepth: itOk ? it.depthUsed : 1, + edgesResolved: forward + backward, + stoppedBy: itOk ? it.stoppedBy : 'n/a', + coverage: itOk ? it.analysis.coverage : 1, + regressionTests: ws.breaks_if_changed.regression_tests.length, + }); + } + + rows.sort((a, b) => a.id.localeCompare(b.id)); + const ratios = rows.map((r) => r.contextRatio); + const shrink = rows.filter((r) => r.sliceTokens > 0).map((r) => r.naiveTokens / r.sliceTokens); + const byStop: Record = {}; + for (const r of rows) byStop[r.stoppedBy] = (byStop[r.stoppedBy] ?? 0) + 1; + + return { + featureCount: features.length, + measured: rows.length, + context: { + medianContextRatio: Math.round(median(ratios) * 1000) / 1000, + medianShrinkFactor: Math.round(median(shrink) * 10) / 10, + medianSliceTokens: Math.round(median(rows.map((r) => r.sliceTokens))), + medianNaiveTokens: Math.round(median(rows.map((r) => r.naiveTokens))), + }, + search: { + medianDepth: median(rows.map((r) => r.searchDepth)), + p95Depth: percentile(rows.map((r) => r.searchDepth), 95), + medianEdges: median(rows.map((r) => r.edgesResolved)), + maxEdges: rows.reduce((m, r) => Math.max(m, r.edgesResolved), 0), + }, + stability: { + byStopReason: byStop, + medianCoverage: Math.round(median(rows.map((r) => r.coverage)) * 100) / 100, + medianRegressionTests: median(rows.map((r) => r.regressionTests)), + }, + features: rows, + }; +} diff --git a/src/optimizer/reverse-slice.ts b/src/optimizer/reverse-slice.ts new file mode 100644 index 00000000..312cd917 --- /dev/null +++ b/src/optimizer/reverse-slice.ts @@ -0,0 +1,158 @@ +// Cladding · optimizer · blast-radius impact slice — F-7794a6bc +// +// clad_get_context answers "what does this feature NEED?" (forward: walk +// depends_on up). This module answers the missing complement: "what BREAKS if +// I change this?" (backward: walk the reverse-index dependents down). For a +// module path it resolves the many-to-many owners first, so changing a shared +// file surfaces every feature that touches it and everything downstream. +// +// The returned slice is the LLM's safe-refactor working set in a long project: +// the impacted features, the scenarios at risk, the deduped union of tests to +// re-run (the regression set), and the modules in the blast radius — bounded +// and deterministic so a host can cache and diff it. + +import {reverseIndexOf} from '../spec/reverse-index.js'; +import type {Feature, Spec} from '../spec/types.js'; + +export interface ImpactSlice { + /** What was queried. Either a feature (id/title/status) or a module (path + owning features). */ + readonly focus: { + readonly id?: string; + readonly title?: string; + readonly status?: string; + readonly module?: string; + /** For a module query: the feature ids that declare it (many-to-many). */ + readonly owners?: readonly string[]; + }; + /** Transitive dependents of the focus — the features a change could break (summaries). */ + readonly impacted: ReadonlyArray<{readonly id: string; readonly title: string; readonly status?: string}>; + /** Union of module paths touched by any feature in the radius (focus ∪ impacted). */ + readonly impacted_modules: readonly string[]; + /** Scenarios bound to any feature in the radius — the flows at risk. */ + readonly scenarios: ReadonlyArray<{readonly id: string; readonly title: string}>; + /** Deduped, sorted union of test_refs across the radius — the regression set to run. */ + readonly test_refs: readonly string[]; +} + +export interface ImpactLookupMiss { + readonly not_found: string; + readonly accepted_forms: readonly string[]; + readonly discovery: string; +} + +/** + * Collects the transitive dependents of a seed set by walking reverse edges + * breadth-first, bounded to `depth` hops (default unbounded). The returned set + * EXCLUDES the seeds — it is the downstream blast radius only. + */ +export function collectDependents( + seedIds: Iterable, + dependents: ReadonlyMap>, + depth: number = Infinity, +): Set { + const result = new Set(); + const seen = new Set(seedIds); + let frontier = [...seen]; + let hop = 0; + while (frontier.length > 0 && hop < depth) { + const next: string[] = []; + for (const id of frontier) { + for (const dep of dependents.get(id) ?? []) { + if (!seen.has(dep)) { + seen.add(dep); + result.add(dep); + next.push(dep); + } + } + } + frontier = next; + hop++; + } + return result; +} + +/** id (F-…) or slug → the feature; else null. */ +function resolveFeature(spec: Spec, query: string): Feature | null { + const features = spec.features ?? []; + return ( + features.find((f) => f.id === query) ?? + features.find((f) => (f as {slug?: string}).slug === query) ?? + null + ); +} + +/** + * Builds the backward (blast-radius) slice for a feature id/slug or a module + * path. Returns a not_found result when the query resolves to neither. + * + * @param spec The loaded spec. + * @param query Feature id, slug, or module path. + * @param opts.depth Bound the dependent walk to N hops (default: unbounded). + */ +export function buildImpactSlice( + spec: Spec, + query: string, + opts: {readonly depth?: number} = {}, +): ImpactSlice | ImpactLookupMiss { + const depth = opts.depth ?? Infinity; + const ri = reverseIndexOf(spec); + const byId = new Map((spec.features ?? []).map((f) => [f.id, f])); + + // Resolve: a feature query is one seed; a module query fans out to all owners. + let seedFeatures: Feature[] = []; + let moduleQuery: string | undefined; + const direct = resolveFeature(spec, query); + if (direct) { + seedFeatures = [direct]; + } else { + const owners = ri.moduleOwners.get(query); + if (owners && owners.size > 0) { + moduleQuery = query; + seedFeatures = [...owners].map((id) => byId.get(id)).filter((f): f is Feature => Boolean(f)); + } + } + + if (seedFeatures.length === 0) { + return { + not_found: query, + accepted_forms: ['feature id (F-…)', 'slug', 'module path (e.g. src/spec/load.ts)'], + discovery: 'grep spec/index.yaml — one line per feature; module paths live in each shard’s modules:', + }; + } + + const seedIds = seedFeatures.map((f) => f.id); + const dependentIds = collectDependents(seedIds, ri.dependents, depth); + + const impacted = [...dependentIds] + .map((id) => byId.get(id)) + .filter((f): f is Feature => Boolean(f)) + .map((f) => ({id: f.id, title: f.title, status: f.status})) + .sort((a, b) => a.id.localeCompare(b.id)); + + // The full radius (seeds ∪ dependents) drives module / scenario / test unions. + const radiusIds = new Set([...seedIds, ...dependentIds]); + const radiusFeatures = [...radiusIds] + .map((id) => byId.get(id)) + .filter((f): f is Feature => Boolean(f)); + + const impacted_modules = [ + ...new Set(radiusFeatures.flatMap((f) => f.modules ?? [])), + ].sort(); + + const scenarios = (spec.scenarios ?? []) + .filter((s) => (s.features ?? []).some((id) => radiusIds.has(id))) + .map((s) => ({id: s.id, title: s.title})) + .sort((a, b) => a.id.localeCompare(b.id)); + + const test_refs = [ + ...new Set( + radiusFeatures.flatMap((f) => (f.acceptance_criteria ?? []).flatMap((ac) => ac.test_refs ?? [])), + ), + ].sort(); + + const focus = moduleQuery + ? {module: moduleQuery, owners: [...seedIds].sort()} + : {id: seedFeatures[0].id, title: seedFeatures[0].title, status: seedFeatures[0].status}; + + return {focus, impacted, impacted_modules, scenarios, test_refs}; +} diff --git a/src/optimizer/working-set.ts b/src/optimizer/working-set.ts new file mode 100644 index 00000000..f6f49f88 --- /dev/null +++ b/src/optimizer/working-set.ts @@ -0,0 +1,168 @@ +// Cladding · optimizer · working-set assembler — F-06dfdad6 +// +// Additive over F-d2c806 (forward context-slice) and F-7794a6bc (backward impact-slice): +// reuses both, then ENRICHES with focus-module CODE excerpts, EARS risk flags, and a HARD +// token budget — producing ONE structured, code-bearing payload for an LLM coding task, so +// a single call replaces "read the shard + open N module files + grep deps + grep tests". +// +// buildContextSlice stays pure/frozen (sim verdict: backward-compat); this NEW function does +// the impure file reads via code-excerpt.ts. Deterministic given identical spec + file content. + +import {codeExcerpt, estTokens, type CodeExcerpt} from './code-excerpt.js'; +import {buildContextSlice, type ContextLookupMiss} from './context-slice.js'; +import {buildIterativeImpactSlice} from './iterative-slice.js'; +import {reverseIndexOf} from '../spec/reverse-index.js'; +import type {Feature, Spec} from '../spec/types.js'; + +type Summary = {readonly id: string; readonly title: string; readonly status?: string}; + +export interface WorkingSet { + /** What you are editing: the focus feature in full + the actual code of its modules. */ + readonly must_edit: { + readonly id: string; + readonly title: string; + readonly status?: string; + readonly modules: readonly string[]; + readonly acceptance_criteria: Feature['acceptance_criteria']; + readonly code: readonly CodeExcerpt[]; + /** Present only when the query was a module path claimed by several features. */ + readonly co_owners?: readonly string[]; + }; + /** What it needs: transitive depends_on ancestors (forward). */ + readonly needs: readonly Summary[]; + /** What breaks if you change it: direct dependents + the regression set (backward). */ + readonly breaks_if_changed: { + readonly impacted: readonly Summary[]; + readonly regression_tests: readonly string[]; + /** Self-describing radius: how far the blast-radius search widened + why it stopped + coverage of known dependents. */ + readonly radius?: {readonly depth: number; readonly stopped_by: string; readonly coverage: number}; + }; + /** How to verify: scenarios, tests, oracle refs, and the high-risk (EARS unwanted/state) ACs. */ + readonly verify: { + readonly scenarios: ReadonlyArray<{readonly id: string; readonly title: string}>; + readonly test_refs: readonly string[]; + readonly oracle_refs: readonly string[]; + readonly high_risk_acs: ReadonlyArray<{readonly id: string; readonly ears: string}>; + }; + /** Project standing instructions (ai_hints.preferred_patterns). */ + readonly guidance: { + readonly preferred_patterns: ReadonlyArray<{readonly when: string; readonly prefer: string; readonly over?: string}>; + }; + /** Token accounting + what was dropped to fit (must_edit is always retained). */ + readonly budget: {readonly max_tokens: number; readonly used_tokens: number; readonly truncated: readonly string[]}; +} + +export interface WorkingSetOptions { + readonly cwd?: string; + readonly maxTokens?: number; +} + +const DEFAULT_MAX_TOKENS = 3000; +/** Always keep at least this many (nearest-by-id) ancestors even under budget pressure. */ +const MIN_KEEP_NEEDS = 3; + +/** estTokens of the assembled payload with the given needs + code substituted in. */ +function sizeOf(base: WorkingSet, needs: readonly Summary[], code: readonly CodeExcerpt[]): number { + return estTokens(JSON.stringify({...base, needs, must_edit: {...base.must_edit, code}})); +} + +/** + * Assembles the token-budgeted working set for one feature/module. Returns the SAME + * not_found miss contract as buildContextSlice on an unrecognized query. + */ +export function buildWorkingSet(spec: Spec, query: string, opts: WorkingSetOptions = {}): WorkingSet | ContextLookupMiss { + const cwd = opts.cwd ?? '.'; + const maxTokens = opts.maxTokens && opts.maxTokens > 0 ? opts.maxTokens : DEFAULT_MAX_TOKENS; + + // Resolve focus DETERMINISTICALLY: for a module path with owners, the alphabetically-first + // owner id is the focus (independent of feature-array order — buildContextSlice would pick + // array-first); all co-owners are surfaced so the LLM sees the shared-module fan-out. + let resolvedQuery = query; + let coOwners: readonly string[] | undefined; + const owners = reverseIndexOf(spec).moduleOwners.get(query); + if (owners && owners.size > 0) { + const sorted = [...owners].sort(); + resolvedQuery = sorted[0]; + if (sorted.length > 1) coOwners = sorted; + } + + const ctx = buildContextSlice(spec, resolvedQuery); + if ('not_found' in ctx) return ctx; // identical miss contract — never diverge from F-d2c806 + const focus = ctx.focus; + + // backward blast radius — ITERATIVE: widen from depth 1 until a deterministic sufficiency + // criterion holds (coverage / exhaustion / marginal-yield), instead of a fixed depth-1 slice + // that under-reports 2nd-hop dependents (the "narrow miss"). The depth/coverage/stop reason + // are surfaced in `breaks_if_changed` so the result is self-describing, not a blind bound. + const iter = buildIterativeImpactSlice(spec, focus.id); + const impact = 'not_found' in iter ? null : iter.slice; + const impacted: readonly Summary[] = impact ? impact.impacted : []; + const regression: readonly string[] = impact ? impact.test_refs : []; + const radius = + 'not_found' in iter + ? null + : {depth: iter.depthUsed, stopped_by: iter.stoppedBy, coverage: Math.round(iter.analysis.coverage * 100) / 100}; + + const acs = focus.acceptance_criteria ?? []; + const highRiskAcs = acs + .filter((ac) => ac.ears === 'unwanted' || ac.ears === 'state') + .map((ac) => ({id: ac.id, ears: String(ac.ears)})); + const oracleRefs = [...new Set(acs.flatMap((ac) => ac.oracle_refs ?? []))].sort(); + + const truncated: string[] = []; + const base: WorkingSet = { + must_edit: { + id: focus.id, + title: focus.title, + status: focus.status, + modules: focus.modules ?? [], + acceptance_criteria: acs, + code: [], + ...(coOwners ? {co_owners: coOwners} : {}), + }, + needs: ctx.ancestors, + breaks_if_changed: {impacted, regression_tests: regression, ...(radius ? {radius} : {})}, + verify: {scenarios: ctx.scenarios, test_refs: ctx.test_refs, oracle_refs: oracleRefs, high_risk_acs: highRiskAcs}, + guidance: {preferred_patterns: ctx.preferred_patterns}, + budget: {max_tokens: maxTokens, used_tokens: 0, truncated}, + }; + + // 1. Clip droppable NEEDS first (distant ancestors — drop highest id last, keep ≥ MIN_KEEP_NEEDS). + const needs = [...ctx.ancestors]; + while (needs.length > MIN_KEEP_NEEDS && sizeOf(base, needs, []) > maxTokens) needs.pop(); + if (needs.length < ctx.ancestors.length) { + truncated.push(`needs: dropped ${ctx.ancestors.length - needs.length} distant ancestor(s)`); + } + + // 2. Fill CODE excerpts with the remaining budget; measure the TRUE serialized size each + // step (JSON-escaping inflates code) and skip any excerpt that would breach the cap — + // unless the structural core alone already exceeds it (then must-edit is kept regardless). + const structuralTokens = sizeOf(base, needs, []); + const code: CodeExcerpt[] = []; + for (const m of [...(focus.modules ?? [])].sort()) { + const before = sizeOf(base, needs, code); + if (maxTokens - before <= 40) { + truncated.push(`code: omitted ${m} (budget)`); + continue; + } + const ex = codeExcerpt(m, cwd, Math.floor((maxTokens - before) * 4 * 0.8)); // 0.8 = JSON-escape headroom + if (structuralTokens <= maxTokens && sizeOf(base, needs, [...code, ex]) > maxTokens) { + truncated.push(`code: omitted ${m} (budget)`); + continue; + } + code.push(ex); + if (ex.truncated) truncated.push(`code: clipped ${m}`); + } + + if (structuralTokens > maxTokens) { + truncated.push('must-edit exceeds budget — retained in full (focus is never dropped)'); + } + + const used = sizeOf(base, needs, code); + return { + ...base, + needs, + must_edit: {...base.must_edit, code}, + budget: {max_tokens: maxTokens, used_tokens: used, truncated}, + }; +} diff --git a/src/serve/server.ts b/src/serve/server.ts index d2163e9f..c75add88 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -42,6 +42,9 @@ import {doneFeatureCount, oracleRequired, resolveOraclePolicy} from '../oracle/p import {maintainDeliverable} from '../spec/deliverable-detect.js'; import {computeInventory, writeInventoryToSpecYaml, writeFeatureIndex} from '../spec/inventory.js'; import {buildContextSlice} from '../optimizer/context-slice.js'; +import {buildImpactSlice} from '../optimizer/reverse-slice.js'; +import {buildWorkingSet} from '../optimizer/working-set.js'; +import {buildGraph, resolveNodeId, subgraph} from '../graph/model.js'; import {runDrift} from '../stages/drift.js'; /** Persona ids registered as MCP prompts (mirrors src/agents/). */ @@ -75,6 +78,9 @@ export const TOOL_NAMES = [ 'clad_author_oracle', 'clad_run_gate', 'clad_get_context', + 'clad_get_working_set', + 'clad_get_impact', + 'clad_get_graph', 'clad_changelog', ] as const; @@ -459,6 +465,146 @@ function registerTools(server: McpServer, cwd: string): void { }, ); + // clad_get_working_set (F-06dfdad6) — the code-bearing, token-budgeted superset of + // clad_get_context: focus + module CODE + forward needs + backward breaks + verify + budget, + // fused in one call. clad_get_context stays frozen for hosts that cache its shape. + server.registerTool( + 'clad_get_working_set', + { + title: 'Get the token-budgeted working set for one feature (code + needs + breaks)', + description: + 'Returns ONE token-budgeted working set for a feature/module: must_edit (focus + full ACs + the ACTUAL ' + + 'source code of its modules), needs (forward depends_on), breaks_if_changed (direct dependents + the ' + + 'regression test set), verify (scenarios + tests + oracle_refs + EARS unwanted/state high-risk ACs), ' + + 'guidance (ai_hints), and budget (what was clipped to fit). One call replaces reading the shard + opening ' + + 'each module file + grepping deps/tests. Look up by feature id (F-…), slug, or module path.', + inputSchema: { + query: z.string().describe('Feature id (F-…), slug, or module path (e.g. src/auth/login.ts)'), + max_tokens: z + .number() + .int() + .positive() + .max(20000) + .optional() + .describe('Token budget for the payload (default 3000); distant deps then code then tests are clipped to fit'), + }, + }, + async (args) => { + try { + const ws = buildWorkingSet(loadSpec(cwd), args.query, {cwd, maxTokens: args.max_tokens}); + return { + isError: 'not_found' in ws, + content: [{type: 'text', text: JSON.stringify({schema_version: PAYLOAD_SCHEMA_VERSION, ...ws}, null, 2)}], + }; + } catch (err) { + return {isError: true, content: [{type: 'text', text: (err as Error).message}]}; + } + }, + ); + + // clad_get_impact (F-7794a6bc) — the backward complement of clad_get_context. + // "What breaks if I change this?" Walks the reverse-index dependents and + // returns the blast radius: impacted features, scenarios at risk, the + // regression test set to run, and the modules in the radius. + server.registerTool( + 'clad_get_impact', + { + title: 'Get the blast radius for a change (reverse / impact slice)', + description: + "Returns what a change to ONE feature or file could break: the transitive dependents (id+title+status), " + + 'the scenarios bound to any of them, the deduped union of their test_refs (the regression set to re-run), ' + + 'and the modules in the radius. Look up by feature id (F-…), slug, or a module path — a module fans out to ' + + 'ALL features that touch it. The backward complement of clad_get_context: forward = what this needs, ' + + 'impact = what depends on this. Prefer this over grepping to scope a safe refactor.', + inputSchema: { + query: z.string().describe('Feature id (F-…), slug, or module path (e.g. src/spec/load.ts)'), + max_depth: z + .number() + .int() + .positive() + .max(6) + .optional() + .describe('Bound the dependent walk to N hops (default: unbounded — the full transitive radius)'), + }, + }, + async (args) => { + try { + const spec = loadSpec(cwd); + const slice = buildImpactSlice(spec, args.query, {depth: args.max_depth}); + const miss = 'not_found' in slice; + return { + isError: miss, + content: [{type: 'text', text: JSON.stringify({schema_version: PAYLOAD_SCHEMA_VERSION, ...slice}, null, 2)}], + }; + } catch (err) { + return {isError: true, content: [{type: 'text', text: (err as Error).message}]}; + } + }, + ); + + // clad_get_graph (F-64a5c159) — the live spec↔code↔doc knowledge graph (or a + // focused neighborhood). Always recomputed from the current spec, so the graph + // an agent reads is never stale. Companion to the `clad graph serve` live view. + server.registerTool( + 'clad_get_graph', + { + title: 'Get the live knowledge graph (nodes + edges)', + description: + 'Returns the current spec↔code↔doc knowledge graph: nodes (feature/module/skill/test/scenario/capability/doc, ' + + 'tier-classified A/B/C/D, features labeled by slug) + typed edges (depends_on/touches/covers/binds/' + + 'implements/references/links). Optionally focus on one node’s N-hop neighborhood. Recomputed live — never stale.', + inputSchema: { + query: z + .string() + .optional() + .describe('Focus node: feature id (F-…), slug, or module path. Omit for the whole graph.'), + max_depth: z + .number() + .int() + .positive() + .max(6) + .optional() + .describe('Neighborhood radius around the focus node (default: full graph from the focus)'), + }, + }, + async (args) => { + try { + const spec = loadSpec(cwd); + let graph = buildGraph(spec, cwd); + if (args.query) { + const focusId = resolveNodeId(spec, graph, args.query); + if (!focusId) { + return { + isError: true, + content: [ + { + type: 'text', + text: JSON.stringify( + { + schema_version: PAYLOAD_SCHEMA_VERSION, + not_found: args.query, + accepted_forms: ['feature id (F-…)', 'slug', 'module path'], + }, + null, + 2, + ), + }, + ], + }; + } + graph = subgraph(graph, focusId, args.max_depth ?? Infinity); + } + return { + content: [ + {type: 'text', text: JSON.stringify({schema_version: PAYLOAD_SCHEMA_VERSION, ...graph}, null, 2)}, + ], + }; + } catch (err) { + return {isError: true, content: [{type: 'text', text: (err as Error).message}]}; + } + }, + ); + // clad_changelog (F-904495a5) — the spec rendered into a shipped-changes // manifest. The deterministic collector/renderers live in src/changelog/; // the LLM host renders the human prose FROM the manifest, never from memory. diff --git a/src/spec/doc-references.ts b/src/spec/doc-references.ts new file mode 100644 index 00000000..e5d4e5e6 --- /dev/null +++ b/src/spec/doc-references.ts @@ -0,0 +1,156 @@ +// Cladding · spec · doc → spec / doc → doc reference extraction — F-doc-graph +// +// The "all documents connected, always current" half of the knowledge graph. +// docs/*.md carry F-id references and relative .md links that NOTHING validates +// today — a renamed/archived feature silently rots the prose, and a moved doc +// leaves dead links. This module extracts both edge kinds so DOC_LINK_INTEGRITY +// can enforce them and `clad sync` can materialise spec/_doc-links.yaml (the +// greppable "which docs explain feature X" index + the graph-export source). +// +// Scoping is deliberate (ground-truth: 16/36 doc F-ids legitimately don't +// resolve — fixture-project ids + format examples): +// • EXCLUDE fixture/benchmark dirs (their ids live in a separate namespace); +// • SKIP code spans (fenced ``` and inline `…`) — that is where format +// examples like `F-abc123` live; +// • per-file opt-out: a doc carrying the `clad-doc-links: ignore` marker is +// exempt from F-id resolution (teaching docs full of illustrative ids), +// while its dead-link check still applies. + +import {existsSync, readdirSync, readFileSync, statSync, writeFileSync} from 'node:fs'; +import {dirname, join, normalize, relative} from 'node:path'; + +/** Dir prefixes (cwd-relative, posix) whose F-ids belong to a separate namespace. */ +export const DOC_SCAN_EXCLUDE: readonly string[] = [ + 'docs/ab-evaluation', + 'docs/ab-evaluation-extended', + 'docs/dogfood', + 'docs/benchmarks', +]; + +/** A doc carrying this HTML-comment marker is exempt from F-id resolution. */ +export const DOC_LINKS_IGNORE_MARKER = 'clad-doc-links: ignore'; + +const FEATURE_ID_RE = /\bF-[0-9a-f]{6,8}\b/g; +/** Markdown inline link to a relative .md target: `](path.md)` or `](path.md#anchor)`. */ +const MD_LINK_RE = /\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g; + +/** Per-doc extracted edges. Paths are cwd-relative posix. */ +export interface DocLinks { + readonly doc: string; + /** F-ids referenced in prose (sorted, deduped). Empty when the doc opted out. */ + readonly features: readonly string[]; + /** Relative .md link targets, resolved to cwd-relative posix paths (sorted, deduped). */ + readonly doc_links: readonly string[]; +} + +export interface DocRefScan { + readonly docs: readonly DocLinks[]; +} + +/** Removes fenced and inline code spans so format examples don't read as refs. */ +export function stripCodeSpans(md: string): string { + return md + .replace(/```[\s\S]*?```/g, ' ') + .replace(/~~~[\s\S]*?~~~/g, ' ') + .replace(/`[^`\n]*`/g, ' '); +} + +function toPosix(p: string): string { + return p.split('\\').join('/'); +} + +function isExcluded(relPosix: string): boolean { + return DOC_SCAN_EXCLUDE.some((prefix) => relPosix === prefix || relPosix.startsWith(`${prefix}/`)); +} + +/** Walks docs/ for *.md, skipping excluded dirs and dotfiles. cwd-relative posix paths. */ +function listDocs(cwd: string): string[] { + const root = join(cwd, 'docs'); + if (!existsSync(root)) return []; + const out: string[] = []; + const queue: string[] = [root]; + while (queue.length > 0) { + const dir = queue.pop()!; + let entries: string[]; + try { + entries = readdirSync(dir); + } catch { + continue; + } + for (const name of entries) { + if (name.startsWith('.')) continue; + const abs = join(dir, name); + let s; + try { + s = statSync(abs); + } catch { + continue; + } + const rel = toPosix(relative(cwd, abs)); + if (isExcluded(rel)) continue; + if (s.isDirectory()) queue.push(abs); + else if (name.endsWith('.md')) out.push(rel); + } + } + return out.sort(); +} + +/** Resolves a relative .md link from a doc to a cwd-relative posix path; null for external. */ +function resolveLink(docRel: string, link: string): string | null { + if (/^[a-z]+:/i.test(link)) return null; // http(s):, mailto:, etc. + const joined = normalize(join(dirname(docRel), link)); + return toPosix(joined); +} + +/** + * Extracts doc→spec (F-id) and doc→doc (.md link) edges from every markdown + * file under docs/, applying the scoping rules. Pure read of the filesystem. + */ +export function extractDocReferences(cwd: string = '.'): DocRefScan { + const docs: DocLinks[] = []; + for (const docRel of listDocs(cwd)) { + let raw: string; + try { + raw = readFileSync(join(cwd, docRel), 'utf8'); + } catch { + continue; + } + const optedOut = raw.includes(DOC_LINKS_IGNORE_MARKER); + const prose = stripCodeSpans(raw); + + const features = optedOut ? [] : [...new Set(prose.match(FEATURE_ID_RE) ?? [])].sort(); + + const links = new Set(); + for (const m of prose.matchAll(MD_LINK_RE)) { + const resolved = resolveLink(docRel, m[1]); + if (resolved) links.add(resolved); + } + docs.push({doc: docRel, features, doc_links: [...links].sort()}); + } + return {docs}; +} + +/** + * Writes spec/_doc-links.yaml — the Tier-C, deterministic, git-merge-friendly + * doc→spec/doc index `clad sync` maintains. Returns false when there are no docs. + */ +export function writeDocLinksYaml(cwd: string = '.'): boolean { + const scan = extractDocReferences(cwd); + if (scan.docs.length === 0) return false; + const lines: string[] = [ + '# Cladding · Tier C — generated doc→spec / doc→doc link index (`clad sync`). Do not edit by hand.', + '# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.', + 'schema: "0.1"', + 'docs:', + ]; + for (const d of scan.docs) { + if (d.features.length === 0 && d.doc_links.length === 0) continue; + lines.push(` ${JSON.stringify(d.doc)}:`); + if (d.features.length > 0) lines.push(` features: [${d.features.join(', ')}]`); + if (d.doc_links.length > 0) { + lines.push(` doc_links: [${d.doc_links.map((l) => JSON.stringify(l)).join(', ')}]`); + } + } + writeFileSync(join(cwd, 'spec', '_doc-links.yaml'), `${lines.join('\n')}\n`, 'utf8'); + return true; +} diff --git a/src/spec/reverse-index.ts b/src/spec/reverse-index.ts new file mode 100644 index 00000000..1cc594e4 --- /dev/null +++ b/src/spec/reverse-index.ts @@ -0,0 +1,122 @@ +// Cladding · spec · reverse-edge index (backlinks) — F-ee47fc2b +// +// The SSoT carries only FORWARD edges: a feature lists what it depends_on, +// which modules it touches, which tests cover each AC. `pruneToFeature` walks +// depends_on UP (ancestors) — there is no way to ask the reverse: +// • "what depends on me?" (inverse of depends_on) +// • "which features touch this file?" (inverse of modules) +// • "which feature owns this test?" (inverse of test_refs) +// Today every such question forces a full shard scan. This module materialises +// those three inversions once, so the graph layer (blast-radius queries, doc +// linking, exports) has O(1) backlinks to read. +// +// Design notes: +// • PURE + DERIVED — the index is computed from the Spec, stored NOWHERE on +// disk and never mutates the (readonly) Spec. The whole layer adds 0 bytes +// to the repo. +// • Memoised per Spec instance via a module-level WeakMap. primeSpecCache +// (load.ts) holds exactly one Spec object per gate run, so the memo is +// computed once per run and is GC-collected with the spec it keys — it can +// never serve a stale index. No changes to types.ts / load.ts / drift.ts. +// • moduleOwners is MANY-TO-MANY by design: `modules` records every feature +// that *touched* a file (131/338 paths in cladding-self are multi-claimed), +// so a path maps to the full set of claiming features — a co-change signal, +// not exclusive ownership. + +import type {Spec} from './types.js'; + +/** Reverse (backlink) maps derived from a Spec's forward edges. */ +export interface ReverseIndex { + /** featureId → ids of features that DIRECTLY depend_on it (one hop). */ + readonly dependents: ReadonlyMap>; + /** module path → set of feature ids that declare it in `modules` (many-to-many). */ + readonly moduleOwners: ReadonlyMap>; + /** test-file path (anchor-stripped) → set of feature ids whose ACs cite it. */ + readonly testRefCitations: ReadonlyMap>; +} + +/** + * test_ref prefixes that are NOT real file paths — they are pseudo-evidence + * markers handled elsewhere (test-ref-repair.ts suggestions, fixtures, scripts, + * the self-dogfood vouch). They must never enter the citation index. + */ +const PSEUDO_REF_PREFIXES = ['derived:', 'fixture:', 'script:', 'self-dogfood:'] as const; + +/** + * Normalises a test_ref to its file path, or null when it is a pseudo-ref. + * Real refs look like `tests/foo.test.ts#a test name` — the `#anchor` (the + * vitest test title) is dropped so all refs to the same file collapse to one key. + */ +function testRefPath(ref: string): string | null { + for (const prefix of PSEUDO_REF_PREFIXES) { + if (ref.startsWith(prefix)) return null; + } + const hash = ref.indexOf('#'); + const path = hash >= 0 ? ref.slice(0, hash) : ref; + const trimmed = path.trim(); + return trimmed.length > 0 ? trimmed : null; +} + +/** Appends `value` to the set stored at `key`, creating the set on first use. */ +function addEdge(map: Map>, key: string, value: string): void { + let set = map.get(key); + if (!set) { + set = new Set(); + map.set(key, set); + } + set.add(value); +} + +/** + * Builds the reverse index from a spec's forward edges. Pure: reads the spec, + * mutates nothing, allocates fresh maps. O(features × (deps + modules + ACs)). + * + * @see reverseIndexOf for the memoised accessor (prefer it in hot paths). + */ +export function buildReverseIndex(spec: Spec): ReverseIndex { + const dependents = new Map>(); + const moduleOwners = new Map>(); + const testRefCitations = new Map>(); + + for (const feature of spec.features ?? []) { + const fid = feature.id; + + for (const dep of feature.depends_on ?? []) { + // dep is depended-ON-by fid → fid is a dependent of dep. + addEdge(dependents, dep, fid); + } + + for (const modulePath of feature.modules ?? []) { + addEdge(moduleOwners, modulePath, fid); + } + + for (const ac of feature.acceptance_criteria ?? []) { + for (const ref of ac.test_refs ?? []) { + const path = testRefPath(ref); + if (path) addEdge(testRefCitations, path, fid); + } + } + } + + return {dependents, moduleOwners, testRefCitations}; +} + +// ─── Per-Spec memoisation ─── +// Keyed by the Spec object identity. The run-scoped cache (load.ts) reuses one +// Spec per run, so reverseIndexOf computes once per run; a new run gets a new +// Spec and a fresh entry, and the old entry is GC'd with the old spec. +const memo = new WeakMap(); + +/** + * Returns the reverse index for `spec`, computing it on first access and + * caching it for the spec's lifetime. Prefer this over buildReverseIndex when + * the same spec is queried repeatedly within a run. + */ +export function reverseIndexOf(spec: Spec): ReverseIndex { + let index = memo.get(spec); + if (!index) { + index = buildReverseIndex(spec); + memo.set(spec, index); + } + return index; +} diff --git a/src/stages/detectors/doc-reference-integrity.ts b/src/stages/detectors/doc-reference-integrity.ts new file mode 100644 index 00000000..056ed97c --- /dev/null +++ b/src/stages/detectors/doc-reference-integrity.ts @@ -0,0 +1,62 @@ +// Cladding · drift detector · DOC_LINK_INTEGRITY +// +// Closes the doc axis of the knowledge graph: docs/*.md carry F-id references +// and relative .md links that no detector validated, so a renamed/archived +// feature silently rotted the prose and a moved doc left dead links. This is +// the "all documents connected, ALWAYS CURRENT" guarantee, made mechanical. +// +// Two checks (scoping in src/spec/doc-references.ts — fixture dirs excluded, +// code spans skipped, per-file `clad-doc-links: ignore` opt-out honoured): +// • doc → doc : a relative .md link resolving to no file → ERROR (unambiguous). +// • doc → spec : an F-id in a scoped doc resolving to no feature → WARN +// (rides the warn/strict dial — advisory locally, blocks on push). + +import {existsSync} from 'node:fs'; +import {join} from 'node:path'; + +import {extractDocReferences} from '../../spec/doc-references.js'; +import type {Feature, Spec} from '../../spec/types.js'; +import type {CommandStageOptions, DriftDetector, DriftFinding} from '../types.js'; +import {withSpec} from './with-spec.js'; + +const NAME = 'DOC_LINK_INTEGRITY'; + +function runDocLinkIntegrity(opts: CommandStageOptions): readonly DriftFinding[] { + const {cwd = '.'} = opts; + return withSpec(cwd, NAME, (spec) => detect(spec, cwd)); +} + +function detect(spec: Spec, cwd: string): readonly DriftFinding[] { + const featureIds = new Set((spec.features ?? []).map((f: Feature) => f.id)); + const findings: DriftFinding[] = []; + for (const doc of extractDocReferences(cwd).docs) { + for (const link of doc.doc_links) { + if (!existsSync(join(cwd, link))) { + findings.push({ + detector: NAME, + severity: 'error', + path: doc.doc, + message: `doc '${doc.doc}' links to missing file '${link}'`, + }); + } + } + for (const fid of doc.features) { + if (!featureIds.has(fid)) { + findings.push({ + detector: NAME, + severity: 'warn', + path: doc.doc, + message: + `doc '${doc.doc}' references unknown feature '${fid}' — archived/renamed? ` + + 'If it is an illustrative example, add a `clad-doc-links: ignore` marker to the doc.', + }); + } + } + } + return findings; +} + +export const docReferenceIntegrity: DriftDetector = { + name: NAME, + run: runDocLinkIntegrity, +}; diff --git a/src/stages/detectors/index.ts b/src/stages/detectors/index.ts index 2c1b0ab6..2c5b98e3 100644 --- a/src/stages/detectors/index.ts +++ b/src/stages/detectors/index.ts @@ -33,6 +33,7 @@ import {performanceDrift} from './performance-drift.js'; import {plannedBacklog} from './planned-backlog.js'; import {projectContextDrift} from './project-context-drift.js'; import {referenceIntegrity} from './reference-integrity.js'; +import {docReferenceIntegrity} from './doc-reference-integrity.js'; import {scenarioCoverage} from './scenario-coverage.js'; import {specConformance} from './spec-conformance.js'; import {staleEvidence} from './stale-evidence.js'; @@ -42,6 +43,7 @@ import {statusDrift} from './status-drift.js'; import {techStackMismatch} from './tech-stack-mismatch.js'; import {unmappedArtifact} from './unmapped-artifact.js'; import {untestedAc} from './untested-ac.js'; +import {inferableDependsOn} from './inferable-depends-on.js'; import {unverifiedAc} from './unverified-ac.js'; import type {DriftDetector} from '../types.js'; @@ -55,6 +57,7 @@ export const allDetectors: readonly DriftDetector[] = [ statusDrift, staleSpecification, referenceIntegrity, + docReferenceIntegrity, harnessIntegrity, metaIntegrity, acDrift, @@ -85,4 +88,5 @@ export const allDetectors: readonly DriftDetector[] = [ deliverableIntegrity, smokeProbeDemand, staleAttestation, + inferableDependsOn, ]; diff --git a/src/stages/detectors/inferable-depends-on.ts b/src/stages/detectors/inferable-depends-on.ts new file mode 100644 index 00000000..c372e7e0 --- /dev/null +++ b/src/stages/detectors/inferable-depends-on.ts @@ -0,0 +1,61 @@ +// Cladding · drift detector · INFERABLE_DEPENDS_ON (F-15999130) +// +// Closes the second half of the depends_on gap. F-2be3e3bb gave cladding a way to PRODUCE +// the feature→feature dependency edges (clad infer-deps, from the code import graph) — but +// the gap had two holes: "produced by nothing" AND "absence flagged by nothing". An optional +// field that nothing produces and nothing checks stays empty forever (doverunner-vapt: 0 edges +// across 174 features → every graph tool returns empty). This detector is the missing flag: it +// notices when a project's code imports cross feature boundaries but the spec never recorded +// the matching `depends_on`, and points the maintainer at `clad infer-deps`. +// +// DESIGN (deliberately non-hostile): +// • severity INFO — never fails the gate, even under --strict (strict fails on error+warn, +// not info). A real project that simply never hand-authored depends_on must not turn RED. +// • a SINGLE aggregate finding — not one per feature. vapt would otherwise emit 157 findings; +// instead it emits one: "N features have import-inferable depends_on not declared". +// • silent when there is nothing to suggest (a fully-wired or import-less spec → no finding). +// • safe-degrade: any error (unreadable files, schema issues) → no finding, never throws. + +import {readFileSync} from 'node:fs'; +import {join} from 'node:path'; + +import {inferDependsOn} from '../../optimizer/infer-depends-on.js'; +import {loadSpec} from '../../spec/load.js'; +import type {CommandStageOptions, DriftDetector, DriftFinding} from '../types.js'; + +const NAME = 'INFERABLE_DEPENDS_ON'; + +function run(opts: CommandStageOptions): readonly DriftFinding[] { + const cwd = opts.cwd ?? '.'; + try { + const spec = loadSpec(cwd); + const read = (p: string): string | null => { + try { + return readFileSync(join(cwd, p), 'utf8'); + } catch { + return null; + } + }; + const result = inferDependsOn(spec, read); + const featureCount = Object.keys(result.suggestions).length; + if (featureCount === 0 || result.edges.length === 0) return []; + return [ + { + detector: NAME, + severity: 'info', + path: 'spec.yaml', + message: + `${featureCount} feature(s) import across feature boundaries but declare no matching depends_on ` + + `(${result.edges.length} inferable edge(s)). The dependency graph that powers context/impact/` + + `working-set is under-populated — run \`clad infer-deps\` to review + add the edges.`, + }, + ]; + } catch { + return []; // safe-degrade: never block, never throw + } +} + +export const inferableDependsOn: DriftDetector = { + name: NAME, + run, +}; diff --git a/src/stages/graph-health.ts b/src/stages/graph-health.ts new file mode 100644 index 00000000..60cbe06c --- /dev/null +++ b/src/stages/graph-health.ts @@ -0,0 +1,95 @@ +// Cladding · live SSoT health for the graph viewer — F graph-live-health +// +// THE KILLER: the graph viewer's per-node conformance health, computed from +// cladding's OWN drift detectors. No generic graph tool can do this — it needs +// the spec-as-SSoT + detector engine. Each detector finding is mapped to a +// graph node (a module/test/doc path → that node, or an `F-id` in the message → +// the feature node) and aggregated to a worst-severity badge. `clad graph serve` +// serves this live (heals as you fix); the static export embeds a stamped snapshot. +// +// Lives in the STAGES layer (not graph/) because it imports the detectors: +// architecture.yaml forbids graph→stages, but stages→graph (down-flow) is fine. + +import {dependencyCycle} from './detectors/dependency-cycle.js'; +import {docReferenceIntegrity} from './detectors/doc-reference-integrity.js'; +import {missingImplementation} from './detectors/missing-implementation.js'; +import {missingTests} from './detectors/missing-tests.js'; +import {referenceIntegrity} from './detectors/reference-integrity.js'; +import {staleAttestation} from './detectors/stale-attestation.js'; +import {staleTests} from './detectors/stale-tests.js'; +import {statusDrift} from './detectors/status-drift.js'; +import {unmappedArtifact} from './detectors/unmapped-artifact.js'; +import {untestedAc} from './detectors/untested-ac.js'; +import type {DriftDetector, DriftFinding} from './types.js'; +import {nodeId} from '../graph/model.js'; +import type {KnowledgeGraph} from '../graph/model.js'; + +/** Per-node conformance health: worst severity + which detectors fired. */ +export interface NodeHealth { + readonly severity: 'error' | 'warn'; + readonly count: number; + readonly detectors: readonly string[]; +} + +// Detectors that map cleanly to a node + are cheap (no unit/coverage/conformance run). +const HEALTH_DETECTORS: readonly DriftDetector[] = [ + missingTests, + untestedAc, + missingImplementation, + unmappedArtifact, + referenceIntegrity, + docReferenceIntegrity, + dependencyCycle, + statusDrift, + staleTests, + staleAttestation, +]; + +const FEATURE_ID = /\bF-(?:\d{3,}|[a-f0-9]{6,8})\b/; + +/** Resolves a finding to the graph node it concerns, or null. */ +function findingNode(f: DriftFinding, ids: ReadonlySet): string | null { + if (f.path) { + const p = f.path.split('#')[0].trim(); // test_refs carry `file#anchor` + for (const cand of [nodeId.module(p), nodeId.test(p), nodeId.doc(p)]) { + if (ids.has(cand)) return cand; + } + } + const m = FEATURE_ID.exec(f.message ?? ''); + if (m && ids.has(nodeId.feature(m[0]))) return nodeId.feature(m[0]); + return null; +} + +/** + * Runs the curated health detectors and returns a map of node id → worst-severity + * health badge. Errors outrank warnings; `info` findings are ignored. A node with + * no findings is absent from the map (so a healthy graph yields {} — the default + * pretty view, no alarms). + */ +export function nodeHealth(graph: KnowledgeGraph, cwd: string = '.'): Record { + const ids = new Set(graph.nodes.map((n) => n.id)); + const acc: Record}> = {}; + for (const detector of HEALTH_DETECTORS) { + let findings: readonly DriftFinding[] = []; + try { + findings = detector.run({cwd}); + } catch { + continue; // a detector that can't load the spec just contributes nothing + } + for (const f of findings) { + if (f.severity !== 'error' && f.severity !== 'warn') continue; + const id = findingNode(f, ids); + if (!id) continue; + const cur = acc[id] ?? (acc[id] = {severity: 'warn', count: 0, detectors: new Set()}); + cur.count += 1; + cur.detectors.add(f.detector); + if (f.severity === 'error') cur.severity = 'error'; + } + } + const out: Record = {}; + for (const id of Object.keys(acc).sort()) { + const v = acc[id]; + out[id] = {severity: v.severity, count: v.count, detectors: [...v.detectors].sort()}; + } + return out; +} diff --git a/tests/cli/clad.test.ts b/tests/cli/clad.test.ts index fb721132..40143234 100644 --- a/tests/cli/clad.test.ts +++ b/tests/cli/clad.test.ts @@ -471,7 +471,7 @@ describe('cli/clad — handler exports', () => { }); describe('cli/clad — createProgram', () => { - test('returns a Command with all 18 verbs registered (work removed in 0.6.0; hook F-1d23a6, context F-d2c806, changelog F-904495a5)', () => { + test('returns a Command with all 22 verbs registered (work removed in 0.6.0; hook F-1d23a6, context F-d2c806, impact F-7794a6bc, infer-deps F-2be3e3bb, measure F-16138071, graph F-569f4b37, changelog F-904495a5)', () => { const program = clad.createProgram(); const names = program.commands.map((c) => c.name()); expect(names).toEqual([ @@ -487,6 +487,10 @@ describe('cli/clad — createProgram', () => { 'rollback', 'status', 'context', + 'impact', + 'infer-deps', + 'measure', + 'graph', 'changelog', 'route', 'hook', diff --git a/tests/cli/graph-export-pipe.test.ts b/tests/cli/graph-export-pipe.test.ts new file mode 100644 index 00000000..9bbf024e --- /dev/null +++ b/tests/cli/graph-export-pipe.test.ts @@ -0,0 +1,36 @@ +// Cladding · `clad graph export` pipe-flush regression guard. +// +// Bug (found by the pre-PR empirical sweep): runGraphExportCommand wrote the +// rendered graph to stdout and then called `process.exit(0)` on the NEXT line. +// On a pipe, `stdout.write` is async — `process.exit` killed the process before +// the OS pipe buffer (~64 KiB) drained, truncating any export larger than that +// (cladding's own graph is ~285 KiB). File / `--out` (synchronous writes) were +// unaffected, so only the documented `clad graph export … | jq` path broke. +// +// Reproduce it the way it actually fails: spawn the CLI so its stdout is a PIPE +// (execFileSync pipes the child's stdout) and confirm the whole JSON arrives +// intact. Before the fix this returns exactly 65536 bytes and fails to parse. + +import {execFileSync} from 'node:child_process'; +import {dirname, join} from 'node:path'; +import {fileURLToPath} from 'node:url'; +import {describe, expect, test} from 'vitest'; + +const REPO = join(dirname(fileURLToPath(import.meta.url)), '..', '..'); + +describe('clad graph export — flushes stdout before exit (no 64 KiB pipe truncation)', () => { + test('--format json over a pipe arrives complete and parseable', () => { + const out = execFileSync('npx', ['tsx', 'src/cli/clad.ts', 'graph', 'export', '--format', 'json'], { + cwd: REPO, + encoding: 'utf8', + maxBuffer: 64 * 1024 * 1024, + }); + // Must exceed the pipe buffer or the guard is vacuous — cladding's own spec + // renders well past 64 KiB. (65536 = the exact byte count the bug truncated to.) + expect(out.length).toBeGreaterThan(65536); + // The truncated output was cut mid-structure and could not be parsed. + const graph = JSON.parse(out) as {nodes: {kind: string}[]; edges: unknown[]}; + expect(graph.nodes.some((n) => n.kind === 'feature')).toBe(true); + expect(graph.edges.length).toBeGreaterThan(0); + }, 60_000); +}); diff --git a/tests/cli/graph-serve.test.ts b/tests/cli/graph-serve.test.ts new file mode 100644 index 00000000..19a7d0dc --- /dev/null +++ b/tests/cli/graph-serve.test.ts @@ -0,0 +1,131 @@ +import {mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; +import http from 'node:http'; +import {afterEach, beforeEach, describe, expect, test} from 'vitest'; +import {createGraphServer} from '../../src/cli/graph-serve.js'; + +interface HttpResult { + status: number; + headers: http.IncomingHttpHeaders; + body: string; +} + +interface HeaderResult { + status: number; + headers: http.IncomingHttpHeaders; +} + +function get(port: number, path: string): Promise { + return new Promise((resolve, reject) => { + const req = http.get({host: '127.0.0.1', port, path}, res => { + res.setEncoding('utf8'); + let body = ''; + res.on('data', c => { + body += c; + }); + res.on('end', () => { + resolve({ + status: res.statusCode ?? 0, + headers: res.headers, + body, + }); + }); + }); + req.on('error', reject); + }); +} + +// For endpoints that stay open (SSE), resolve as soon as we have the +// response object + headers, then destroy the response stream so we +// don't hang on the open stream. +function getHeaders(port: number, path: string): Promise { + return new Promise((resolve, reject) => { + const req = http.get({host: '127.0.0.1', port, path}, res => { + const result: HeaderResult = { + status: res.statusCode ?? 0, + headers: res.headers, + }; + res.destroy(); + resolve(result); + }); + req.on('error', reject); + }); +} + +// A minimal spec that the cladding schema accepts (feature id must match +// ^F-(\d{3,}|[a-f0-9]{6,})$ and AC id ^AC-(\d{3,}|[a-f0-9]{6,})$), so the +// live graph computes a non-empty {nodes, edges}. +const SPEC = `schema: "0.1" +project: {name: t, language: typescript} +features: + - id: F-abc123 + slug: alpha + title: alpha + status: done + modules: [src/a.ts] + acceptance_criteria: + - id: AC-001 + ears: ubiquitous + text: t +`; + +const FEATURE_NODE_ID = 'feature:F-abc123'; + +describe('F-64a5c159 live graph HTTP server', () => { + let dir: string; + + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-serve-')); + writeFileSync(join(dir, 'spec.yaml'), SPEC); + }); + + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + test('serves the live viewer, a fresh graph json, and an SSE events stream', async () => { + const srv = await createGraphServer({port: 0, cwd: dir}); + try { + const gj = await get(srv.port, '/graph.json'); + expect(gj.status).toBe(200); + const g = JSON.parse(gj.body) as {nodes: {id: string}[]; edges: unknown[]}; + expect(g.nodes.length).toBeGreaterThan(0); + expect(Array.isArray(g.edges)).toBe(true); + expect(g.nodes.some(n => n.id === FEATURE_NODE_ID)).toBe(true); + + const home = await get(srv.port, '/'); + expect(home.status).toBe(200); + expect(home.body).toContain(''); + + const ev = await getHeaders(srv.port, '/events'); + expect(ev.status).toBe(200); + expect(String(ev.headers['content-type']).includes('text/event-stream')).toBe(true); + } finally { + await srv.close(); + } + }); + + test('a watched-file change broadcasts an SSE refresh', async () => { + const srv = await createGraphServer({port: 0, cwd: dir}); + const chunks: string[] = []; + const req = http.get( + {host: '127.0.0.1', port: srv.port, path: '/events'}, + res => { + res.setEncoding('utf8'); + res.on('data', c => { + chunks.push(c as string); + }); + }, + ); + try { + await new Promise(r => setTimeout(r, 100)); // let the connection register + srv.broadcast(); + await new Promise(r => setTimeout(r, 100)); // let the event arrive + expect(chunks.join('')).toContain('data: refresh'); + } finally { + req.destroy(); + await srv.close(); + } + }); +}); diff --git a/tests/cli/impact-card.test.ts b/tests/cli/impact-card.test.ts new file mode 100644 index 00000000..32e2a623 --- /dev/null +++ b/tests/cli/impact-card.test.ts @@ -0,0 +1,69 @@ +import {describe, test, expect} from 'vitest'; +import {readFileSync} from 'node:fs'; +import {formatImpactCard, editMagnitude} from '../../src/cli/hook.js'; +import type {ImpactSlice} from '../../src/optimizer/reverse-slice.js'; + +describe('impact card', () => { + test('formatImpactCard renders owner, breaks, and tests for a touched file', () => { + const slice: ImpactSlice = { + focus: {id: 'F-abc123', title: 'Login'}, + impacted: [ + {id: 'F-one', title: 'One'}, + {id: 'F-two', title: 'Two'}, + ], + impacted_modules: [], + scenarios: [], + test_refs: ['t1', 't2', 't3'], + }; + + const card = formatImpactCard(slice, 'src/login.ts'); + expect(card).not.toBe(''); + expect(card).toContain('cladding impact:'); + expect(card).toContain('src/login.ts'); + expect(card).toContain('F-abc123'); + expect(card).toContain('breaks 2 feature'); + expect(card).toContain('run 3 test'); + + const moduleSlice: ImpactSlice = { + focus: {module: 'src/x.ts', owners: ['F-aaa', 'F-bbb']}, + impacted: [], + impacted_modules: [], + scenarios: [], + test_refs: [], + }; + + const moduleCard = formatImpactCard(moduleSlice, 'src/x.ts'); + expect(moduleCard).not.toBe(''); + expect(moduleCard).toContain('F-aaa'); + expect(moduleCard).toContain('co-owner'); + }); + + test('formatImpactCard is empty when the file touches no feature', () => { + const slice: ImpactSlice = { + focus: {module: 'src/x.ts'}, + impacted: [], + impacted_modules: [], + scenarios: [], + test_refs: [], + }; + + expect(formatImpactCard(slice, 'src/x.ts')).toBe(''); + }); + + test('editMagnitude measures Edit, Write, and MultiEdit changed-char size', () => { + expect(editMagnitude({content: 'abcde'})).toBe(5); + expect(editMagnitude({new_string: 'abc'})).toBe(3); + expect( + editMagnitude({edits: [{new_string: 'ab'}, {new_string: 'cde'}]}), + ).toBe(5); + expect(editMagnitude({})).toBe(0); + }); + + test('ai_hints and the developer persona steer agents to the working-set tools', () => { + const specText = readFileSync('spec.yaml', 'utf8'); + expect(specText).toContain('clad_get_working_set'); + + const developerText = readFileSync('src/agents/developer.md', 'utf8'); + expect(developerText).toContain('clad_get_working_set'); + }); +}); diff --git a/tests/graph/health.test.ts b/tests/graph/health.test.ts new file mode 100644 index 00000000..cff539d2 --- /dev/null +++ b/tests/graph/health.test.ts @@ -0,0 +1,76 @@ +// Cladding · tests for the live SSoT health mapper (the killer) — F graph-live-health +// +// nodeHealth runs cladding's drift detectors and maps each finding to the graph node it +// concerns. These pin the load-bearing behavior: an untested done-AC flags its FEATURE node; +// a healthy feature is absent from the map (so a healthy graph stays the plain pretty view). + +import {mkdirSync, mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {dirname, join} from 'node:path'; +import {afterEach, beforeEach, describe, expect, test} from 'vitest'; + +import {buildGraph} from '../../src/graph/model.js'; +import {nodeHealth} from '../../src/stages/graph-health.js'; +import {loadSpec} from '../../src/spec/load.js'; + +let dir: string; +beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-health-')); +}); +afterEach(() => { + rmSync(dir, {recursive: true, force: true}); +}); + +/** Writes spec.yaml for one done feature whose single AC carries the given test_refs (may be []). */ +function writeSpec(testRefs: readonly string[]): void { + const refs = + testRefs.length > 0 ? ' test_refs:\n' + testRefs.map((r) => ` - ${JSON.stringify(r)}`).join('\n') + '\n' : ''; + writeFileSync( + join(dir, 'spec.yaml'), + 'schema: "0.1"\nproject: {name: t, language: typescript}\nfeatures:\n' + + ' - id: F-abc123\n slug: thing\n title: thing\n status: done\n acceptance_criteria:\n' + + ` - id: AC-001\n ears: ubiquitous\n text: t\n${refs}`, + ); +} +function touch(rel: string): void { + const abs = join(dir, rel); + mkdirSync(dirname(abs), {recursive: true}); + writeFileSync(abs, ''); +} + +describe('nodeHealth (live SSoT conformance)', () => { + test('maps an untested done-AC finding to its feature node', () => { + writeSpec([]); // done AC with NO test_refs → MISSING_TESTS / UNTESTED_AC fire + const graph = buildGraph(loadSpec(dir), dir); + const health = nodeHealth(graph, dir); + + const hv = health['feature:F-abc123']; + expect(hv).toBeTruthy(); + expect(['error', 'warn']).toContain(hv.severity); + expect(hv.detectors.length).toBeGreaterThan(0); + expect(hv.count).toBeGreaterThan(0); + }); + + test('a healthy feature (resolving test_ref) is absent from the health map', () => { + writeSpec(['tests/x.test.ts#it works']); + touch('tests/x.test.ts'); // the cited test exists → no missing/untested finding + const graph = buildGraph(loadSpec(dir), dir); + const health = nodeHealth(graph, dir); + + // The feature is either entirely clean, or at least not flagged for missing/untested tests. + const hv = health['feature:F-abc123']; + if (hv) { + expect(hv.detectors).not.toContain('MISSING_TESTS'); + expect(hv.detectors).not.toContain('UNTESTED_AC'); + } + }); + + test('returns a plain object keyed by graph node id', () => { + writeSpec([]); + const graph = buildGraph(loadSpec(dir), dir); + const health = nodeHealth(graph, dir); + for (const key of Object.keys(health)) { + expect(graph.nodes.some((n) => n.id === key)).toBe(true); // every health key is a real node + } + }); +}); diff --git a/tests/graph/layout3d.test.ts b/tests/graph/layout3d.test.ts new file mode 100644 index 00000000..a083129e --- /dev/null +++ b/tests/graph/layout3d.test.ts @@ -0,0 +1,195 @@ +import {describe, test, expect} from 'vitest'; +import {computeLayout3d} from '../../src/graph/layout3d.js'; + +type Node = {id: string; kind?: string}; +type Edge = {from: string; to: string}; +type Vec3 = [number, number, number]; + +const isVec3 = (v: unknown): v is Vec3 => + Array.isArray(v) && + v.length === 3 && + typeof v[0] === 'number' && + typeof v[1] === 'number' && + typeof v[2] === 'number'; + +describe('computeLayout3d — coverage and tuple shape', () => { + test('every input node id has a 3-number tuple position', () => { + const nodes: Node[] = [{id: 'a'}, {id: 'b'}, {id: 'c'}]; + const edges: Edge[] = [{from: 'a', to: 'b'}]; + const pos = computeLayout3d(nodes, edges); + for (const n of nodes) { + expect(pos[n.id]).toBeDefined(); + expect(isVec3(pos[n.id])).toBe(true); + } + expect(Object.keys(pos).length).toBe(nodes.length); + }); +}); + +describe('computeLayout3d — finiteness', () => { + test('every coordinate is finite', () => { + const nodes: Node[] = Array.from({length: 25}, (_, i) => ({id: 'n' + i})); + const edges: Edge[] = nodes + .slice(1) + .map((n, i) => ({from: n.id, to: 'n' + (i % 5)})); + const pos = computeLayout3d(nodes, edges); + for (const id of Object.keys(pos)) { + const p = pos[id]; + for (const c of p) { + expect(Number.isFinite(c)).toBe(true); + } + } + }); +}); + +describe('computeLayout3d — bounded', () => { + test('default opts: abs(coord) <= 4000', () => { + const nodes: Node[] = Array.from({length: 50}, (_, i) => ({id: 'n' + i})); + const edges: Edge[] = Array.from({length: 80}, (_, i) => ({ + from: 'n' + (i % 50), + to: 'n' + ((i * 7) % 50), + })); + const pos = computeLayout3d(nodes, edges); + for (const id of Object.keys(pos)) { + for (const c of pos[id]) { + expect(Math.abs(c)).toBeLessThanOrEqual(4000); + } + } + }); + + test('opts {bound: 500}: abs(coord) <= 500', () => { + const nodes: Node[] = Array.from({length: 50}, (_, i) => ({id: 'n' + i})); + const edges: Edge[] = Array.from({length: 80}, (_, i) => ({ + from: 'n' + (i % 50), + to: 'n' + ((i * 7) % 50), + })); + const pos = computeLayout3d(nodes, edges, {bound: 500}); + for (const id of Object.keys(pos)) { + for (const c of pos[id]) { + expect(Math.abs(c)).toBeLessThanOrEqual(500); + } + } + }); +}); + +describe('computeLayout3d — determinism', () => { + test('two calls with identical input are deep-equal', () => { + const nodes: Node[] = Array.from({length: 30}, (_, i) => ({id: 'node-' + i})); + const edges: Edge[] = Array.from({length: 40}, (_, i) => ({ + from: 'node-' + (i % 30), + to: 'node-' + ((i * 3) % 30), + })); + const a = computeLayout3d(nodes, edges); + const b = computeLayout3d(nodes, edges); + expect(a).toEqual(b); + }); +}); + +describe('computeLayout3d — distinct positions', () => { + test('30 distinct ids get 30 distinct positions', () => { + const nodes: Node[] = Array.from({length: 30}, (_, i) => ({id: 'd' + i})); + const edges: Edge[] = Array.from({length: 20}, (_, i) => ({ + from: 'd' + i, + to: 'd' + ((i + 1) % 30), + })); + const pos = computeLayout3d(nodes, edges); + const stringified = nodes.map((n) => JSON.stringify(pos[n.id])); + expect(new Set(stringified).size).toBe(nodes.length); + }); +}); + +describe('computeLayout3d — empty', () => { + test('empty graph returns {}', () => { + const pos = computeLayout3d([], []); + expect(pos).toEqual({}); + expect(Object.keys(pos).length).toBe(0); + }); +}); + +describe('computeLayout3d — robustness', () => { + test('edges referencing unknown ids are ignored (no throw, no phantom nodes)', () => { + const nodes: Node[] = [{id: 'a'}, {id: 'b'}]; + const edges: Edge[] = [ + {from: 'a', to: 'b'}, + {from: 'a', to: 'ghost'}, + {from: 'phantom', to: 'b'}, + ]; + const pos = computeLayout3d(nodes, edges); + expect(Object.keys(pos).sort()).toEqual(['a', 'b']); + expect(pos.ghost).toBeUndefined(); + expect(pos.phantom).toBeUndefined(); + }); + + test('a self-edge does not throw', () => { + const nodes: Node[] = [{id: 'a'}, {id: 'b'}]; + const edges: Edge[] = [{from: 'a', to: 'a'}]; + expect(() => computeLayout3d(nodes, edges)).not.toThrow(); + const pos = computeLayout3d(nodes, edges); + expect(isVec3(pos.a)).toBe(true); + expect(isVec3(pos.b)).toBe(true); + }); +}); + +describe('computeLayout3d — not collapsed', () => { + test('hub + 20 leaves + 9 isolated nodes spread out (span > 50)', () => { + const nodes: Node[] = [{id: 'hub'}]; + for (let i = 0; i < 20; i++) nodes.push({id: 'leaf' + i}); + for (let i = 0; i < 9; i++) nodes.push({id: 'iso' + i}); + expect(nodes.length).toBe(30); + const edges: Edge[] = []; + for (let i = 0; i < 20; i++) edges.push({from: 'hub', to: 'leaf' + i}); + + const pos = computeLayout3d(nodes, edges); + + let maxSpan = 0; + for (let axis = 0; axis < 3; axis++) { + let min = Infinity; + let max = -Infinity; + for (const n of nodes) { + const v = pos[n.id][axis]; + if (v < min) min = v; + if (v > max) max = v; + } + maxSpan = Math.max(maxSpan, max - min); + } + expect(maxSpan).toBeGreaterThan(50); + }); +}); + +describe('computeLayout3d — performance', () => { + test( + '700 nodes, ~1200 edges completes under 3000ms', + () => { + const nodes: Node[] = Array.from({length: 700}, (_, i) => ({id: 'n' + i})); + const edges: Edge[] = []; + for (let i = 0; i < 1200; i++) { + edges.push({from: 'n' + i % 700, to: 'n' + (i % 50)}); + } + const start = performance.now(); + const pos = computeLayout3d(nodes, edges); + const elapsed = performance.now() - start; + expect(Object.keys(pos).length).toBe(700); + expect(elapsed).toBeLessThan(3000); + }, + 10000, + ); +}); + +describe('computeLayout3d — optional iterations', () => { + test('iterations:1 still yields finite bounded positions for every node', () => { + const nodes: Node[] = Array.from({length: 30}, (_, i) => ({id: 'it' + i})); + const edges: Edge[] = Array.from({length: 40}, (_, i) => ({ + from: 'it' + (i % 30), + to: 'it' + ((i * 3) % 30), + })); + const pos = computeLayout3d(nodes, edges, {iterations: 1}); + expect(Object.keys(pos).length).toBe(nodes.length); + for (const n of nodes) { + const p = pos[n.id]; + expect(isVec3(p)).toBe(true); + for (const c of p) { + expect(Number.isFinite(c)).toBe(true); + expect(Math.abs(c)).toBeLessThanOrEqual(4000); + } + } + }); +}); diff --git a/tests/graph/model.test.ts b/tests/graph/model.test.ts new file mode 100644 index 00000000..0e83df84 --- /dev/null +++ b/tests/graph/model.test.ts @@ -0,0 +1,147 @@ +import {mkdtempSync, rmSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; +import {afterEach, beforeEach, describe, expect, test} from 'vitest'; +import {buildGraph, subgraph, resolveNodeId, nodeId} from '../../src/graph/model.js'; +import type {Spec} from '../../src/spec/types.js'; + +describe('graph model (F-569f4b37)', () => { + let cwd: string; + + beforeEach(() => { + // Empty temp dir: no docs/ subdir, so no doc nodes appear. + cwd = mkdtempSync(join(tmpdir(), 'clad-graph-')); + }); + + afterEach(() => { + rmSync(cwd, {recursive: true, force: true}); + }); + + test('assembles nodes and edges from spec, reverse-index, and doc links', () => { + const spec = { + schema: '0.1', + project: {name: 'x', language: 'typescript'}, + features: [ + { + id: 'A', + title: 'feature A', + status: 'done', + modules: ['src/a.ts'], + acceptance_criteria: [ + {id: 'A1', test_refs: ['tests/a.test.ts#x', 'derived:skip']}, + ], + }, + { + id: 'B', + title: 'feature B', + status: 'done', + depends_on: ['A'], + }, + ], + scenarios: [{id: 'S1', title: 'scenario one', features: ['A']}], + capabilities: [{id: 'cap1', title: 'capability one', features: ['B']}], + } as unknown as Spec; + + const g = buildGraph(spec, cwd); + + const hasNode = (id: string): boolean => g.nodes.some((n) => n.id === id); + const hasEdge = (from: string, to: string, kind: string): boolean => + g.edges.some((e) => e.from === from && e.to === to && e.kind === kind); + + // node ids include the expected feature/module/test/scenario/capability ids. + expect(hasNode('feature:A')).toBe(true); + expect(hasNode('feature:B')).toBe(true); + expect(hasNode('module:src/a.ts')).toBe(true); + expect(hasNode('test:tests/a.test.ts')).toBe(true); + expect(hasNode('scenario:S1')).toBe(true); + expect(hasNode('capability:cap1')).toBe(true); + + // kind / status of specific nodes. + const moduleNode = g.nodes.find((n) => n.id === 'module:src/a.ts'); + expect(moduleNode?.kind).toBe('module'); + const featureANode = g.nodes.find((n) => n.id === 'feature:A'); + expect(featureANode?.kind).toBe('feature'); + expect(featureANode?.status).toBe('done'); + + // edges: depends_on, touches, covers, binds, implements. + expect(hasEdge('feature:B', 'feature:A', 'depends_on')).toBe(true); + expect(hasEdge('feature:A', 'module:src/a.ts', 'touches')).toBe(true); + expect(hasEdge('feature:A', 'test:tests/a.test.ts', 'covers')).toBe(true); + expect(hasEdge('scenario:S1', 'feature:A', 'binds')).toBe(true); + expect(hasEdge('capability:cap1', 'feature:B', 'implements')).toBe(true); + + // pseudo-ref 'derived:skip' produced NO test node and NO covers edge. + const testNodes = g.nodes.filter((n) => n.id.startsWith('test:')); + expect(testNodes.map((n) => n.id)).toEqual(['test:tests/a.test.ts']); + const coversToNonExistentTest = g.edges.some( + (e) => e.kind === 'covers' && e.to !== 'test:tests/a.test.ts', + ); + expect(coversToNonExistentTest).toBe(false); + // no node id derived from the pseudo-ref. + expect(hasNode('test:derived:skip')).toBe(false); + expect(hasNode('test:skip')).toBe(false); + + // anchor stripped: test node id has no '#x'. + expect(hasNode('test:tests/a.test.ts#x')).toBe(false); + + // determinism. + expect(JSON.stringify(buildGraph(spec, cwd))).toBe( + JSON.stringify(buildGraph(spec, cwd)), + ); + }); + + test('subgraph restricts to the focus node neighborhood within depth', () => { + const spec = { + schema: '0.1', + project: {name: 'x', language: 'typescript'}, + features: [ + {id: 'A', title: 'A', status: 'done'}, + {id: 'B', title: 'B', status: 'done', depends_on: ['A']}, + {id: 'C', title: 'C', status: 'done', depends_on: ['B']}, + {id: 'D', title: 'D', status: 'done', depends_on: ['C']}, + ], + scenarios: [], + capabilities: [], + } as unknown as Spec; + + const g = buildGraph(spec, cwd); + + const ids = (graph: {nodes: readonly {id: string}[]}): string[] => + graph.nodes.map((n) => n.id).sort(); + + // depth 1: A + 1-hop neighbor B (edges undirected). + expect(ids(subgraph(g, nodeId.feature('A'), 1))).toEqual([ + 'feature:A', + 'feature:B', + ]); + + // depth 2: include A, B, C but NOT D. + const d2 = ids(subgraph(g, nodeId.feature('A'), 2)); + expect(d2).toContain('feature:A'); + expect(d2).toContain('feature:B'); + expect(d2).toContain('feature:C'); + expect(d2).not.toContain('feature:D'); + + // unknown focus -> empty. + expect(subgraph(g, 'feature:NOPE', 2)).toEqual({nodes: [], edges: []}); + }); + + test('resolveNodeId resolves by id, slug, and null on miss', () => { + const spec = { + schema: '0.1', + project: {name: 'x', language: 'typescript'}, + features: [ + {id: 'A', title: 'A', status: 'done'}, + {id: 'F-z', slug: 'zed', title: 'z', status: 'done'}, + ], + scenarios: [], + capabilities: [], + } as unknown as Spec; + + const g = buildGraph(spec, cwd); + + expect(resolveNodeId(spec, g, 'A')).toBe('feature:A'); + expect(resolveNodeId(spec, g, 'zed')).toBe('feature:F-z'); + expect(resolveNodeId(spec, g, 'nope')).toBeNull(); + }); +}); diff --git a/tests/graph/render.test.ts b/tests/graph/render.test.ts new file mode 100644 index 00000000..cdf5ed77 --- /dev/null +++ b/tests/graph/render.test.ts @@ -0,0 +1,58 @@ +import {describe, expect, test} from 'vitest'; +import {toMermaid, toDot, toJson, toObsidianVault} from '../../src/graph/render.js'; +import type {KnowledgeGraph} from '../../src/graph/model.js'; + +describe('graph render (F-569f4b37)', () => { + const g: KnowledgeGraph = { + nodes: [ + {id: 'feature:F-1', kind: 'feature', label: 'Feat one', status: 'done'}, + {id: 'module:src/a.ts', kind: 'module', label: 'src/a.ts'}, + ], + edges: [{from: 'feature:F-1', to: 'module:src/a.ts', kind: 'touches'}], + }; + + test('renders deterministic mermaid, dot, and json', () => { + const mermaid = toMermaid(g); + expect(mermaid).toContain('graph LR'); + expect(mermaid).toContain('touches'); + expect(mermaid).toContain('Feat one'); + expect(toMermaid(g)).toBe(toMermaid(g)); + + const dot = toDot(g); + expect(dot).toContain('digraph cladding {'); + expect(dot).toContain('->'); + expect(dot).toContain('[label="touches"]'); + expect(dot.trimEnd().endsWith('}')).toBe(true); + + const parsed = JSON.parse(toJson(g)) as unknown; + expect(parsed).toEqual({nodes: g.nodes, edges: g.edges}); + }); + + test('obsidian vault emits one note per node with wikilinks and backlinks', () => { + const v = toObsidianVault(g); + + expect(v.size).toBe(2); + + const keys = [...v.keys()]; + expect(keys.some((k) => k.startsWith('feature/'))).toBe(true); + expect(keys.some((k) => k.startsWith('module/'))).toBe(true); + + const moduleKey = keys.find((k) => k.startsWith('module/')); + const featureKey = keys.find((k) => k.startsWith('feature/')); + expect(moduleKey).toBeDefined(); + expect(featureKey).toBeDefined(); + + const moduleNote = v.get(moduleKey as string) as string; + const featureNote = v.get(featureKey as string) as string; + + // module note: incoming touches edge -> a backlink to the feature. + expect(moduleNote).toContain('## Backlinks'); + expect(moduleNote).toContain('[['); + expect(moduleNote).toContain('kind:'); + + // feature note: outgoing touches edge -> a link to the module. + expect(featureNote).toContain('## Links'); + expect(featureNote).toContain('[['); + expect(featureNote).toContain('kind:'); + }); +}); diff --git a/tests/graph/stats.test.ts b/tests/graph/stats.test.ts new file mode 100644 index 00000000..0a3bb15a --- /dev/null +++ b/tests/graph/stats.test.ts @@ -0,0 +1,40 @@ +import {describe, expect, test} from 'vitest'; +import {graphStats, renderStats} from '../../src/graph/stats.js'; +import type {KnowledgeGraph} from '../../src/graph/model.js'; + +describe('graph stats (F-569f4b37)', () => { + test('counts nodes and edges by kind and ranks hubs by degree', () => { + const g: KnowledgeGraph = { + nodes: [ + {id: 'feature:H', kind: 'feature', label: 'Hub'}, + {id: 'feature:A', kind: 'feature', label: 'A'}, + {id: 'feature:B', kind: 'feature', label: 'B'}, + {id: 'module:m', kind: 'module', label: 'm'}, + ], + edges: [ + {from: 'feature:A', to: 'feature:H', kind: 'depends_on'}, + {from: 'feature:B', to: 'feature:H', kind: 'depends_on'}, + {from: 'feature:H', to: 'module:m', kind: 'touches'}, + ], + }; + + const s = graphStats(g); + + expect(s.nodeCount).toBe(4); + expect(s.edgeCount).toBe(3); + + expect(s.nodesByKind.feature).toBe(3); + expect(s.nodesByKind.module).toBe(1); + + expect(s.edgesByKind.depends_on).toBe(2); + expect(s.edgesByKind.touches).toBe(1); + + // H has degree 3 (2 incoming depends_on + 1 outgoing touches), the top hub. + expect(s.hubs[0].id).toBe('feature:H'); + expect(s.hubs[0].degree).toBe(3); + + const rendered = renderStats(s); + expect(rendered).toContain('nodes:'); + expect(rendered).toContain('hubs'); + }); +}); diff --git a/tests/graph/stellar.test.ts b/tests/graph/stellar.test.ts new file mode 100644 index 00000000..b20c9e67 --- /dev/null +++ b/tests/graph/stellar.test.ts @@ -0,0 +1,425 @@ +import {describe, test, expect} from 'vitest'; +import { + TIER_COL, + KIND_COL, + EDGE_COL, + DEFAULT_NODE, + DEFAULT_EDGE, + hexToRgb01, + semanticHue, + nodeRadius, + degreeLuminosity, + coreColor, + bloomBoost, + healthOverride, + instanceColor, + edgeColor, + edgeIntensity, +} from '../../src/graph/stellar.js'; + +type RGB = readonly [number, number, number]; + +const maxChannel = (c: RGB): number => Math.max(c[0], c[1], c[2]); + +describe('color constant tables', () => { + test('TIER_COL has the four declared tiers', () => { + expect(TIER_COL.A).toBe('#3b82f6'); + expect(TIER_COL.B).toBe('#a855f7'); + expect(TIER_COL.C).toBe('#14b8a6'); + expect(TIER_COL.D).toBe('#f59e0b'); + }); + + test('KIND_COL has the seven declared kinds (spec=blue · module=orange · test=green · docs=pink)', () => { + expect(KIND_COL.feature).toBe('#4f8ef7'); + expect(KIND_COL.scenario).toBe('#45b5ed'); + expect(KIND_COL.capability).toBe('#8f86f0'); + expect(KIND_COL.module).toBe('#f97316'); + expect(KIND_COL.test).toBe('#22c55e'); + expect(KIND_COL.doc).toBe('#f368a8'); + expect(KIND_COL.skill).toBe('#f7a8e6'); + expect(KIND_COL.skill).not.toBe(KIND_COL.module); // skills must NOT look like code + }); + + test('skill sits in the DOCS pink family (≈300-340° hue), not the CODE/TEST zone', () => { + // skill is SKILL.md, a document — its hue must be in the magenta-pink arc with doc, far from + // the orange module (≈25°) and green test (≈142°). + const hueOf = (hex: string): number => { + const v = parseInt(hex.slice(1), 16); + const r = ((v >> 16) & 255) / 255, + g = ((v >> 8) & 255) / 255, + b = (v & 255) / 255; + const mx = Math.max(r, g, b), + mn = Math.min(r, g, b), + d = mx - mn; + let h = 0; + if (d) { + if (mx === r) h = ((g - b) / d) % 6; + else if (mx === g) h = (b - r) / d + 2; + else h = (r - g) / d + 4; + h *= 60; + if (h < 0) h += 360; + } + return h; + }; + const skillHue = hueOf(KIND_COL.skill); + expect(skillHue).toBeGreaterThan(295); + expect(skillHue).toBeLessThan(345); + expect(hueOf(KIND_COL.doc)).toBeGreaterThan(295); // doc is in the same pink family + }); + + test('EDGE_COL has the seven declared edge kinds', () => { + expect(EDGE_COL.depends_on).toBe('#3b82f6'); + expect(EDGE_COL.touches).toBe('#f97316'); + expect(EDGE_COL.covers).toBe('#22c55e'); + expect(EDGE_COL.binds).toBe('#22d3ee'); + expect(EDGE_COL.implements).toBe('#a855f7'); + expect(EDGE_COL.references).toBe('#ec4899'); + expect(EDGE_COL.links).toBe('#64748b'); + }); + + test('DEFAULT_NODE and DEFAULT_EDGE are the declared fallbacks', () => { + expect(DEFAULT_NODE).toBe('#9ca3af'); + expect(DEFAULT_EDGE).toBe('#1C8585'); + }); +}); + +describe('hexToRgb01', () => { + test('white maps to [1,1,1]', () => { + const [r, g, b] = hexToRgb01('#ffffff'); + expect(r).toBeCloseTo(1); + expect(g).toBeCloseTo(1); + expect(b).toBeCloseTo(1); + }); + + test('black maps to [0,0,0]', () => { + const [r, g, b] = hexToRgb01('#000000'); + expect(r).toBeCloseTo(0); + expect(g).toBeCloseTo(0); + expect(b).toBeCloseTo(0); + }); + + test('pure red maps to [1,0,0]', () => { + const [r, g, b] = hexToRgb01('#ff0000'); + expect(r).toBeCloseTo(1); + expect(g).toBeCloseTo(0); + expect(b).toBeCloseTo(0); + }); + + test('3-digit shorthand expands (#fff -> [1,1,1])', () => { + const [r, g, b] = hexToRgb01('#fff'); + expect(r).toBeCloseTo(1); + expect(g).toBeCloseTo(1); + expect(b).toBeCloseTo(1); + }); +}); + +describe('semanticHue', () => { + test('kind always wins — tier never touches the node hue (double-encoding removed)', () => { + // Even a tiered node colors by kind: a tier-A module is orange (its kind), NOT tier-A blue. + expect(semanticHue({tier: 'A', kind: 'module'})).toBe('#f97316'); + expect(semanticHue({tier: 'B', kind: 'test'})).toBe('#22c55e'); + }); + + test('kind maps to its KIND_COL hue', () => { + expect(semanticHue({kind: 'module'})).toBe('#f97316'); + }); + + test('neither tier nor kind falls back to DEFAULT_NODE', () => { + expect(semanticHue({})).toBe(DEFAULT_NODE); + }); + + test('module, test and doc kinds are three distinct colors', () => { + const m = semanticHue({kind: 'module'}); + const t = semanticHue({kind: 'test'}); + const d = semanticHue({kind: 'doc'}); + expect(new Set([m, t, d]).size).toBe(3); + }); + + test('a tier-only node (no kind) falls back to DEFAULT_NODE — tier is not a hue', () => { + expect(semanticHue({tier: 'A'})).toBe(DEFAULT_NODE); + expect(semanticHue({tier: 'B'})).toBe(DEFAULT_NODE); + expect(semanticHue({tier: 'C'})).toBe(DEFAULT_NODE); + }); + + test('TIER_COL still carries distinct A/B/C/D colors for the sidebar tier FILTER', () => { + // Tier no longer colors a node, but the sidebar filter legend still needs distinct swatches. + expect(new Set([TIER_COL.A, TIER_COL.B, TIER_COL.C, TIER_COL.D]).size).toBe(4); + }); +}); + +describe('nodeRadius', () => { + test('degree 0 gives radius 3', () => { + expect(nodeRadius(0)).toBeCloseTo(3); + }); + + test('matches min(15, 3 + sqrt(deg)*1.7) for a mid value', () => { + expect(nodeRadius(4)).toBeCloseTo(Math.min(15, 3 + Math.sqrt(4) * 1.7)); + }); + + test('monotonic non-decreasing in deg', () => { + let prev = -Infinity; + for (let d = 0; d <= 200; d++) { + const r = nodeRadius(d); + expect(r).toBeGreaterThanOrEqual(prev); + prev = r; + } + }); + + test('capped at 15 for huge degree', () => { + expect(nodeRadius(1e6)).toBe(15); + }); +}); + +describe('degreeLuminosity', () => { + test('zero degree gives 0', () => { + expect(degreeLuminosity(0, 10)).toBeCloseTo(0); + }); + + test('full degree gives 1', () => { + expect(degreeLuminosity(10, 10)).toBeCloseTo(1); + }); + + test('half degree gives 0.5', () => { + expect(degreeLuminosity(5, 10)).toBeCloseTo(0.5); + }); + + test('zero maxDeg is guarded to 0', () => { + expect(degreeLuminosity(5, 0)).toBeCloseTo(0); + }); + + test('clamped to 0..1 even when deg > maxDeg', () => { + const v = degreeLuminosity(50, 10); + expect(v).toBeGreaterThanOrEqual(0); + expect(v).toBeLessThanOrEqual(1); + }); + + test('monotonic non-decreasing in deg', () => { + let prev = -Infinity; + for (let d = 0; d <= 20; d++) { + const v = degreeLuminosity(d, 10); + expect(v).toBeGreaterThanOrEqual(prev); + prev = v; + } + }); +}); + +describe('coreColor', () => { + const hue: RGB = hexToRgb01('#3b82f6'); // a non-white hue + + test('norm=1 channels >= norm=0 channels, at least one strictly greater', () => { + const lo = coreColor(hue, 0); + const hi = coreColor(hue, 1); + let anyStrictlyGreater = false; + for (let i = 0; i < 3; i++) { + expect(hi[i]).toBeGreaterThanOrEqual(lo[i] - 1e-9); + if (hi[i] > lo[i] + 1e-9) anyStrictlyGreater = true; + } + expect(anyStrictlyGreater).toBe(true); + }); + + test('norm=0 is hue mixed ~10% toward white, not exactly hue', () => { + const lo = coreColor(hue, 0); + let differsFromHue = false; + for (let i = 0; i < 3; i++) { + if (Math.abs(lo[i] - hue[i]) > 1e-6) differsFromHue = true; + } + expect(differsFromHue).toBe(true); + }); +}); + +describe('bloomBoost', () => { + test('[1,1,1] boosts to ~[2,2,2] (brightness 1 -> boost 2.0)', () => { + const [r, g, b] = bloomBoost([1, 1, 1]); + expect(r).toBeCloseTo(2); + expect(g).toBeCloseTo(2); + expect(b).toBeCloseTo(2); + }); + + test('[0,0,0] stays [0,0,0]', () => { + const [r, g, b] = bloomBoost([0, 0, 0]); + expect(r).toBeCloseTo(0); + expect(g).toBeCloseTo(0); + expect(b).toBeCloseTo(0); + }); + + test('a near-white input produces a channel > 1.0', () => { + const out = bloomBoost([0.9, 0.9, 0.9]); + expect(maxChannel(out)).toBeGreaterThan(1.0); + }); +}); + +describe('healthOverride', () => { + test('error is red-dominant (r is the largest channel)', () => { + const [r, g, b] = healthOverride('error', 0.5); + expect(r).toBeGreaterThan(g); + expect(r).toBeGreaterThan(b); + }); + + test('error red channel exceeds 1.0', () => { + const [r] = healthOverride('error', 0); + expect(r).toBeGreaterThan(1.0); + }); + + test('warn is amber: g is substantial and >> error g at same norm', () => { + const warn = healthOverride('warn', 0.5); + const err = healthOverride('error', 0.5); + // warn green channel substantial + expect(warn[1]).toBeGreaterThan(0.5); + // distinctly higher green than error at same norm + expect(warn[1]).toBeGreaterThan(err[1]); + }); + + test('larger norm -> brighter (error)', () => { + const lo = healthOverride('error', 0); + const hi = healthOverride('error', 1); + expect(maxChannel(hi)).toBeGreaterThan(maxChannel(lo)); + }); + + test('pulse scales linearly (pulse=0.5 is half of pulse=1)', () => { + const full = healthOverride('error', 0.5, 1); + const half = healthOverride('error', 0.5, 0.5); + for (let i = 0; i < 3; i++) { + expect(half[i]).toBeCloseTo(full[i] * 0.5); + } + }); + + test('default pulse is 1', () => { + const def = healthOverride('error', 0.5); + const one = healthOverride('error', 0.5, 1); + for (let i = 0; i < 3; i++) { + expect(def[i]).toBeCloseTo(one[i]); + } + }); +}); + +describe('instanceColor', () => { + const healthyHub = instanceColor({ + node: {kind: 'feature'}, + deg: 30, + maxDeg: 30, + }); + + test('a healthy hub blooms (at least one channel > 1.0)', () => { + expect(maxChannel(healthyHub)).toBeGreaterThan(1.0); + }); + + test('dimmed node every channel small and strictly less than non-dimmed boosted', () => { + const normal = instanceColor({ + node: {kind: 'feature'}, + deg: 30, + maxDeg: 30, + dimmed: false, + }); + const dim = instanceColor({ + node: {kind: 'feature'}, + deg: 30, + maxDeg: 30, + dimmed: true, + }); + for (let i = 0; i < 3; i++) { + expect(dim[i]).toBeLessThan(normal[i] + 1e-9); + } + // dimmed max channel strictly less than healthy same node max channel + expect(maxChannel(dim)).toBeLessThan(maxChannel(normal)); + }); + + test('an error drift node has a channel > 1.0', () => { + const drift = instanceColor({ + node: {kind: 'feature'}, + deg: 5, + maxDeg: 30, + health: {severity: 'error'}, + }); + expect(maxChannel(drift)).toBeGreaterThan(1.0); + }); + + test('error drift is the brightest: its max channel > any healthy node max channel', () => { + const drift = instanceColor({ + node: {kind: 'feature'}, + deg: 1, + maxDeg: 30, + health: {severity: 'error'}, + }); + // build several healthy nodes across kinds and degrees + const healthyMaxes: number[] = []; + for (const kind of ['feature', 'module', 'test', 'doc', 'scenario', 'capability']) { + for (const deg of [0, 5, 15, 30]) { + healthyMaxes.push( + maxChannel(instanceColor({node: {kind}, deg, maxDeg: 30})), + ); + } + } + const brightestHealthy = Math.max(...healthyMaxes); + expect(maxChannel(drift)).toBeGreaterThan(brightestHealthy); + }); + + test('health set on a non-dimmed node takes the health branch (amber for warn)', () => { + const warn = instanceColor({ + node: {kind: 'feature'}, + deg: 5, + maxDeg: 30, + health: {severity: 'warn'}, + }); + // amber: red and green both substantial + expect(warn[0]).toBeGreaterThan(0.5); + expect(warn[1]).toBeGreaterThan(0.5); + }); + + test('dimmed wins over health (mutually exclusive, dimmed first)', () => { + const dimmedWithHealth = instanceColor({ + node: {kind: 'feature'}, + deg: 5, + maxDeg: 30, + dimmed: true, + health: {severity: 'error'}, + }); + // dimmed core *0.15 -> every channel small, well below 1.0 + expect(maxChannel(dimmedWithHealth)).toBeLessThan(1.0); + }); +}); + +describe('edgeColor', () => { + test('known kind maps to its color', () => { + expect(edgeColor('depends_on')).toBe('#3b82f6'); + }); + + test('unknown kind falls back to DEFAULT_EDGE', () => { + expect(edgeColor('totally-unknown')).toBe(DEFAULT_EDGE); + expect(edgeColor('totally-unknown')).toBe('#1C8585'); + }); +}); + +describe('edgeIntensity', () => { + test('no highlight, same kind -> 0.25', () => { + expect( + edgeIntensity({highlightActive: false, sourceHi: false, targetHi: false, sameKind: true}), + ).toBeCloseTo(0.25); + }); + + test('no highlight, different kind -> 0.06', () => { + expect( + edgeIntensity({highlightActive: false, sourceHi: false, targetHi: false, sameKind: false}), + ).toBeCloseTo(0.06); + }); + + test('highlight active, both endpoints hi -> 0.5', () => { + expect( + edgeIntensity({highlightActive: true, sourceHi: true, targetHi: true, sameKind: false}), + ).toBeCloseTo(0.5); + }); + + test('highlight active, neither hi -> 0 (skip)', () => { + expect( + edgeIntensity({highlightActive: true, sourceHi: false, targetHi: false, sameKind: true}), + ).toBeCloseTo(0); + }); + + test('highlight active, exactly one hi -> 0.04', () => { + expect( + edgeIntensity({highlightActive: true, sourceHi: true, targetHi: false, sameKind: false}), + ).toBeCloseTo(0.04); + expect( + edgeIntensity({highlightActive: true, sourceHi: false, targetHi: true, sameKind: false}), + ).toBeCloseTo(0.04); + }); +}); diff --git a/tests/graph/viewer.test.ts b/tests/graph/viewer.test.ts new file mode 100644 index 00000000..d26c0e59 --- /dev/null +++ b/tests/graph/viewer.test.ts @@ -0,0 +1,173 @@ +import {mkdtempSync, mkdirSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join, dirname} from 'node:path'; +import {afterEach, beforeEach, describe, expect, test} from 'vitest'; +import {buildGraph, extractTierFromDoc} from '../../src/graph/model.js'; +import {getTierColor, getTierLegend, TIER_META, CODE_COLOR} from '../../src/graph/render.js'; +import {toHtmlShell} from '../../src/graph/viewer-shell.js'; +import type {Spec} from '../../src/spec/types.js'; +import type {KnowledgeGraph} from '../../src/graph/model.js'; + +describe('F-02343cd1 — SSoT-tier coloring + slug labels + self-contained HTML viewer', () => { + let tmp: string; + + beforeEach(() => { + tmp = mkdtempSync(join(tmpdir(), 'clad-viewer-')); + }); + + afterEach(() => { + rmSync(tmp, {recursive: true, force: true}); + }); + + const byId = (g: KnowledgeGraph, id: string) => g.nodes.find((n) => n.id === id); + + const writeFile = (cwd: string, relPath: string, content: string): void => { + const full = join(cwd, relPath); + mkdirSync(dirname(full), {recursive: true}); + writeFileSync(full, content, 'utf8'); + }; + + test('assigns tier by kind and parses doc banner; feature label prefers slug', () => { + const spec = { + schema: '0.1', + project: {name: 'x', language: 'typescript'}, + features: [ + {id: 'F-1', slug: 'my-slug', title: 'My Feature', status: 'done', modules: ['src/a.ts']}, + {id: 'F-2', title: 'No Slug', status: 'done'}, + ], + scenarios: [{id: 'S-1', title: 'sc', features: ['F-1']}], + capabilities: [{id: 'cap', title: 'Cap', features: ['F-1']}], + } as unknown as Spec; + + const g = buildGraph(spec, tmp); + + const f1 = byId(g, 'feature:F-1'); + expect(f1).toBeDefined(); + expect(f1!.tier).toBe('A'); + expect(f1!.label).toBe('my-slug'); + + const f2 = byId(g, 'feature:F-2'); + expect(f2).toBeDefined(); + expect(f2!.tier).toBe('A'); + expect(f2!.label).toBe('No Slug'); + + const s1 = byId(g, 'scenario:S-1'); + expect(s1).toBeDefined(); + expect(s1!.tier).toBe('A'); + + const cap = byId(g, 'capability:cap'); + expect(cap).toBeDefined(); + expect(cap!.tier).toBe('B'); + + const mod = byId(g, 'module:src/a.ts'); + expect(mod).toBeDefined(); + expect(mod!.tier).toBeUndefined(); + + writeFile(tmp, 'docs/x.md', '\nmore lines\n'); + expect(extractTierFromDoc('docs/x.md', tmp)).toBe('C'); + + writeFile(tmp, 'spec/architecture.yaml', 'not a banner\nstuff: here\n'); + expect(extractTierFromDoc('spec/architecture.yaml', tmp)).toBe('B'); + + expect(extractTierFromDoc('docs/nope.md', tmp)).toBeUndefined(); + }); + + test('tier color mapping is stable and the legend counts per tier', () => { + expect(getTierColor('A')).toBe(TIER_META.A.color); + expect(getTierColor('B')).toBe(TIER_META.B.color); + expect(getTierColor(undefined)).toBe(CODE_COLOR); + + const tierColors = [TIER_META.A.color, TIER_META.B.color, TIER_META.C.color, TIER_META.D.color]; + for (const c of tierColors) { + expect(typeof c).toBe('string'); + } + const distinct = new Set([...tierColors, CODE_COLOR]); + expect(distinct.size).toBe(5); + + const g: KnowledgeGraph = { + nodes: [ + {id: 'feature:F-1', kind: 'feature', label: 'a', tier: 'A'}, + {id: 'scenario:S-1', kind: 'scenario', label: 's', tier: 'A'}, + {id: 'capability:c', kind: 'capability', label: 'c', tier: 'B'}, + {id: 'module:m.ts', kind: 'module', label: 'm.ts'}, + ], + edges: [], + }; + + const leg = getTierLegend(g); + + const a = leg.find((e) => e.key === 'A'); + expect(a).toBeDefined(); + expect(a!.count).toBe(2); + expect(typeof a!.color).toBe('string'); + + const b = leg.find((e) => e.key === 'B'); + expect(b).toBeDefined(); + expect(b!.count).toBe(1); + expect(typeof b!.color).toBe('string'); + + const code = leg.find((e) => e.key === 'code'); + expect(code).toBeDefined(); + expect(code!.count).toBe(1); + expect(typeof code!.color).toBe('string'); + + expect(leg.find((e) => e.key === 'C')).toBeUndefined(); + expect(leg.find((e) => e.key === 'D')).toBeUndefined(); + }); + + test('emits one self-contained offline html embedding the graph, deterministically', () => { + const g: KnowledgeGraph = { + nodes: [ + {id: 'feature:F-1', kind: 'feature', label: 'my-slug', tier: 'A', status: 'done', detail: 'My Feature'}, + {id: 'module:src/a.ts', kind: 'module', label: 'src/a.ts'}, + ], + edges: [{from: 'feature:F-1', to: 'module:src/a.ts', kind: 'touches'}], + }; + + const html = toHtmlShell(g); + + expect(html).toContain(''); + expect(html).toContain('/); + expect(m).not.toBeNull(); + const data = JSON.parse(m![1].replace(/\\u003c/g, '<')); + expect(data.nodes.length).toBe(2); + expect(data.edges.length).toBe(1); + expect(Array.isArray(data.legend)).toBe(true); + expect(data.legend.length).toBeGreaterThan(0); + + expect(toHtmlShell(g)).toBe(toHtmlShell(g)); + }); + + test('sidebar groups kinds into spec/code/test/docs zones and labels tiers as a filter', () => { + const g: KnowledgeGraph = { + nodes: [{id: 'feature:F-1', kind: 'feature', label: 's', tier: 'A', status: 'done', detail: 'F'}], + edges: [], + }; + const html = toHtmlShell(g); + // One color legend, grouped by what the node IS (the zone reads at a glance). + expect(html).toContain('id="kinds-spec"'); + expect(html).toContain('id="kinds-code"'); + expect(html).toContain('id="kinds-test"'); + expect(html).toContain('id="kinds-docs"'); + // Tier is demoted to a filter (no competing color legend) — label says so. + expect(html).toContain('SSoT layer'); + expect(html).toContain('(filter)'); + }); +}); diff --git a/tests/optimizer/code-excerpt.test.ts b/tests/optimizer/code-excerpt.test.ts new file mode 100644 index 00000000..bf1bfa0a --- /dev/null +++ b/tests/optimizer/code-excerpt.test.ts @@ -0,0 +1,96 @@ +import {describe, test, expect, afterEach} from 'vitest'; +import {mkdtempSync, writeFileSync, rmSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; +import {codeExcerpt, withinCwd, estTokens} from '../../src/optimizer/code-excerpt.js'; + +const tmpDirs: string[] = []; + +function makeTmp(): string { + const dir = mkdtempSync(join(tmpdir(), 'clad-excerpt-')); + tmpDirs.push(dir); + return dir; +} + +afterEach(() => { + while (tmpDirs.length > 0) { + const dir = tmpDirs.pop(); + if (dir) rmSync(dir, {recursive: true, force: true}); + } +}); + +describe('estTokens', () => { + test('estimates tokens as ceil(length/4)', () => { + expect(estTokens('abcd')).toBe(1); + expect(estTokens('')).toBe(0); + expect(estTokens('a')).toBe(1); + expect(estTokens('abcde')).toBe(2); + }); +}); + +describe('code-excerpt', () => { + test('reads a code file clipped to the budget with a truncation marker', () => { + const dir = makeTmp(); + + // Long file: 5000 chars of valid-ish TS content. + const longName = 'long.ts'; + const longText = 'const x = 1;\n'.repeat(0) + 'a'.repeat(5000); + writeFileSync(join(dir, longName), longText, 'utf8'); + + const clipped = codeExcerpt(longName, dir, 400); + expect(clipped.path).toBe(longName); + expect(clipped.truncated).toBe(true); + expect(typeof clipped.text).toBe('string'); + expect(clipped.text!.length).toBeLessThanOrEqual(400); + expect(clipped.text!.includes('clipped')).toBe(true); + expect(clipped.omitted).toBeUndefined(); + + // Short file: returned in full, untruncated. + const shortName = 'short.ts'; + const shortText = 'export const hello = "world";\n'; + writeFileSync(join(dir, shortName), shortText, 'utf8'); + + const full = codeExcerpt(shortName, dir, 400); + expect(full.path).toBe(shortName); + expect(full.text).toBe(shortText); + expect(full.truncated).toBeUndefined(); + expect(full.omitted).toBeUndefined(); + }); + + test('rejects path traversal and non-whitelisted/binary/missing files safely', () => { + const dir = makeTmp(); + + // withinCwd contract. + expect(withinCwd('../x', dir)).toBe(false); + expect(withinCwd('safe.ts', dir)).toBe(true); + + // Path traversal -> unsafe-path, never throws, no text. + const traversal = (() => codeExcerpt('../../etc/passwd', dir, 1000))(); + expect(traversal.omitted).toBe('unsafe-path'); + expect(traversal.text).toBeUndefined(); + + // Absolute path outside cwd -> unsafe-path. + const abs = (() => codeExcerpt('/etc/hosts', dir, 1000))(); + expect(abs.omitted).toBe('unsafe-path'); + expect(abs.text).toBeUndefined(); + + // Non-whitelisted extension: write the file so EXTENSION (not missing) triggers it. + const exeName = 'thing.exe'; + writeFileSync(join(dir, exeName), 'data', 'utf8'); + const exe = codeExcerpt(exeName, dir, 1000); + expect(exe.omitted).toBe('unsupported'); + expect(exe.text).toBeUndefined(); + + // Missing whitelisted file -> missing. + const missing = codeExcerpt('gone.ts', dir, 1000); + expect(missing.omitted).toBe('missing'); + expect(missing.text).toBeUndefined(); + + // Binary file (contains NUL byte) -> binary. + const binName = 'bin.ts'; + writeFileSync(join(dir, binName), 'abc' + String.fromCharCode(0) + 'def', 'utf8'); + const bin = codeExcerpt(binName, dir, 1000); + expect(bin.omitted).toBe('binary'); + expect(bin.text).toBeUndefined(); + }); +}); diff --git a/tests/optimizer/infer-depends-on-dynamic.test.ts b/tests/optimizer/infer-depends-on-dynamic.test.ts new file mode 100644 index 00000000..bf5c3e9c --- /dev/null +++ b/tests/optimizer/infer-depends-on-dynamic.test.ts @@ -0,0 +1,93 @@ +import { describe, expect, test } from 'vitest'; +import { inferDependsOn } from '../../src/optimizer/infer-depends-on.js'; +import type { Spec } from '../../src/spec/types.js'; + +type Feature = { + id: string; + slug: string; + title: string; + status: string; + modules: string[]; + depends_on: string[]; + acceptance_criteria: unknown[]; +}; + +const feature = (id: string, slug: string, modules: string[]): Feature => ({ + id, + slug, + title: slug.toUpperCase(), + status: 'done', + modules, + depends_on: [], + acceptance_criteria: [], +}); + +const specOf = (features: Feature[]): Spec => ({ features }) as unknown as Spec; + +const readerOf = + (sources: Record) => + (path: string): string | null => + Object.prototype.hasOwnProperty.call(sources, path) ? sources[path] : null; + +describe('inferDependsOn — dynamicImportFiles', () => { + test('flags a module with dynamic imports in dynamicImportFiles', () => { + const spec = specOf([ + feature('F-aaa111', 'a', ['pkg/a.py']), + feature('F-bbb222', 'b', ['pkg/b.py']), + ]); + const read = readerOf({ + 'pkg/a.py': 'import importlib\nmod = importlib.import_module("pkg.b")\n', + 'pkg/b.py': 'name = "pkg.c"\nmod = __import__(name)\n', + }); + + const result = inferDependsOn(spec, read); + + expect(result.dynamicImportFiles).toContain('pkg/a.py'); + expect(result.dynamicImportFiles).toContain('pkg/b.py'); + expect(result.dynamicImportFiles).toHaveLength(2); + }); + + test('leaves dynamicImportFiles empty when all imports are static', () => { + const spec = specOf([ + feature('F-aaa111', 'a', ['pkg/a.py']), + feature('F-bbb222', 'b', ['pkg/b.py']), + ]); + const read = readerOf({ + 'pkg/a.py': 'from pkg.b import x\nimport os\n', + 'pkg/b.py': 'import sys\nfrom pkg.a import y\n', + }); + + const result = inferDependsOn(spec, read); + + expect(result.dynamicImportFiles).toHaveLength(0); + expect(result.dynamicImportFiles).toEqual([]); + }); + + test('dynamicImportFiles is deterministic and does not alter inferred edges', () => { + const spec = specOf([ + feature('F-aaa111', 'a', ['pkg/a.py']), + feature('F-bbb222', 'b', ['pkg/b.py']), + ]); + const read = readerOf({ + 'pkg/a.py': + 'from pkg.b import x\nimport importlib\nmod = importlib.import_module("pkg.c")\n', + 'pkg/b.py': 'x = 1\n', + }); + + const result = inferDependsOn(spec, read); + + // (a) the static edge F-a -> F-b survives dynamic detection + const connectsAtoB = result.edges.some((edge) => { + const json = JSON.stringify(edge); + return json.includes('F-aaa111') && json.includes('F-bbb222'); + }); + expect(connectsAtoB).toBe(true); + + // (b) the dynamic-import owner is flagged + expect(result.dynamicImportFiles).toContain('pkg/a.py'); + + // (c) deterministic across identical calls + const again = inferDependsOn(spec, read); + expect(JSON.stringify(again)).toBe(JSON.stringify(result)); + }); +}); diff --git a/tests/optimizer/infer-depends-on.test.ts b/tests/optimizer/infer-depends-on.test.ts new file mode 100644 index 00000000..930d0461 --- /dev/null +++ b/tests/optimizer/infer-depends-on.test.ts @@ -0,0 +1,159 @@ +import {describe, test, expect} from 'vitest'; +import {inferDependsOn} from '../../src/optimizer/infer-depends-on.js'; +import type {Spec} from '../../src/spec/types.js'; + +// The `read` fake maps a module path to fake source code (its import +// statements), or null when "unreadable". This keeps inferDependsOn pure — +// no real files are touched. +type Reader = (path: string) => string | null; + +// Build a synthetic Spec from plain feature objects. The contract only cares +// about feature `id`, `modules`, and `depends_on`, so we cast through unknown. +function makeSpec(features: unknown[]): Spec { + return { + schema: '0.1', + project: {name: 't', language: 'python'}, + features, + } as unknown as Spec; +} + +function feature( + id: string, + modules: string[], + dependsOn?: string[], +): unknown { + return { + id, + slug: id.replace(/^F-/, ''), + title: id.toUpperCase(), + status: 'done', + modules, + depends_on: dependsOn ?? [], + acceptance_criteria: [], + }; +} + +describe('inferDependsOn', () => { + test("infers A->B when A's module imports a file owned by B", () => { + const spec = makeSpec([ + feature('F-a', ['backend/pkg/a.py']), + feature('F-b', ['backend/pkg/b.py']), + ]); + const read: Reader = (p) => + p === 'backend/pkg/a.py' ? 'from pkg.b import x\n' : null; + + const result = inferDependsOn(spec, read); + + expect(result.edges).toContainEqual({ + from: 'F-a', + to: 'F-b', + via: 'backend/pkg/a.py', + }); + expect(result.suggestions['F-a']).toContain('F-b'); + }); + + test('emits no edge for stdlib/third-party/unowned imports', () => { + const spec = makeSpec([feature('F-a', ['backend/pkg/a.py'])]); + const read: Reader = (p) => + p === 'backend/pkg/a.py' + ? 'import os\nfrom collections import OrderedDict\nfrom unowned.thing import z\n' + : null; + + const result = inferDependsOn(spec, read); + + expect(result.edges).toEqual([]); + }); + + test('never emits a self-edge when a feature imports its own module', () => { + const spec = makeSpec([ + feature('F-a', ['backend/pkg/a.py', 'backend/pkg/util.py']), + ]); + const read: Reader = (p) => + p === 'backend/pkg/a.py' ? 'from pkg.util import h\n' : null; + + const result = inferDependsOn(spec, read); + + // owner of util.py is F-a itself => no edge, no self-edge. + expect(result.edges.some((e) => e.from === e.to)).toBe(false); + expect(result.edges).toEqual([]); + }); + + test('skips imports of modules owned by multiple features by default', () => { + const spec = makeSpec([ + feature('F-a', ['backend/pkg/a.py']), + feature('F-b', ['backend/pkg/shared.py']), + feature('F-c', ['backend/pkg/shared.py']), + ]); + const read: Reader = (p) => + p === 'backend/pkg/a.py' ? 'from pkg.shared import s\n' : null; + + // Default maxOwnerAmbiguity (1): shared.py has 2 owners => ambiguous => skipped. + const result = inferDependsOn(spec, read); + expect(result.edges.filter((e) => e.from === 'F-a')).toEqual([]); + + // With maxOwnerAmbiguity 2: owners.size 2 <= 2 => allowed => both edges appear. + const result2 = inferDependsOn(spec, read, {maxOwnerAmbiguity: 2}); + expect(result2.edges).toContainEqual({ + from: 'F-a', + to: 'F-b', + via: 'backend/pkg/a.py', + }); + expect(result2.edges).toContainEqual({ + from: 'F-a', + to: 'F-c', + via: 'backend/pkg/a.py', + }); + }); + + test('is deterministic for identical spec and file contents', () => { + const spec = makeSpec([ + feature('F-a', ['backend/pkg/a.py']), + feature('F-b', ['backend/pkg/b.py']), + feature('F-c', ['backend/pkg/c.py']), + ]); + const read: Reader = (p) => + p === 'backend/pkg/a.py' + ? 'from pkg.c import y\nfrom pkg.b import x\n' + : null; + + const first = inferDependsOn(spec, read); + const second = inferDependsOn(spec, read); + + expect(JSON.stringify(first.edges)).toBe(JSON.stringify(second.edges)); + }); + + test('separates already-declared edges from new suggestions', () => { + const spec = makeSpec([ + feature('F-a', ['backend/pkg/a.py'], ['F-b']), + feature('F-b', ['backend/pkg/b.py']), + feature('F-c', ['backend/pkg/c.py']), + ]); + const read: Reader = (p) => + p === 'backend/pkg/a.py' + ? 'from pkg.b import x\nfrom pkg.c import y\n' + : null; + + const result = inferDependsOn(spec, read); + + // F-a->F-b is already declared in depends_on. + expect(result.alreadyDeclared).toContainEqual({ + from: 'F-a', + to: 'F-b', + via: 'backend/pkg/a.py', + }); + expect(result.edges).not.toContainEqual({ + from: 'F-a', + to: 'F-b', + via: 'backend/pkg/a.py', + }); + expect(result.suggestions['F-a']).not.toContain('F-b'); + + // F-a->F-c is NOT declared => a new edge + suggestion. + expect(result.edges).toContainEqual({ + from: 'F-a', + to: 'F-c', + via: 'backend/pkg/a.py', + }); + expect(result.suggestions['F-a']).toContain('F-c'); + }); +}); diff --git a/tests/optimizer/iterative-slice.test.ts b/tests/optimizer/iterative-slice.test.ts new file mode 100644 index 00000000..7a55bb42 --- /dev/null +++ b/tests/optimizer/iterative-slice.test.ts @@ -0,0 +1,149 @@ +import {describe, test, expect} from 'vitest'; +import {buildIterativeImpactSlice} from '../../src/optimizer/iterative-slice.js'; +import type {Spec} from '../../src/spec/types.js'; + +// --- synthetic spec builders (spec-only; no implementation knowledge) --- + +function feature(id: string, dependsOn: string[], acNum: number): unknown { + const num = String(acNum).padStart(6, '0'); + return { + id, + slug: id.toLowerCase().replace(/[^a-z0-9]/g, ''), + title: id, + status: 'done', + depends_on: dependsOn, + modules: [`src/${id}.ts`], + acceptance_criteria: [ + { + id: `AC-${num}`, + ears: 'ubiquitous', + text: 't', + test_refs: [`tests/${id}.test.ts#x`], + }, + ], + }; +} + +function makeSpec(features: unknown[]): Spec { + return { + schema: '0.1', + project: {name: 't', language: 'typescript'}, + features, + } as unknown as Spec; +} + +// Chain: A <- B <- C (B depends_on A; C depends_on B) +function chainSpec(): Spec { + return makeSpec([ + feature('F-A', [], 1), + feature('F-B', ['F-A'], 2), + feature('F-C', ['F-B'], 3), + ]); +} + +// A <- B only (B depends_on A; nothing beyond) +function singleDependentSpec(): Spec { + return makeSpec([feature('F-A', [], 1), feature('F-B', ['F-A'], 2)]); +} + +const ALLOWED_STOPS = [ + 'exhaustion', + 'coverage', + 'marginal-yield', + 'max-depth', +] as const; + +describe('buildIterativeImpactSlice', () => { + test('widens a narrow miss: a 2-hop dependent chain reaches depth 2', () => { + const result = buildIterativeImpactSlice(chainSpec(), 'F-A'); + + expect('not_found' in result).toBe(false); + if ('not_found' in result) throw new Error('expected a slice, got a miss'); + + expect(result.depthUsed).toBeGreaterThanOrEqual(2); + + const ids = result.slice.impacted.map((i) => i.id).sort(); + expect(result.slice.impacted).toHaveLength(2); + expect(ids).toContain('F-B'); + expect(ids).toContain('F-C'); + }); + + test('stops at depth 1 when the radius is already complete', () => { + const result = buildIterativeImpactSlice(singleDependentSpec(), 'F-A'); + + expect('not_found' in result).toBe(false); + if ('not_found' in result) throw new Error('expected a slice, got a miss'); + + expect(result.depthUsed).toBe(1); + expect(result.stoppedBy).toBe('coverage'); + expect(result.analysis.coverage).toBe(1); + }); + + test('stops on exhaustion when the reachable graph boundary is hit', () => { + const result = buildIterativeImpactSlice(chainSpec(), 'F-A', { + coverageThreshold: 1.1, + }); + + expect('not_found' in result).toBe(false); + if ('not_found' in result) throw new Error('expected a slice, got a miss'); + + expect(result.stoppedBy).toBe('exhaustion'); + expect(result.analysis.frontierExhausted).toBe(true); + // depthUsed is the depth where the 0-add ring occurred: depth 3. + expect(result.depthUsed).toBe(3); + }); + + test('reports depthUsed, stoppedBy, and coverage', () => { + const result = buildIterativeImpactSlice(chainSpec(), 'F-A'); + + expect('not_found' in result).toBe(false); + if ('not_found' in result) throw new Error('expected a slice, got a miss'); + + expect(typeof result.depthUsed).toBe('number'); + expect(ALLOWED_STOPS).toContain(result.stoppedBy); + expect(result.analysis.coverage).toBeGreaterThanOrEqual(0); + expect(result.analysis.coverage).toBeLessThanOrEqual(1); + expect(typeof result.analysis.totalKnownDependents).toBe('number'); + expect(result.analysis.totalKnownDependents).toBeGreaterThanOrEqual(0); + }); + + test('is deterministic for identical spec state', () => { + const opts = {coverageThreshold: 0.9} as const; + const a = buildIterativeImpactSlice(chainSpec(), 'F-A', opts); + const b = buildIterativeImpactSlice(chainSpec(), 'F-A', opts); + expect(JSON.stringify(a)).toBe(JSON.stringify(b)); + }); + + test('a coverage or exhaustion stop never reports coverage below the threshold', () => { + const cases: {spec: Spec; query: string; threshold: number; opts?: {coverageThreshold?: number}}[] = [ + {spec: chainSpec(), query: 'F-A', threshold: 0.9}, + {spec: singleDependentSpec(), query: 'F-A', threshold: 0.9}, + {spec: chainSpec(), query: 'F-A', threshold: 1.1, opts: {coverageThreshold: 1.1}}, + ]; + + for (const c of cases) { + const result = buildIterativeImpactSlice(c.spec, c.query, c.opts); + expect('not_found' in result).toBe(false); + if ('not_found' in result) throw new Error('expected a slice, got a miss'); + + if (result.stoppedBy === 'coverage') { + // No false completeness: a coverage stop must actually meet the bar. + expect(result.analysis.coverage).toBeGreaterThanOrEqual(c.threshold); + } + if (result.stoppedBy === 'exhaustion') { + expect(result.analysis.frontierExhausted).toBe(true); + } + } + }); + + test('an unresolved query returns the canonical not_found miss', () => { + const result = buildIterativeImpactSlice(chainSpec(), 'F-nope'); + + expect('not_found' in result).toBe(true); + if (!('not_found' in result)) throw new Error('expected a miss, got a slice'); + + expect(result.not_found).toBe('F-nope'); + expect(Array.isArray(result.accepted_forms)).toBe(true); + expect(typeof result.discovery).toBe('string'); + }); +}); diff --git a/tests/optimizer/measurement.test.ts b/tests/optimizer/measurement.test.ts new file mode 100644 index 00000000..045356a3 --- /dev/null +++ b/tests/optimizer/measurement.test.ts @@ -0,0 +1,118 @@ +import {describe, test, expect} from 'vitest'; +import {measureGraphEfficiency} from '../../src/optimizer/measurement.js'; +import type {Spec} from '../../src/spec/types.js'; + +// Synthetic spec builders. The Spec type carries far more than these tests +// exercise, so we assemble the minimal shape the contract describes and widen +// through `unknown` rather than reaching for `any`. +function feat( + id: string, + slug: string, + modules: string[], + dependsOn: string[] = [], +): Record { + return { + id, + slug, + title: slug.toUpperCase(), + status: 'done', + modules, + depends_on: dependsOn, + acceptance_criteria: [], + }; +} + +function spec(features: Record[]): Spec { + return { + schema: '0.1', + project: {name: 't', language: 'python'}, + features, + } as unknown as Spec; +} + +describe('measureGraphEfficiency', () => { + test('computes the slice-vs-naive context ratio per feature', () => { + const s = spec([feat('F-aaa111', 'a', ['pkg/a.py'])]); + const read = (p: string): string | null => + p === 'pkg/a.py' ? 'x'.repeat(8000) : null; + + const result = measureGraphEfficiency(s, read); + + expect(result.features).toHaveLength(1); + const row = result.features[0]; + if (row === undefined) { + throw new Error('expected a measured feature row'); + } + // A large module source makes the naive baseline (shard JSON + full module + // text) much bigger than the working-set slice. + expect(row.naiveTokens).toBeGreaterThan(row.sliceTokens); + expect(row.contextRatio).toBeLessThan(1); + expect(row.contextRatio).toBeCloseTo(row.sliceTokens / row.naiveTokens, 5); + }); + + test('aggregates median shrink factor, search depth, and coverage', () => { + const features = [ + feat('F-aaa111', 'a', ['pkg/a.py']), + feat('F-bbb222', 'b', ['pkg/b.py'], ['F-aaa111']), + feat('F-ccc333', 'c', ['pkg/c.py'], ['F-bbb222']), + ]; + const s = spec(features); + const source: Record = { + 'pkg/a.py': 'x'.repeat(8000), + 'pkg/b.py': 'y'.repeat(9000), + 'pkg/c.py': 'z'.repeat(7000), + }; + const read = (p: string): string | null => source[p] ?? null; + + const result = measureGraphEfficiency(s, read); + + expect(result.measured).toBe(features.length); + // Bigger naive source than slice ⇒ shrink factor > 1. + expect(result.context.medianShrinkFactor).toBeGreaterThan(1); + expect(typeof result.search.medianDepth).toBe('number'); + expect(result.search.medianDepth).toBeGreaterThanOrEqual(1); + expect(result.stability.medianCoverage).toBeGreaterThanOrEqual(0); + expect(result.stability.medianCoverage).toBeLessThanOrEqual(1); + expect(typeof result.stability.byStopReason).toBe('object'); + + const stopReasonSum = Object.values(result.stability.byStopReason).reduce( + (a, b) => a + b, + 0, + ); + expect(stopReasonSum).toBeLessThanOrEqual(result.measured); + }); + + test('is deterministic for identical spec and file contents', () => { + const features = [ + feat('F-aaa111', 'a', ['pkg/a.py']), + feat('F-bbb222', 'b', ['pkg/b.py'], ['F-aaa111']), + ]; + const s = spec(features); + const source: Record = { + 'pkg/a.py': 'x'.repeat(5000), + 'pkg/b.py': 'y'.repeat(6000), + }; + const read = (p: string): string | null => source[p] ?? null; + + const first = measureGraphEfficiency(s, read); + const second = measureGraphEfficiency(s, read); + + expect(JSON.stringify(first)).toBe(JSON.stringify(second)); + }); + + test('skips lookup misses without throwing', () => { + const nullRead = (): string | null => null; + + const empty = spec([]); + const emptyResult = measureGraphEfficiency(empty, nullRead); + expect(emptyResult.measured).toBe(0); + expect(emptyResult.features).toEqual([]); + + // A real feature with no modules and a reader that always misses must be + // handled gracefully — the feature is still resolvable. + const noModules = spec([feat('F-ddd444', 'd', [])]); + expect(() => measureGraphEfficiency(noModules, nullRead)).not.toThrow(); + const noModResult = measureGraphEfficiency(noModules, nullRead); + expect(noModResult.measured).toBe(1); + }); +}); diff --git a/tests/optimizer/reverse-slice.test.ts b/tests/optimizer/reverse-slice.test.ts new file mode 100644 index 00000000..5ebae253 --- /dev/null +++ b/tests/optimizer/reverse-slice.test.ts @@ -0,0 +1,172 @@ +import {describe, test, expect} from 'vitest'; +import {buildImpactSlice, collectDependents} from '../../src/optimizer/reverse-slice.js'; +import type {Spec} from '../../src/spec/types.js'; + +type Feature = { + id: string; + title: string; + status: 'done'; + depends_on?: string[]; + modules?: string[]; + acceptance_criteria?: {id: string; test_refs?: string[]}[]; +}; + +type Scenario = { + id: string; + title: string; + features?: string[]; +}; + +function mkSpec(features: Feature[], scenarios: Scenario[] = []): Spec { + return { + schema: '0.1', + project: {name: 'x', language: 'typescript'}, + features, + scenarios, + } as unknown as Spec; +} + +describe('reverse-slice / impact (F-7794a6bc)', () => { + test('feature query returns focus, transitive dependents, scenarios, test_refs union, impacted modules', () => { + const spec = mkSpec( + [ + { + id: 'A', + title: 'A', + status: 'done', + modules: ['src/a.ts'], + acceptance_criteria: [{id: 'A-1', test_refs: ['tests/a.test.ts#x']}], + }, + { + id: 'B', + title: 'B', + status: 'done', + depends_on: ['A'], + modules: ['src/b.ts'], + acceptance_criteria: [{id: 'B-1', test_refs: ['tests/b.test.ts#y']}], + }, + { + id: 'C', + title: 'C', + status: 'done', + depends_on: ['B'], + modules: ['src/c.ts'], + acceptance_criteria: [{id: 'C-1', test_refs: ['tests/c.test.ts#z']}], + }, + { + id: 'D', + title: 'D', + status: 'done', + modules: ['src/d.ts'], + }, + ], + [ + {id: 'S1', title: 'S1', features: ['B']}, + {id: 'S2', title: 'S2', features: ['D']}, + ], + ); + + const r = buildImpactSlice(spec, 'A'); + expect('not_found' in r).toBe(false); + if ('not_found' in r) throw new Error('unexpected miss'); + + expect(r.focus.id).toBe('A'); + expect(r.impacted.map((i) => i.id)).toEqual(['B', 'C']); + expect(r.impacted_modules).toEqual(['src/a.ts', 'src/b.ts', 'src/c.ts']); + expect(r.scenarios.map((s) => s.id)).toEqual(['S1']); + expect(r.test_refs).toEqual([ + 'tests/a.test.ts#x', + 'tests/b.test.ts#y', + 'tests/c.test.ts#z', + ]); + }); + + test('module path query resolves all owners (many-to-many) and computes blast radius', () => { + const spec = mkSpec([ + {id: 'F1', title: 'F1', status: 'done', modules: ['src/shared.ts']}, + {id: 'F2', title: 'F2', status: 'done', modules: ['src/shared.ts']}, + {id: 'G', title: 'G', status: 'done', depends_on: ['F1']}, + ]); + + const r = buildImpactSlice(spec, 'src/shared.ts'); + expect('not_found' in r).toBe(false); + if ('not_found' in r) throw new Error('unexpected miss'); + + expect(r.focus.module).toBe('src/shared.ts'); + expect(r.focus.owners).toEqual(['F1', 'F2']); + expect(r.impacted.map((i) => i.id)).toEqual(['G']); + }); + + test('a miss returns not_found naming the accepted forms', () => { + const r = buildImpactSlice(mkSpec([{id: 'A', title: 'A', status: 'done'}]), 'nope'); + expect('not_found' in r).toBe(true); + const miss = r as {not_found: string; accepted_forms: readonly string[]}; + expect(miss.not_found).toBe('nope'); + const forms = miss.accepted_forms; + expect(Array.isArray(forms)).toBe(true); + expect(forms.length).toBeGreaterThan(0); + const joined = forms.join(' '); + expect(joined).toContain('slug'); + expect(joined).toContain('module'); + }); + + test('depth bounds the dependent walk and output is deterministic', () => { + const deps = new Map>([ + ['A', new Set(['B'])], + ['B', new Set(['C'])], + ['C', new Set(['D'])], + ]); + + expect([...collectDependents(['A'], deps, 1)].sort()).toEqual(['B']); + expect([...collectDependents(['A'], deps, 2)].sort()).toEqual(['B', 'C']); + expect([...collectDependents(['A'], deps)].sort()).toEqual(['B', 'C', 'D']); + expect(collectDependents(['A'], deps).has('A')).toBe(false); + + const spec = mkSpec( + [ + { + id: 'A', + title: 'A', + status: 'done', + modules: ['src/a.ts'], + acceptance_criteria: [{id: 'A-1', test_refs: ['tests/a.test.ts#x']}], + }, + { + id: 'B', + title: 'B', + status: 'done', + depends_on: ['A'], + modules: ['src/b.ts'], + acceptance_criteria: [{id: 'B-1', test_refs: ['tests/b.test.ts#y']}], + }, + { + id: 'C', + title: 'C', + status: 'done', + depends_on: ['B'], + modules: ['src/c.ts'], + acceptance_criteria: [{id: 'C-1', test_refs: ['tests/c.test.ts#z']}], + }, + { + id: 'D', + title: 'D', + status: 'done', + modules: ['src/d.ts'], + }, + ], + [ + {id: 'S1', title: 'S1', features: ['B']}, + {id: 'S2', title: 'S2', features: ['D']}, + ], + ); + + expect(JSON.stringify(buildImpactSlice(spec, 'A'))).toBe( + JSON.stringify(buildImpactSlice(spec, 'A')), + ); + + const bounded = buildImpactSlice(spec, 'A', {depth: 1}); + expect('not_found' in bounded).toBe(false); + if ('not_found' in bounded) throw new Error('unexpected miss'); + expect(bounded.impacted.map((i) => i.id)).toEqual(['B']); + }); +}); diff --git a/tests/optimizer/working-set.test.ts b/tests/optimizer/working-set.test.ts new file mode 100644 index 00000000..16772244 --- /dev/null +++ b/tests/optimizer/working-set.test.ts @@ -0,0 +1,291 @@ +import {describe, test, expect, afterEach} from 'vitest'; +import {mkdtempSync, writeFileSync, rmSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; +import {buildWorkingSet} from '../../src/optimizer/working-set.js'; +import type {Spec} from '../../src/spec/types.js'; + +const tmpDirs: string[] = []; + +function makeTmp(): string { + const dir = mkdtempSync(join(tmpdir(), 'clad-ws-')); + tmpDirs.push(dir); + return dir; +} + +afterEach(() => { + while (tmpDirs.length > 0) { + const dir = tmpDirs.pop(); + if (dir) rmSync(dir, {recursive: true, force: true}); + } +}); + +interface ACSeed { + id: string; + ears?: string; + text?: string; + test_refs?: string[]; + oracle_refs?: string[]; +} + +interface FeatureSeed { + id: string; + slug: string; + title: string; + status?: string; + modules?: string[]; + depends_on?: string[]; + acceptance_criteria?: ACSeed[]; +} + +function ac(seed: ACSeed): ACSeed { + return { + id: seed.id, + ears: seed.ears ?? 'ubiquitous', + text: seed.text ?? 't', + test_refs: seed.test_refs ?? [], + oracle_refs: seed.oracle_refs ?? [], + }; +} + +function feature(seed: FeatureSeed): FeatureSeed { + return { + id: seed.id, + slug: seed.slug, + title: seed.title, + status: seed.status ?? 'done', + modules: seed.modules ?? [], + depends_on: seed.depends_on ?? [], + acceptance_criteria: seed.acceptance_criteria ?? [ + ac({id: 'AC-001', ears: 'unwanted', text: 't', test_refs: ['tests/x.test.ts#a'], oracle_refs: ['o1']}), + ], + }; +} + +function makeSpec(features: FeatureSeed[], scenarios?: {id: string; title: string; features: string[]}[]): Spec { + return { + project: { + name: 't', + language: 'typescript', + ai_hints: { + preferred_patterns: [{when: 'w', prefer: 'p', over: 'o'}], + }, + }, + features, + scenarios: scenarios ?? [{id: 'S-1', title: 's', features: [features[0]?.id ?? 'F-aaa111']}], + } as unknown as Spec; +} + +interface MinimalRef { + id: string; + title: string; + status?: string; +} + +interface WorkingSetShape { + must_edit: { + id: string; + title: string; + status: string; + modules: string[]; + acceptance_criteria: ACSeed[]; + code: {path: string; text?: string; truncated?: boolean; omitted?: string; bytes?: number}[]; + co_owners?: string[]; + }; + needs: MinimalRef[]; + breaks_if_changed: {impacted: MinimalRef[]; regression_tests: string[]}; + verify: { + scenarios: {id: string; title: string}[]; + test_refs: string[]; + oracle_refs: string[]; + high_risk_acs: {id: string; ears: string}[]; + }; + guidance: {preferred_patterns: {when: string; prefer: string; over?: string}[]}; + budget: {max_tokens: number; used_tokens: number; truncated: string[]}; +} + +interface MissShape { + not_found: string; + accepted_forms: string[]; + discovery: string; +} + +function isMiss(r: WorkingSetShape | MissShape): r is MissShape { + return Object.prototype.hasOwnProperty.call(r, 'not_found'); +} + +describe('working-set', () => { + test('resolves id, slug, and module path (multi-owner picks first + lists co-owners)', () => { + const spec = makeSpec([ + feature({id: 'F-bbb222', slug: 'beta', title: 'Beta', modules: ['src/shared.ts']}), + feature({id: 'F-aaa111', slug: 'alpha', title: 'Alpha', modules: ['src/shared.ts']}), + ]); + + const byModule = buildWorkingSet(spec, 'src/shared.ts') as WorkingSetShape | MissShape; + expect(isMiss(byModule)).toBe(false); + if (isMiss(byModule)) throw new Error('expected a working set'); + expect(byModule.must_edit.id).toBe('F-aaa111'); + expect(byModule.must_edit.co_owners).toBeDefined(); + expect(byModule.must_edit.co_owners).toContain('F-aaa111'); + expect(byModule.must_edit.co_owners).toContain('F-bbb222'); + // sorted + const co = byModule.must_edit.co_owners ?? []; + expect([...co].sort()).toEqual(co); + + const byId = buildWorkingSet(spec, 'F-aaa111') as WorkingSetShape | MissShape; + expect(isMiss(byId)).toBe(false); + if (isMiss(byId)) throw new Error('expected a working set'); + expect(byId.must_edit.id).toBe('F-aaa111'); + + const bySlug = buildWorkingSet(spec, 'alpha') as WorkingSetShape | MissShape; + expect(isMiss(bySlug)).toBe(false); + if (isMiss(bySlug)) throw new Error('expected a working set'); + expect(bySlug.must_edit.id).toBe('F-aaa111'); + }); + + test('unknown query returns a not_found miss', () => { + const spec = makeSpec([feature({id: 'F-aaa111', slug: 'alpha', title: 'Alpha'})]); + const r = buildWorkingSet(spec, 'F-nope') as WorkingSetShape | MissShape; + expect(isMiss(r)).toBe(true); + if (!isMiss(r)) throw new Error('expected a miss'); + expect(r.not_found).toBe('F-nope'); + expect(Array.isArray(r.accepted_forms)).toBe(true); + expect(r.accepted_forms.length).toBeGreaterThan(0); + expect(typeof r.discovery).toBe('string'); + }); + + test('fuses forward needs + backward breaks + verify + guidance into one payload', () => { + const spec = makeSpec([ + feature({id: 'F-base', slug: 'base', title: 'Base', depends_on: []}), + feature({ + id: 'F-mid', + slug: 'mid', + title: 'Mid', + depends_on: ['F-base'], + acceptance_criteria: [ + ac({id: 'AC-001', ears: 'unwanted', test_refs: ['tests/b.test.ts#z', 'tests/a.test.ts#x']}), + ac({id: 'AC-002', ears: 'event', test_refs: ['tests/a.test.ts#x', 'tests/c.test.ts#y']}), + ], + }), + feature({id: 'F-top', slug: 'top', title: 'Top', depends_on: ['F-mid']}), + ]); + + const r = buildWorkingSet(spec, 'F-mid') as WorkingSetShape | MissShape; + expect(isMiss(r)).toBe(false); + if (isMiss(r)) throw new Error('expected a working set'); + + // forward ancestor + expect(r.needs.map((n) => n.id)).toContain('F-base'); + + // backward direct dependent + expect(r.breaks_if_changed.impacted.map((i) => i.id)).toContain('F-top'); + + // guidance seeded pattern + expect(r.guidance.preferred_patterns).toEqual([{when: 'w', prefer: 'p', over: 'o'}]); + + // verify.test_refs = union deduped + sorted + const expectedRefs = ['tests/a.test.ts#x', 'tests/b.test.ts#z', 'tests/c.test.ts#y']; + expect(r.verify.test_refs).toEqual(expectedRefs); + + // all sections present + expect(r.must_edit).toBeDefined(); + expect(r.needs).toBeDefined(); + expect(r.breaks_if_changed).toBeDefined(); + expect(r.verify).toBeDefined(); + expect(r.guidance).toBeDefined(); + expect(r.budget).toBeDefined(); + expect(Array.isArray(r.verify.scenarios)).toBe(true); + expect(Array.isArray(r.verify.oracle_refs)).toBe(true); + expect(Array.isArray(r.verify.high_risk_acs)).toBe(true); + expect(Array.isArray(r.breaks_if_changed.regression_tests)).toBe(true); + }); + + test('flags EARS unwanted/state acceptance criteria as high-risk', () => { + const spec = makeSpec([ + feature({ + id: 'F-aaa111', + slug: 'alpha', + title: 'Alpha', + acceptance_criteria: [ + ac({id: 'AC-001', ears: 'unwanted'}), + ac({id: 'AC-002', ears: 'state'}), + ac({id: 'AC-003', ears: 'ubiquitous'}), + ], + }), + ]); + + const r = buildWorkingSet(spec, 'F-aaa111') as WorkingSetShape | MissShape; + expect(isMiss(r)).toBe(false); + if (isMiss(r)) throw new Error('expected a working set'); + + const ids = r.verify.high_risk_acs.map((a) => a.id).sort(); + expect(ids).toEqual(['AC-001', 'AC-002']); + for (const entry of r.verify.high_risk_acs) { + expect(typeof entry.id).toBe('string'); + expect(typeof entry.ears).toBe('string'); + } + // ubiquitous not flagged + expect(r.verify.high_risk_acs.map((a) => a.id)).not.toContain('AC-003'); + }); + + test('enforces the token budget and records what was truncated', () => { + // Large structural payload: 20 ancestor deps on the focus feature. + const ancestors: FeatureSeed[] = []; + const depIds: string[] = []; + for (let i = 0; i < 20; i++) { + const id = `F-d${String(i).padStart(2, '0')}`; + depIds.push(id); + ancestors.push( + feature({ + id, + slug: `dep${i}`, + title: `Dependency number ${i} with a reasonably long descriptive title to add weight`, + depends_on: [], + }), + ); + } + const focus = feature({id: 'F-focus', slug: 'focus', title: 'Focus', depends_on: depIds}); + const bigSpec = makeSpec([focus, ...ancestors]); + + const tight = buildWorkingSet(bigSpec, 'F-focus', {maxTokens: 600}) as WorkingSetShape | MissShape; + expect(isMiss(tight)).toBe(false); + if (isMiss(tight)) throw new Error('expected a working set'); + expect(tight.budget.max_tokens).toBe(600); + expect(Array.isArray(tight.budget.truncated)).toBe(true); + expect(tight.budget.truncated.length).toBeGreaterThan(0); + expect(tight.needs.length).toBeLessThan(depIds.length); + // focus is always retained + expect(tight.must_edit.id).toBe('F-focus'); + + // Generous budget on a small feature -> nothing truncated, all ancestors present. + const smallSpec = makeSpec([ + feature({id: 'F-base', slug: 'base', title: 'Base', depends_on: []}), + feature({id: 'F-leaf', slug: 'leaf', title: 'Leaf', depends_on: ['F-base']}), + ]); + const loose = buildWorkingSet(smallSpec, 'F-leaf', {maxTokens: 100000}) as WorkingSetShape | MissShape; + expect(isMiss(loose)).toBe(false); + if (isMiss(loose)) throw new Error('expected a working set'); + expect(loose.budget.max_tokens).toBe(100000); + expect(loose.budget.truncated).toEqual([]); + expect(loose.needs.map((n) => n.id)).toContain('F-base'); + }); + + test('is deterministic for identical spec + files', () => { + const dir = makeTmp(); + writeFileSync(join(dir, 'mod.ts'), 'export const v = 1;\n', 'utf8'); + const spec = makeSpec([ + feature({id: 'F-base', slug: 'base', title: 'Base', depends_on: []}), + feature({ + id: 'F-aaa111', + slug: 'alpha', + title: 'Alpha', + modules: ['mod.ts'], + depends_on: ['F-base'], + }), + ]); + + const a = buildWorkingSet(spec, 'F-aaa111', {cwd: dir, maxTokens: 100000}); + const b = buildWorkingSet(spec, 'F-aaa111', {cwd: dir, maxTokens: 100000}); + expect(JSON.stringify(a)).toBe(JSON.stringify(b)); + }); +}); diff --git a/tests/scenarios/_size-budgets.ts b/tests/scenarios/_size-budgets.ts index a5cc6c16..c561bcc3 100644 --- a/tests/scenarios/_size-budgets.ts +++ b/tests/scenarios/_size-budgets.ts @@ -38,8 +38,8 @@ function budget(maxLines: number, maxChars: number): SizeBudget { /** Persona system-prompt budgets (canonical sources under `src/agents/`). */ export const PERSONA_BUDGETS = { 'src/agents/orchestrator.md': budget(107, 8000), // baseline 96/7153 — v0.4.x reshaped recipe→feature-cycle + mode gloss (F-3b3690) - 'src/agents/planner.md': budget(75, 4500), // baseline 68/4149 — v0.3.59 added Project policy section (F-0ed2db); renamed from librarian (0.6.0) - 'src/agents/developer.md': budget(80, 4600), // baseline 76/4246 — v0.5.x honest anti-self-cert: advisory blindness vs enforced identity layer + interface-stub (F-3b3690); renamed from specialists (0.6.0) + 'src/agents/planner.md': budget(82, 5200), // 73/4794 — F-d6b93648 added a graph-context-tools advisory note (was 68/4149) + 'src/agents/developer.md': budget(92, 5400), // 85/4999 — F-d6b93648 added the graph-context-tools (clad_get_working_set/impact) advisory section (was 76/4246) 'src/agents/blind-author.md': budget(45, 2600), // 0.6.0 (F-d8223c) — structural anti-self-cert: tool-restricted, contract-only body 'src/agents/reviewer.md': budget(85, 4900), // baseline 81/4533 — v0.5.x reviewer owns the advisory blindness audit no gate enforces (F-3b3690) 'src/agents/observability.md': budget(60, 3500), // baseline 50/3115 — v0.3.59 added Project policy section (F-0ed2db) diff --git a/tests/serve/server.test.ts b/tests/serve/server.test.ts index 20a66cae..9bd0a614 100644 --- a/tests/serve/server.test.ts +++ b/tests/serve/server.test.ts @@ -654,3 +654,131 @@ describe('clad_get_context (F-d2c806)', () => { } }); }); + +// ─── F-7794a6bc — clad_get_impact (blast radius) over MCP ─── + +const IMPACT_SPEC = `schema: "0.1" +project: + name: probe + language: typescript +features: + - id: F-001 + slug: core-thing + title: core + status: done + modules: [src/core.ts] + acceptance_criteria: + - id: AC-001 + ears: ubiquitous + text: core AC + test_refs: ["tests/core.test.ts#core works"] + - id: F-002 + slug: dependent-thing + title: dependent + status: done + depends_on: [F-001] + modules: [src/dependent.ts] + acceptance_criteria: + - id: AC-002 + ears: ubiquitous + text: dependent AC + test_refs: ["tests/dependent.test.ts#dependent works"] +`; + +describe('clad_get_impact (F-7794a6bc)', () => { + test('clad_get_impact returns the blast-radius slice; a miss is isError', async () => { + const dir = mkdtempSync(join(tmpdir(), 'clad-serve-impact-')); + writeFileSync(join(dir, 'spec.yaml'), IMPACT_SPEC); + mkdirSync(join(dir, '.cladding'), {recursive: true}); + const {client, cleanup} = await makePair(dir); + try { + const {tools} = await client.listTools(); + expect(tools.map((t) => t.name)).toContain('clad_get_impact'); + + // Changing F-001 should surface F-002 (its dependent) + the regression tests. + const hit = await client.callTool({name: 'clad_get_impact', arguments: {query: 'F-001'}}); + expect(hit.isError).toBeFalsy(); + const slice = JSON.parse((hit.content as Array<{type: string; text: string}>)[0].text) as { + schema_version: number; + focus: {id?: string}; + impacted: Array<{id: string}>; + test_refs: string[]; + }; + expect(slice.schema_version).toBe(1); + expect(slice.focus.id).toBe('F-001'); + expect(slice.impacted.map((i) => i.id)).toContain('F-002'); + expect(slice.test_refs).toContain('tests/dependent.test.ts#dependent works'); + + // A module path fans out to its owners' radius too. + const byModule = await client.callTool({name: 'clad_get_impact', arguments: {query: 'src/core.ts'}}); + expect(byModule.isError).toBeFalsy(); + const mslice = JSON.parse((byModule.content as Array<{type: string; text: string}>)[0].text) as { + focus: {module?: string; owners?: string[]}; + impacted: Array<{id: string}>; + }; + expect(mslice.focus.module).toBe('src/core.ts'); + expect(mslice.focus.owners).toContain('F-001'); + expect(mslice.impacted.map((i) => i.id)).toContain('F-002'); + + const miss = await client.callTool({name: 'clad_get_impact', arguments: {query: 'nope'}}); + expect(miss.isError).toBe(true); + const parsed = JSON.parse((miss.content as Array<{type: string; text: string}>)[0].text) as { + schema_version: number; + not_found: string; + }; + expect(parsed.schema_version).toBe(1); + expect(parsed.not_found).toBe('nope'); + } finally { + await cleanup(); + rmSync(dir, {recursive: true, force: true}); + } + }); +}); + +// ─── F-64a5c159 — clad_get_graph (live knowledge graph) over MCP ─── + +describe('clad_get_graph (F-64a5c159)', () => { + test('clad_get_graph returns the live graph; a focus miss is isError', async () => { + const dir = mkdtempSync(join(tmpdir(), 'clad-serve-graph-')); + writeFileSync(join(dir, 'spec.yaml'), IMPACT_SPEC); + mkdirSync(join(dir, '.cladding'), {recursive: true}); + const {client, cleanup} = await makePair(dir); + try { + const {tools} = await client.listTools(); + expect(tools.map((t) => t.name)).toContain('clad_get_graph'); + + const all = await client.callTool({name: 'clad_get_graph', arguments: {}}); + expect(all.isError).toBeFalsy(); + const graph = JSON.parse((all.content as Array<{type: string; text: string}>)[0].text) as { + schema_version: number; + nodes: Array<{id: string}>; + edges: unknown[]; + }; + expect(graph.schema_version).toBe(1); + expect(graph.nodes.some((n) => n.id === 'feature:F-001')).toBe(true); + expect(graph.edges.length).toBeGreaterThan(0); + + const focused = await client.callTool({name: 'clad_get_graph', arguments: {query: 'F-001', max_depth: 1}}); + expect(focused.isError).toBeFalsy(); + const sub = JSON.parse((focused.content as Array<{type: string; text: string}>)[0].text) as { + nodes: Array<{id: string}>; + }; + expect(sub.nodes.some((n) => n.id === 'feature:F-001')).toBe(true); + + const gmiss = await client.callTool({name: 'clad_get_graph', arguments: {query: 'nope'}}); + expect(gmiss.isError).toBe(true); + const gparsed = JSON.parse((gmiss.content as Array<{type: string; text: string}>)[0].text) as {not_found: string}; + expect(gparsed.not_found).toBe('nope'); + } finally { + await cleanup(); + rmSync(dir, {recursive: true, force: true}); + } + }); +}); + +describe('clad_get_working_set (F-06dfdad6)', () => { + test('registers clad_get_working_set without touching clad_get_context', () => { + expect(TOOL_NAMES).toContain('clad_get_working_set'); + expect(TOOL_NAMES).toContain('clad_get_context'); // the existing context tool stays registered + frozen + }); +}); diff --git a/tests/spec/doc-references.test.ts b/tests/spec/doc-references.test.ts new file mode 100644 index 00000000..c5eb804e --- /dev/null +++ b/tests/spec/doc-references.test.ts @@ -0,0 +1,72 @@ +import {extractDocReferences, stripCodeSpans, DOC_LINKS_IGNORE_MARKER} from '../../src/spec/doc-references.js'; +import {mkdtempSync, mkdirSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {dirname, join} from 'node:path'; +import {afterEach, beforeEach, describe, expect, test} from 'vitest'; + +interface DocEntry { + doc: string; + features: readonly string[]; + doc_links: readonly string[]; +} + +describe('doc-references', () => { + let dir: string; + + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-docref-')); + }); + + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + const wdoc = (rel: string, body: string): void => { + const full = join(dir, rel); + mkdirSync(dirname(full), {recursive: true}); + writeFileSync(full, body); + }; + + const byDoc = (s: {docs: readonly DocEntry[]}): Record => + Object.fromEntries(s.docs.map((d) => [d.doc, d])); + + test('extracts F-ids and resolved .md links, excluding fixture dirs and code spans', () => { + wdoc('docs/a.md', 'see F-ee47fc2b and F-7794a6bc here. [link](./b.md). inline `F-cafef00d` ignored.'); + wdoc('docs/b.md', '# b'); + wdoc('docs/ab-evaluation-extended/r.md', 'fixture F-deadbeef'); + + const s = extractDocReferences(dir); + const m = byDoc(s); + + expect(m['docs/a.md'].features).toEqual(['F-7794a6bc', 'F-ee47fc2b']); + expect(m['docs/a.md'].doc_links).toEqual(['docs/b.md']); + expect(m['docs/ab-evaluation-extended/r.md']).toBeUndefined(); + }); + + test('an opted-out doc yields no features but still yields doc_links', () => { + wdoc('docs/c.md', '\nF-ee47fc2b in prose. [x](./b.md)'); + wdoc('docs/b.md', '# b'); + + const m = byDoc(extractDocReferences(dir)); + + expect(m['docs/c.md'].features).toEqual([]); + expect(m['docs/c.md'].doc_links).toEqual(['docs/b.md']); + }); + + test('fixture dirs and code-span ids are excluded', () => { + expect(stripCodeSpans('a `F-aaaaaa` b')).not.toContain('F-aaaaaa'); + expect(stripCodeSpans('x\n```\nF-bbbbbb\n```\ny')).not.toContain('F-bbbbbb'); + + wdoc('docs/dogfood/d.md', 'F-cccccc'); + wdoc('docs/e.md', '```\nF-dddddd\n```\nplain F-ee47fc2b'); + + const m = byDoc(extractDocReferences(dir)); + + expect(m['docs/dogfood/d.md']).toBeUndefined(); + expect(m['docs/e.md'].features).toEqual(['F-ee47fc2b']); + }); + + test('DOC_LINKS_IGNORE_MARKER is the expected sentinel', () => { + expect(DOC_LINKS_IGNORE_MARKER).toBe('clad-doc-links: ignore'); + }); +}); diff --git a/tests/spec/reverse-index.test.ts b/tests/spec/reverse-index.test.ts new file mode 100644 index 00000000..2d2ab960 --- /dev/null +++ b/tests/spec/reverse-index.test.ts @@ -0,0 +1,146 @@ +import {describe, test, expect} from 'vitest'; +import { + buildReverseIndex, + reverseIndexOf, + type ReverseIndex, +} from '../../src/spec/reverse-index.js'; +import type {Spec} from '../../src/spec/types.js'; + +type FixtureFeature = { + id: string; + title: string; + status: 'done'; + depends_on?: string[]; + modules?: string[]; + acceptance_criteria?: {id: string; test_refs?: string[]}[]; +}; + +function mkSpec(features: FixtureFeature[]): Spec { + return { + schema: '0.1', + project: {name: 'x', language: 'typescript'}, + features, + } as unknown as Spec; +} + +describe('reverse-index (F-ee47fc2b)', () => { + test('inverts depends_on into a direct-dependents map', () => { + const spec = mkSpec([ + {id: 'A', title: 'A', status: 'done'}, + {id: 'B', title: 'B', status: 'done', depends_on: ['A']}, + {id: 'C', title: 'C', status: 'done', depends_on: ['A']}, + ]); + + const index: ReverseIndex = buildReverseIndex(spec); + + const depsOfA = index.dependents.get('A'); + expect(depsOfA).toBeDefined(); + expect([...depsOfA!].sort()).toEqual(['B', 'C']); + + // Nothing depends on B. + expect(index.dependents.get('B')).toBeUndefined(); + + // Only DIRECT (one-hop) edges: with a chain C -> B -> A, + // dependents.get('A') must contain B only, NOT C. + const chainSpec = mkSpec([ + {id: 'A', title: 'A', status: 'done'}, + {id: 'B', title: 'B', status: 'done', depends_on: ['A']}, + {id: 'C', title: 'C', status: 'done', depends_on: ['B']}, + ]); + const chainIndex = buildReverseIndex(chainSpec); + + const chainDepsOfA = chainIndex.dependents.get('A'); + expect(chainDepsOfA).toBeDefined(); + expect([...chainDepsOfA!].sort()).toEqual(['B']); + + const chainDepsOfB = chainIndex.dependents.get('B'); + expect(chainDepsOfB).toBeDefined(); + expect([...chainDepsOfB!].sort()).toEqual(['C']); + }); + + test('maps each module path to all owning features (many-to-many)', () => { + const spec = mkSpec([ + { + id: 'F1', + title: 'F1', + status: 'done', + modules: ['src/a.ts', 'src/shared.ts'], + }, + { + id: 'F2', + title: 'F2', + status: 'done', + modules: ['src/shared.ts'], + }, + ]); + + const index = buildReverseIndex(spec); + + const sharedOwners = index.moduleOwners.get('src/shared.ts'); + expect(sharedOwners).toBeDefined(); + expect([...sharedOwners!].sort()).toEqual(['F1', 'F2']); + + const aOwners = index.moduleOwners.get('src/a.ts'); + expect(aOwners).toBeDefined(); + expect([...aOwners!].sort()).toEqual(['F1']); + }); + + test('memoizes per spec instance', () => { + const spec = mkSpec([ + {id: 'A', title: 'A', status: 'done'}, + {id: 'B', title: 'B', status: 'done', depends_on: ['A']}, + ]); + + // Same spec object identity -> SAME reference (memoised). + expect(reverseIndexOf(spec)).toBe(reverseIndexOf(spec)); + + // A DIFFERENT but structurally-equal spec -> DIFFERENT reference. + const otherSpec = mkSpec([ + {id: 'A', title: 'A', status: 'done'}, + {id: 'B', title: 'B', status: 'done', depends_on: ['A']}, + ]); + expect(reverseIndexOf(otherSpec)).not.toBe(reverseIndexOf(spec)); + + // buildReverseIndex is NOT memoised: fresh object every call. + expect(buildReverseIndex(spec)).not.toBe(buildReverseIndex(spec)); + }); + + test('skips prefixed pseudo-refs and strips anchors in test citations', () => { + const spec = mkSpec([ + { + id: 'F', + title: 'F', + status: 'done', + acceptance_criteria: [ + { + id: 'F-ac1', + test_refs: [ + 'tests/x.test.ts#some title', + 'tests/x.test.ts#another title', + 'derived:tests/y.test.ts', + 'fixture:foo', + 'script:build', + ], + }, + ], + }, + ]); + + const index = buildReverseIndex(spec); + + // Anchor stripped; both refs collapse to one key. + const xCitations = index.testRefCitations.get('tests/x.test.ts'); + expect(xCitations).toBeDefined(); + expect([...xCitations!].sort()).toEqual(['F']); + + // derived: pseudo-ref is skipped entirely (not keyed even after strip). + expect(index.testRefCitations.has('tests/y.test.ts')).toBe(false); + expect(index.testRefCitations.has('derived:tests/y.test.ts')).toBe(false); + + // fixture: / script: pseudo-refs skipped (neither prefixed nor bare key). + expect(index.testRefCitations.has('fixture:foo')).toBe(false); + expect(index.testRefCitations.has('foo')).toBe(false); + expect(index.testRefCitations.has('script:build')).toBe(false); + expect(index.testRefCitations.has('build')).toBe(false); + }); +}); diff --git a/tests/stages/detectors/doc-reference-integrity.test.ts b/tests/stages/detectors/doc-reference-integrity.test.ts new file mode 100644 index 00000000..01fba4fe --- /dev/null +++ b/tests/stages/detectors/doc-reference-integrity.test.ts @@ -0,0 +1,73 @@ +import {docReferenceIntegrity} from '../../../src/stages/detectors/doc-reference-integrity.js'; +import {mkdtempSync, mkdirSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {dirname, join} from 'node:path'; +import {afterEach, beforeEach, describe, expect, test} from 'vitest'; + +interface Finding { + detector: string; + severity: 'error' | 'warn'; + message: string; + path?: string; +} + +const SPEC = `schema: "0.1" +project: {name: f, language: typescript} +features: + - id: F-001 + title: f + status: done + acceptance_criteria: + - id: AC-001 + ears: ubiquitous + text: t +`; + +describe('doc-reference-integrity / DOC_LINK_INTEGRITY', () => { + let dir: string; + + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-docintg-')); + }); + + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + const wdoc = (rel: string, body: string): void => { + const full = join(dir, rel); + mkdirSync(dirname(full), {recursive: true}); + writeFileSync(full, body); + }; + + const writeSpec = (): void => { + writeFileSync(join(dir, 'spec.yaml'), SPEC); + }; + + const run = (): Finding[] => + docReferenceIntegrity + .run({cwd: dir}) + .filter((f): f is Finding => f.detector === 'DOC_LINK_INTEGRITY') + .map((f) => ({...f})); + + test('a dead relative .md link is an error', () => { + writeSpec(); + wdoc('docs/b.md', '# b'); + wdoc('docs/a.md', '[gone](./missing.md) [ok](./b.md)'); + + const fs = run(); + + expect(fs.some((f) => f.severity === 'error' && f.message.includes('missing.md'))).toBe(true); + expect(fs.some((f) => f.severity === 'error' && f.message.includes('b.md') && !f.message.includes('missing.md'))).toBe(false); + }); + + test('an unresolved F-id in a normal doc is a warn', () => { + writeSpec(); + wdoc('docs/a.md', 'mentions F-deadbeef and F-001'); + + const fs = run(); + + expect(fs.some((f) => f.severity === 'warn' && f.message.includes('F-deadbeef'))).toBe(true); + expect(fs.some((f) => f.message.includes('F-001'))).toBe(false); + }); +}); diff --git a/tests/stages/detectors/inferable-depends-on.test.ts b/tests/stages/detectors/inferable-depends-on.test.ts new file mode 100644 index 00000000..bfd410e2 --- /dev/null +++ b/tests/stages/detectors/inferable-depends-on.test.ts @@ -0,0 +1,132 @@ +import {describe, test, expect, beforeEach, afterEach} from 'vitest'; +import {mkdtempSync, rmSync, mkdirSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join, dirname} from 'node:path'; +import {inferableDependsOn} from '../../../src/stages/detectors/inferable-depends-on.js'; + +function writeFile(root: string, relPath: string, contents: string): void { + const abs = join(root, relPath); + mkdirSync(dirname(abs), {recursive: true}); + writeFileSync(abs, contents, 'utf8'); +} + +describe('inferableDependsOn detector', () => { + let tmp: string; + + beforeEach(() => { + tmp = mkdtempSync(join(tmpdir(), 'clad-infdep-')); + }); + + afterEach(() => { + rmSync(tmp, {recursive: true, force: true}); + }); + + /** + * Two features: F-aaa111 owns pkg/a.py which imports pkg.b (owned by + * F-bbb222) but declares NO depends_on. The detector should infer the + * undeclared edge and surface exactly one info finding. + */ + function buildEdgeBearingProject(declareEdge: boolean): void { + const dependsOnLine = declareEdge ? '\n depends_on: [F-bbb222]' : ''; + const specYaml = `schema: "0.1" +project: {name: t, language: python} +features: + - id: F-aaa111 + slug: a + title: A + status: done + modules: ["pkg/a.py"] + acceptance_criteria: []${dependsOnLine} + - id: F-bbb222 + slug: b + title: B + status: done + modules: ["pkg/b.py"] + acceptance_criteria: [] +`; + writeFile(tmp, 'spec.yaml', specYaml); + writeFile(tmp, 'pkg/a.py', 'from pkg.b import thing\n'); + writeFile(tmp, 'pkg/b.py', 'x = 1\n'); + } + + test('emits one info finding when undeclared inferable edges exist', () => { + buildEdgeBearingProject(false); + + const findings = inferableDependsOn.run({cwd: tmp}); + + expect(findings).toHaveLength(1); + const finding = findings[0]; + expect(finding.detector).toBe('INFERABLE_DEPENDS_ON'); + expect(finding.severity).toBe('info'); + expect(typeof finding.message).toBe('string'); + expect(finding.message).toContain('clad infer-deps'); + }); + + test('emits nothing when the dependency graph is fully declared', () => { + buildEdgeBearingProject(true); + + const findings = inferableDependsOn.run({cwd: tmp}); + + expect(findings).toEqual([]); + }); + + test('safe-degrades to no findings on an import-less or empty spec', () => { + // Sub-case (1): features whose modules have NO cross-feature imports. + const importLessSpec = `schema: "0.1" +project: {name: t, language: python} +features: + - id: F-aaa111 + slug: a + title: A + status: done + modules: ["pkg/a.py"] + acceptance_criteria: [] + - id: F-bbb222 + slug: b + title: B + status: done + modules: ["pkg/b.py"] + acceptance_criteria: [] +`; + writeFile(tmp, 'spec.yaml', importLessSpec); + writeFile(tmp, 'pkg/a.py', 'x = 1\n'); + writeFile(tmp, 'pkg/b.py', 'x = 1\n'); + + let importLessResult: ReturnType = []; + expect(() => { + importLessResult = inferableDependsOn.run({cwd: tmp}); + }).not.toThrow(); + expect(importLessResult).toEqual([]); + + // Sub-case (2): an empty features list. + const emptyTmp = mkdtempSync(join(tmpdir(), 'clad-infdep-')); + try { + const emptySpec = `schema: "0.1" +project: {name: t, language: python} +features: [] +`; + writeFile(emptyTmp, 'spec.yaml', emptySpec); + + let emptyResult: ReturnType = []; + expect(() => { + emptyResult = inferableDependsOn.run({cwd: emptyTmp}); + }).not.toThrow(); + expect(emptyResult).toEqual([]); + } finally { + rmSync(emptyTmp, {recursive: true, force: true}); + } + }); + + test('only ever returns info severity (never fails the gate)', () => { + buildEdgeBearingProject(false); + + const findings = inferableDependsOn.run({cwd: tmp}); + + expect(findings.length).toBeGreaterThan(0); + for (const finding of findings) { + expect(finding.severity).toBe('info'); + expect(finding.severity).not.toBe('error'); + expect(finding.severity).not.toBe('warn'); + } + }); +}); From d9056b2dc9d6afdd11d841bde834ec748fbde58c Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Thu, 2 Jul 2026 16:06:36 +0900 Subject: [PATCH 4/6] =?UTF-8?q?Graph=20capability=20repairs=20=E2=80=94=20?= =?UTF-8?q?the=200.7.0=20seams,=20simulation-verified=20(#225)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(hygiene): replace raw NUL bytes with \u0000 escapes — sources were binary to git src/graph/model.ts (edge-dedup key), src/optimizer/infer-depends-on.ts (edge-map key), src/spec/attestation.ts (sha256 separators) carried literal 0x00 chars inside string/template literals. Git's binary heuristic then hid those files from every diff/blame/review — the 0.7.0 graph core shipped as "Bin 0 -> 9363 bytes" with a review-invisible diff. The escape spelling is byte-identical at runtime (attestation digests unchanged; verified by simulation before the change). Adds a self-consistency test banning raw NUL bytes across the source tree so a file can never silently become review-invisible again. Co-Authored-By: Claude Fable 5 * fix(graph): legacy F-NNN ids restored to the doc axis via a shared F-id lexer doc-references.ts matched only 6-8 hex ids, so every legacy sequential id (F-001…F-083 — 80 live shards) referenced in docs/ produced no doc→feature edge and no DOC_LINK_INTEGRITY validation, while graph-health.ts already carried the correct alternation. src/spec/feature-id.ts is now the single prose-scanning lexer for both sites (fresh RegExp per call — no shared /g state). Simulated on the live repo before implementing: +10 refs gained, all 10 resolve to real shards (0 new warns), hash-id extraction byte-identical, references edges 8→18. spec/_doc-links.yaml regeneration happens via clad sync at branch close. Co-Authored-By: Claude Fable 5 * fix(hook): PostToolUse impact card fires on host-style absolute paths Hosts send tool_input.file_path ABSOLUTE while moduleOwners keys are the spec's repo-relative posix paths, so buildImpactSlice never resolved and the impact card (F-d6b93648) never rendered in real usage. Measured on cladding-self before the fix: 0/361 module paths hit; after relativizing: 358/361 (99.2% — the 3 misses are trailing-slash directory keys unreachable via the hook). Outside-repo absolute paths degrade to not_found, relative inputs are untouched (idempotent). Card now also displays the relative path. Adds the end-to-end wiring test (runHookEvent with an absolute file_path against a real on-disk spec) that was missing when the bug shipped. Co-Authored-By: Claude Fable 5 * fix(working-set): module queries seed every co-owner; the budget now caps breaks_if_changed Two seams in one module, landed together deliberately — simulation showed the fan-out alone doubles budget-breach paths (17→33/144 on cladding-self, worst 2.9x the cap), so the clip must ship with it. Fan-out: a module-path query now passes its original form to the iterative impact slice, seeding ALL owners (reverse-slice already supported this) — before, only the alphabetically-first owner's dependents/tests were reported (src/cli/clad.ts: impacted 0 vs 83). Co-owners are seeds, so they surface in co_owners, not impacted; feature-id queries are byte-identical. Clip: breaks_if_changed now participates in the token budget, LAST in the clipping order (needs → code → breaks; the clip-before-code variant simulated strictly worse). Deeper dependents drop from the far end first, then tests outside the depth-1 floor; the direct set is never dropped (must-edit precedent). Fit checks measure WITH the pending 'breaks: omitted …' marker, closing the +3..10-token overshoot the old loops carried. In-budget payloads return byte-identical (pure no-op — existing 6 tests unchanged). Co-Authored-By: Claude Fable 5 * fix(measure): attribute cap-driven shrink honestly; plumb one reader through both sides Two validity fixes to clad measure, both simulation-verified before coding: Attribution: medianShrinkFactor was bounded by the 3000-token default budget — on cladding-self the '~4x smaller' headline was mostly the CAP's arithmetic, not graph value (uncapped, the structural slice is ~1.16x of naive: code + structured metadata). The report now splits fitsCount/truncatedCount with medianShrinkFit/medianShrinkTruncated and a medianStructuralRatio, and the CLI headline attributes the reduction to the budget ('budget enforces 3.9x on 163 capped') instead of selling it as shrink. What the working set actually sells: a guaranteed token budget + wired needs/breaks/verify context. One universe: the injected ModuleReader now reaches buildWorkingSet → codeExcerpt (same safety gates), so the slice and the naive baseline read the SAME universe — before, a virtual reader fed only the baseline, silently inflating the shrink factor ('Pure given (spec, reader)' is now true). The old test asserted the inflated number; rewritten to assert the honest split. Co-Authored-By: Claude Fable 5 * fix(serve): 503 error-as-data on unreadable spec; clean EADDRINUSE; watcher + Host hardening Body-before-writeHead on every non-SSE route: a mid-write or unparseable spec throws inside liveGraph(), and committing the 200+application/json headers first turned that into an HTTP 200 whose body was a prose YAML error — precisely the state the fs.watch auto-reload refetches into. Parse failures now answer 503 with a JSON {error} payload (the viewer can show a retry state); the headersSent guard remains for mid-stream (SSE) failures. Also covers schema-invalid specs (simulation). EADDRINUSE: server.on('error') now rejects the boot promise, so runGraphServeCommand prints one pulse line and exits 1 — before, the 'error' event was unhandled (raw 20-line stack) and the promise never settled. The listener stays attached so later runtime errors can't crash the process either. FSWatcher 'error' events degrade to manual refresh instead of crashing. A foreign Host header is refused (DNS-rebinding guard; the bind was already 127.0.0.1). Tests: the old 'watched-file change' test called broadcast() by hand — renamed to what it tests, and a REAL fs.watch→debounce→SSE chain test added (writes under spec/, capability-probe skip on platforms without recursive watch), plus 503, busy-port, and Host-guard cases. Co-Authored-By: Claude Fable 5 * fix(graph): kind-twin union for focus queries; clad_get_graph summary; health cache + all-twin badges; live viewer fixes Node identity: the same file materialises as up to three nodes (module:/test:/doc: — 95 paths on cladding-self), and every focus surface picked only the FIRST twin, silently dropping the others' edges. resolveNodeIds returns all twins, subgraph accepts a seed set, and the CLI --focus + clad_get_graph query union them (resolveNodeId keeps the old single-id contract). graph-health now badges ALL twins of a finding's path (first-twin-only left siblings looking healthy) and the viewer's drift pill counts distinct paths so twins can't double the headline number. clad_get_graph: the no-query form returned the whole graph pretty-printed — measured 285KB (~70k tokens) in one MCP result, contradicting the working-set budget discipline. It now answers a graphStats summary (counts by kind + top hubs + a hint at the CLI export, 2.1KB); a focused query still returns the real subgraph. The vacuous clad_get_working_set test (asserted a hand-maintained constant against itself; the handler was never invoked) is replaced with a real MCP round-trip: on-disk module code in must_edit.code, dependent in breaks, budget echo, isError miss. nodeHealth wraps its detector loop in primeSpecCache (the drift.ts run-scope pattern): one shard-tree parse instead of ~10 per /health.json request — measured 611ms → 21ms for the loop, results byte-identical (incl. mtime-sensitive STALE_TESTS on a drifted fixture). Viewer: SSE change detection compares the server's exact graph.json text (baseline = first fetch; never re-serialized client-side) — the old nodes.length proxy missed edge-only and same-count node changes and rendered stale. Wires the dead mobile burger button. CLI: a typo'd --format/--depth now fails loudly instead of silently rendering mermaid. Co-Authored-By: Claude Fable 5 * fix(infer-deps): extract export…from re-exports + literal dynamic import(); TS fixtures added The JS/TS branch missed two statically-extractable forms cladding's own source uses: 'export … from' re-exports (barrel files are dependencies) and literal dynamic import('…'). Both now produce edges. A NON-literal import(expr) flags the file in dynamicImportFiles (kept apart from the shared DYNAMIC_IMPORT regex — 'import (' would false-flag Python's parenthesized from-import). The whole JS/TS extraction branch shipped with zero fixtures (all Python) — a TS fixture set now pins import…from, side-effect import, require(), re-exports, dynamic import, and the single-segment ambiguity rule. Co-Authored-By: Claude Fable 5 * fix(render,serve,build): label escaping, corrupt-JSONL tolerance, three.js license notice Mermaid ids are deduped (safeId collapsed src/a.ts vs src/a_ts into one node silently); labels flatten quotes/newlines that broke the quoted-label syntax. DOT escapes backslashes before quotes. Obsidian wikilink aliases strip the |[[]] metacharacters that corrupt links. clad_get_events tolerates a corrupt/partial JSONL line (mid-write tail read) as an {unparseable} entry instead of crashing the tool call. The viewer bundle keeps three.js's MIT notice (legalComments 'eof' — 'none' stripped it from a distributed artifact). Co-Authored-By: Claude Fable 5 * docs: record the viewer decision reversal; correct 0.7.0 claims; cap-attribution note design.md gains a dated post-ship addendum (§8): the 'no bespoke web UI' decision was reversed (WebGL viewer + live serve shipped, and why the premise no longer applied), clad_get_dependents shipped as clad_get_impact, scope grew (working-set/iterative/infer-deps/measure), and _doc-links.yaml is a grep/human index, not the export source. The 0.7.0 CHANGELOG described the archived 2D prototype (force sliders, Live/Calm, 'no third-party library') — corrected in place with a note, plus an [Unreleased] section for this branch. Glossary's graph row now names html/serve. README no longer claims serve 'opens' the browser. case-efficiency-measurement.md carries the cap-attribution correction (the '4.1×' headline is budget-enforced, not structural). Deprecation notices say 0.8 (0.7.0 shipped every alias while claiming removal in 0.7). Co-Authored-By: Claude Fable 5 * spec(graph): shards track the corrected 0.7.1 contracts; sync + build artifacts Updated ACs/test_refs where behavior contracts changed (clad_get_graph no-query summary, working-set fan-out + breaks clipping, measure honest attribution + one-reader universe, hook impact-card absolute-path wiring now pinned end-to-end), each with a Correction note recording why. src/spec/feature-id.ts claimed by the doc-graph feature. clad sync regenerated spec/_doc-links.yaml — the restored legacy F-NNN doc edges (multi-provider-roadmap, ssot-model) plus design.md's addendum references now materialize. npm run build refreshed dist + plugin mirrors + the viewer bundle (SSE text-compare + pill dedupe + burger + three.js MIT notice at EOF). Persona alias deprecation wording aligned to 0.8. Gate: clad check --tier=pre-push --strict GREEN (exit 0), full suite 1681/1681. Co-Authored-By: Claude Fable 5 --------- Co-authored-by: Claude Fable 5 --- CHANGELOG.md | 101 ++- README.md | 2 +- .../case-efficiency-measurement.md | 21 +- docs/glossary.md | 2 +- docs/knowledge-graph/design.md | 41 +- plugins/claude-code/dist/clad.js | 706 +++++++++--------- scripts/build.mjs | 4 +- spec.yaml | 2 +- spec/_doc-links.yaml | 6 + spec/attestation.yaml | 122 +-- spec/features/doc-graph-links-ee5f643e.yaml | 1 + .../graph-context-wiring-d6b93648.yaml | 5 +- .../graph-efficiency-measure-16138071.yaml | 9 +- spec/features/graph-serve-live-64a5c159.yaml | 11 +- .../working-set-assembler-06dfdad6.yaml | 12 +- spec/index.yaml | 2 +- src/agents/loader.ts | 4 +- src/cli/clad.ts | 24 +- src/cli/graph-serve.ts | 62 +- src/cli/graph.ts | 26 +- src/cli/hook.ts | 9 +- src/graph/model.ts | Bin 9363 -> 10286 bytes src/graph/render.ts | 36 +- src/graph/viewer/main.ts | 31 +- src/optimizer/code-excerpt.ts | 40 +- src/optimizer/infer-depends-on.ts | 29 +- src/optimizer/measurement.ts | 50 +- src/optimizer/working-set.ts | 84 ++- src/serve/server.ts | 108 ++- src/spec/attestation.ts | Bin 3062 -> 3072 bytes src/spec/doc-references.ts | 6 +- src/spec/feature-id.ts | 17 + src/stages/graph-health.ts | 64 +- tests/agents/loader.test.ts | 4 +- tests/cli/clad.test.ts | 2 +- tests/cli/graph-serve.test.ts | 93 ++- tests/cli/hook.test.ts | 44 ++ tests/graph/model.test.ts | 41 +- tests/optimizer/infer-depends-on.test.ts | 68 ++ tests/optimizer/measurement.test.ts | 53 +- tests/optimizer/working-set.test.ts | 75 ++ tests/self-consistency.test.ts | 29 +- tests/serve/server.test.ts | 59 +- tests/spec/doc-references.test.ts | 10 + 44 files changed, 1496 insertions(+), 619 deletions(-) create mode 100644 src/spec/feature-id.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index de079971..38f25efe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,70 @@ Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed + +- **The after-edit impact card now actually fires.** Hosts send absolute file + paths while the spec's module index is repo-relative, so the PostToolUse + impact card (0.7.0) never rendered in real usage — 0/361 module paths resolved + on cladding-self, 99.2% after relativizing. The card also shows the + repo-relative path now. +- **Legacy `F-NNN` ids joined the doc graph.** The doc scanner matched only + hash-style ids, so docs referencing legacy features (F-001…F-083, 80 live + shards) produced no edges and no `DOC_LINK_INTEGRITY` validation. One shared + F-id lexer (`src/spec/feature-id.ts`) now feeds both scan sites — +10 doc + references restored on cladding-self, zero new warnings. +- **Shared-file blast radius is complete.** `clad_get_working_set` on a module + path seeded only the alphabetically-first owner, silently dropping the other + owners' dependents and regression tests (a hub file reported 0 impacted vs the + real 83). Module queries fan out to every owner now, and `breaks_if_changed` + finally participates in the token budget: deeper dependents clip first, the + depth-1 direct set is never dropped, and every clip is reported in + `budget.truncated`. +- **`clad measure` attributes its numbers honestly.** The headline shrink factor + was mostly the 3000-token budget cap doing the work, not the graph. The report + now splits cap-driven vs structural shrink (the uncapped slice is ≈1.16x of + naive on cladding-self — code plus metadata, not smaller) and the CLI headline + says "budget enforces Nx" instead of selling cap arithmetic as savings. The + injected file reader now feeds both the slice and the baseline (one universe). +- **The live viewer can no longer render stale.** SSE refresh compared node + COUNTS, so edge-only and same-count changes never redrew — it now compares the + server's exact graph text. The health pill counts distinct files (a file's + module/test/doc twin nodes counted once), and the mobile sidebar button works. +- **`clad graph serve` fails honestly.** A mid-write or unparseable spec used to + answer HTTP 200 + a prose error labeled as JSON — now 503 with a JSON error + payload. A busy port prints one clean line instead of a raw stack; watcher + errors degrade to manual refresh; foreign Host headers are refused + (DNS-rebinding guard); and `/health.json` parses the spec once instead of ~10× + per request (611ms → 81ms measured). +- **Graph sources are reviewable again.** Three source files carried raw NUL + bytes, so git treated them as binary — the 0.7.0 graph core shipped with a + review-invisible diff. Replaced with the six-character backslash-u-0000 escapes (byte-identical at + runtime, attestation digests unchanged) and guarded by a hygiene test. +- **One file, one focus.** The same path can exist as a module, a test, and a + doc node at once (95 such paths on cladding-self); focus queries + (`--focus`, `clad_get_graph`) and health badges now cover all of a path's + nodes instead of the first one found. +- Renderer/CLI hygiene: mermaid ids no longer collide silently, DOT/mermaid/ + Obsidian labels escape their metacharacters, a typo'd `--format`/`--depth` + fails loudly instead of falling back to mermaid, a corrupt event-log line no + longer crashes `clad_get_events`, and the viewer bundle keeps three.js's MIT + notice. + +### Changed + +- **`clad_get_graph` without a focus returns a stats summary** (node/edge counts + by kind + top hubs, ~2KB) instead of the whole graph — the full dump measured + ~285KB (~70k tokens) in a single MCP result on cladding-self and grows with + the project. Pass a query for a neighborhood; `clad graph export --format + json` still dumps everything. +- **`clad infer-deps` sees re-exports and literal dynamic imports** + (`export … from './x.js'`, `import('./x.js')`) — barrel-file dependencies now + produce edges, and a non-literal `import(expr)` flags the file as + under-reported. The JS/TS extraction path is now covered by fixtures (it + shipped with none). +- Deprecated verb/prompt aliases (0.6.0 renames) now say "removed in 0.8" — + 0.7.0 still shipped every alias while the notice claimed removal in 0.7. + ## [0.7.0] — 2026-07-01 — Knowledge Graph ### Knowledge graph (spec↔code↔doc) @@ -43,22 +107,25 @@ always-current graph you can query for impact and *see* in a graph viewer. graph tool. `--focus --depth N` exports just one neighborhood. `stats` ranks the load-bearing hubs by degree. - **Our own graph viewer, colored by SSoT layer.** `clad graph export --format - html` writes one self-contained file you can double-click — a dependency-free - interactive graph (no internet, no install). Each spec layer gets its own color - (sealed spec / design / derived / audit), code sits in a neutral tone, and - features show their readable slug instead of an opaque id. Search, filter by - layer or kind, hover to light up a neighborhood, drag to pin, a "Live/Calm" - toggle, light/dark — all in one offline page. -- **A live graph that follows your work.** `clad graph serve` opens the same + html` writes one self-contained file you can double-click — a fully offline + interactive graph (no internet, no install; the rendering library is bundled + inside the file). Each spec layer gets its own color (sealed spec / design / + derived / audit), code sits in a neutral tone, and features show their + readable slug instead of an opaque id. Search, filter by layer or kind, hover + for details, click a node to fly to its neighborhood, light/dark — all in one + offline page. *(Corrected 0.7.1: this entry originally described an earlier + 2D prototype with force sliders and a Live/Calm toggle that did not ship — + what shipped is the WebGL viewer below.)* +- **A live graph that follows your work.** `clad graph serve` hosts the same viewer at a local address and **updates itself as you edit** — change the spec or a doc and the open page reflects it, no re-export. Agents can read the same always-current graph through the new `clad_get_graph` tool. -- **An Obsidian-grade viewer.** The layout is now a continuously-running force - simulation: drag a node and the web stretches and recoils with real tension; - hovering pauses the motion so you can read; four force sliders (center / repel / - link / link distance) retune it live. Each node class has its own color — the - four spec layers, and code/test/doc each distinct — so the structure reads at a - glance. +- **A galaxy you can orbit.** The viewer renders the whole graph as a WebGL 3D + galaxy (three.js, bundled offline): spec at the core, code/tests/docs fanning + outward on their own shells, hubs sized by how load-bearing they are. The + layout is deterministic — the same graph always lands in the same shape (no + randomness), so an export is reproducible byte-for-byte. Drag to orbit, scroll + to zoom, click to focus. - **The killer: live conformance, healing as you watch.** Every node carries its real spec↔code health, computed from cladding's own drift detectors — a feature whose test went missing, a file no feature claims, a doc pointing at a deleted @@ -70,10 +137,10 @@ always-current graph you can query for impact and *see* in a graph viewer. **Notes** - Drift detectors: 37 → 40 — this work adds `DOC_LINK_INTEGRITY` and `INFERABLE_DEPENDS_ON`; develop's `UNVERIFIED_AC` (below) is the third. -- The viewer is hand-rolled (no bundled third-party graph library) to stay - dependency-free and fully offline; the layout draws itself and settles, then - stays calm. It is a way to *see and navigate* the spec↔code↔doc structure, not - a correctness check — run `clad check` for that. +- The viewer bundles three.js into the single offline file (no CDN, no network + request — *corrected 0.7.1: this note originally claimed "no bundled + third-party graph library"*). It is a way to *see and navigate* the + spec↔code↔doc structure, not a correctness check — run `clad check` for that. - Design + measured cost/benefit model: `docs/knowledge-graph/design.md`. ### Added diff --git a/README.md b/README.md index 4f4246b8..bb414607 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ Blue = spec (center), orange = code, green = tests, pink = docs; more-connected -- **See — the whole project on one canvas** — Run `clad graph serve` and it opens in your browser; you see what connects to what at a glance. +- **See — the whole project on one canvas** — Run `clad graph serve`, open the printed localhost address in your browser, and you see what connects to what at a glance. - **Ask — "what breaks if I change this?"** — Ask the map and it tells you what's affected and which tests to run — it doesn't guess. - **Measure — it shines brighter the larger the project** — The amount you have to look at when fixing something drops sharply — on average **4× less** than reading everything. (`clad measure`) diff --git a/docs/ab-evaluation/case-efficiency-measurement.md b/docs/ab-evaluation/case-efficiency-measurement.md index 84912816..a98a7887 100644 --- a/docs/ab-evaluation/case-efficiency-measurement.md +++ b/docs/ab-evaluation/case-efficiency-measurement.md @@ -34,6 +34,17 @@ its shard+modules, and the graph resolves the dependency radius + the exact regr > different statistic from the 4.1× median-of-ratios, not a contradiction. Both come straight > from `clad measure` (`medianShrinkFactor` vs `medianSliceTokens`/`medianNaiveTokens`). +> **Correction (0.7.1 — cap attribution).** A later validity check showed the shrink numbers +> above are largely the working set's **3000-token default budget** doing the compressing, not +> the graph: with the cap lifted, the structural slice is ≈**1.16× of naive** on cladding-self — +> the slice is the code PLUS structured metadata, not a smaller artifact. On cladding-self +> 163/199 features hit the cap (their "shrink" is cap arithmetic, ≈3.9×) while the 36 that fit +> actually grow (0.7×). `clad measure` now reports the split (`fitsCount`/`truncatedCount`, +> `medianShrinkFit`/`medianShrinkTruncated`, `medianStructuralRatio`) and its headline +> attributes the reduction to the budget. Read the vapt 4.1× above the same way: the honest +> claim is **a guaranteed token budget with needs/breaks/verify wiring attached**, not "N× +> smaller context". + ## Honest scope (what this does and does NOT claim) - This is the efficiency the **infrastructure CAN provide** — an upper bound vs **one** naive baseline (shard + all module files). It is real, deterministic, and model-independent. @@ -49,10 +60,12 @@ its shard+modules, and the graph resolves the dependency radius + the exact regr cheaper end-to-end (it greps anyway). Consistent with the long-standing governance-⊥-correctness prior. - **Goal axes (search + context efficiency, stability/traceability)**: **POSITIVE + now quantified** - — 4.1× smaller context per change, dependency radius + regression set resolved deterministically, - a queryable/visualizable dependency graph (0→698 edges on vapt). This is the value to feature: - *cladding makes the context for a change small, the blast radius explicit, and the regression set - known* — for humans and for agents that choose to use it — not "smarter agents". + — a budget-guaranteed bounded context per change (see the 0.7.1 correction: the raw "4.1× + smaller" is the budget cap enforcing the bound, not structural shrink), dependency radius + + regression set resolved deterministically, a queryable/visualizable dependency graph (0→698 + edges on vapt). This is the value to feature: *cladding makes the context for a change bounded, + the blast radius explicit, and the regression set known* — for humans and for agents that + choose to use it — not "smarter agents". **Reproduce:** `clad measure` (table) or `clad measure --json` (per-feature). Original vapt untouched; measured on a disposable clone. No push/deploy. diff --git a/docs/glossary.md b/docs/glossary.md index ba46f860..3de9af08 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -65,7 +65,7 @@ | `impact` | stable (0.7.0) | Print the blast radius for a change — the transitive dependents of a feature/file plus the scenarios and the regression test set to re-run. The backward complement of `context` (what depends on this, vs what this needs). | 영향 반경(blast radius) | | `measure` | stable (0.7.0) | Report the search + context efficiency the graph provides per feature — working-set tokens vs the naive (shard + all module files) baseline, dependency depth/edges resolved, regression-set coverage. Deterministic; measures what the graph CAN provide, not agent adoption. | 효율 측정 | | `infer`-deps | stable (0.7.0) | Suggest feature `depends_on` edges from the code import graph — the dependency edges cladding never auto-produced. Resolves each module's imports to the owning feature; prints reviewable suggestions (a human merges them — anti-self-cert). | 의존 추론 | -| `graph` | stable (0.7.0) | Render the spec↔code↔doc knowledge graph for a viewer (`export` → mermaid/dot/json/Obsidian-vault) or report its shape (`stats` → counts + hubs). Reuses best-in-class viewers instead of a bespoke UI. | 지식 그래프 | +| `graph` | stable (0.7.0) | Render the spec↔code↔doc knowledge graph: `export` → mermaid/dot/json/Obsidian-vault or a self-contained offline `html` viewer (WebGL, three.js bundled); `serve` → the same viewer live on localhost, auto-reloading as spec/docs change; `stats` → counts + hubs. | 지식 그래프 | | `hook` | stable (0.6.0) | Host hook protocol adapter — consumes one host lifecycle event (SessionStart / UserPromptSubmit / PreToolUse / PostToolUse / Stop) as stdin JSON; always exits 0. Honest limit: PreToolUse blocking only sees Edit/Write tool calls — a YAML edit made through Bash bypasses lane one; the Stop hook's post-hoc detectors are lane two. Neither lane alone is the guarantee. | 호스트 훅 프로토콜 어댑터 | | `changelog` | stable (0.6.0) | Render shipped changes since a git ref into human-facing documents — capability-grouped markdown / `--json` manifest / `--audit` verification table / `--catalog` spec listing. Named `changelog` deliberately, NOT `digest` (which means cryptographic hash in this domain — see Naming conventions). | 변경 이력 렌더링 | diff --git a/docs/knowledge-graph/design.md b/docs/knowledge-graph/design.md index 4b2c80f0..3a631c07 100644 --- a/docs/knowledge-graph/design.md +++ b/docs/knowledge-graph/design.md @@ -1,10 +1,12 @@ # Cladding Knowledge Graph — design & cost model -> Status: design (v0.7.0 track). Honest framing: this layer improves **traceability -> completeness** and **context-selection efficiency (retrieval)**. It does **not** -> improve LLM correctness or "reasoning depth" — cladding's own A/B record shows -> conformance is orthogonal to the spec layer (vanilla ties cladding across 6 domains). -> We sell *connection that stays current* and *bounded context*, not smarter answers. +> Status: design (v0.7.0 track), with a **post-ship addendum (§8)** recording where +> the shipped capability deliberately departed from this document. Honest framing: +> this layer improves **traceability completeness** and **context-selection +> efficiency (retrieval)**. It does **not** improve LLM correctness or "reasoning +> depth" — cladding's own A/B record shows conformance is orthogonal to the spec +> layer (vanilla ties cladding across 6 domains). We sell *connection that stays +> current* and *bounded context*, not smarter answers. ## 1. Why (the SSoT thesis, made queryable) @@ -137,3 +139,32 @@ Each: author shard (hash id) → implement → blind-author tests (separate cont `clad done` (flips only on GREEN `clad check --tier=pre-push --strict`). Modules are shared (`src/spec`, `src/optimizer`, `src/serve`, `src/stages/detectors`), so the features run sequentially. + +## 8. Post-ship addendum (2026-07-02) — where v0.7.0 departed from this design + +This document froze the decision record as of planning. Three decisions were +reversed or extended during delivery; recording them here keeps this doc honest +instead of contradicting the shipped tree ("all documents connected, always +current" must apply to the design doc itself). + +- **§5's "no bespoke web UI" was reversed.** v0.7.0 shipped a bespoke viewer + after all: a self-contained offline HTML export (`--format html`) and a live + server (`clad graph serve`, node:http + SSE auto-reload), rendering the graph + as a deterministic WebGL galaxy (three.js bundled — F-02343cd1, F-77f7ead0, + F-64a5c159). Why the reversal held up: the mermaid/DOT/Obsidian emitters + stayed (this section's real point — reuse where viewers exist), but no + existing viewer could show cladding's differentiator — per-node LIVE + spec↔code conformance from our own drift detectors (`/health.json`, + graph-health stage) — so the "high-effort, low-marginal-value" premise no + longer applied to that slice of value. The export formats and `stats` shipped + exactly as designed. +- **`clad_get_dependents` shipped as `clad_get_impact`** (plus `clad impact` on + the CLI); the forward/backward pair is `clad_get_context` / `clad_get_impact`. +- **Scope grew beyond §6 IN:** working-set assembly (`clad_get_working_set`), + iterative impact slicing, `clad infer-deps` (restoring the empty `depends_on` + data layer), and `clad measure` shipped in the same track. +- **`spec/_doc-links.yaml` is a grep/human index, not the export source.** + buildGraph re-derives doc edges from `docs/` directly on every build (that is + what keeps the live view current); the yaml exists so "which docs explain + feature X" is one grep away and so reviews can diff doc-link changes. §5's + "graph-export source" phrasing overstated it. diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 52afbb20..a52cb026 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,239 +4,239 @@ const require = __claddingCreateRequire(import.meta.url); // Marker for stages/*.ts: when true, the per-stage CLI-entry guard // short-circuits so the bundle doesn't fire every stage at startup. globalThis.__CLADDING_BUNDLED = true; -var kae=Object.create;var Nk=Object.defineProperty;var Eae=Object.getOwnPropertyDescriptor;var Aae=Object.getOwnPropertyNames;var Tae=Object.getPrototypeOf,Oae=Object.prototype.hasOwnProperty;var Ue=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var b=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),xr=(t,e)=>{for(var r in e)Nk(t,r,{get:e[r],enumerable:!0})},Iae=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Aae(e))!Oae.call(t,i)&&i!==r&&Nk(t,i,{get:()=>e[i],enumerable:!(n=Eae(e,i))||n.enumerable});return t};var $t=(t,e,r)=>(r=t!=null?kae(Tae(t)):{},Iae(e||!t||!t.__esModule?Nk(r,"default",{value:t,enumerable:!0}):r,t));var Xu=b(Mk=>{var Wh=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},jk=class extends Wh{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Mk.CommanderError=Wh;Mk.InvalidArgumentError=jk});var Kh=b(zk=>{var{InvalidArgumentError:Pae}=Xu(),Fk=class{constructor(e,r){switch(this.description=r||"",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.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new Pae(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Rae(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}zk.Argument=Fk;zk.humanReadableArgName=Rae});var qk=b(Uk=>{var{humanReadableArgName:Cae}=Kh(),Lk=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>Cae(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` -`)}displayWidth(e){return I2(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return utypeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Er=(t,e)=>{for(var r in e)zk(t,r,{get:e[r],enumerable:!0})},Fae=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Nae(e))!Mae.call(t,i)&&i!==r&&zk(t,i,{get:()=>e[i],enumerable:!(n=Dae(e,i))||n.enumerable});return t};var kt=(t,e,r)=>(r=t!=null?Cae(jae(t)):{},Fae(e||!t||!t.__esModule?zk(r,"default",{value:t,enumerable:!0}):r,t));var rd=v(Uk=>{var Jh=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},Lk=class extends Jh{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Uk.CommanderError=Jh;Uk.InvalidArgumentError=Lk});var Yh=v(Bk=>{var{InvalidArgumentError:zae}=rd(),qk=class{constructor(e,r){switch(this.description=r||"",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.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new zae(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Lae(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}Bk.Argument=qk;Bk.humanReadableArgName=Lae});var Gk=v(Zk=>{var{humanReadableArgName:Uae}=Yh(),Hk=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>Uae(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` +`)}displayWidth(e){return F2(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return u{let a=s.match(i);if(a===null){o.push("");return}let c=[a.shift()],l=this.displayWidth(c[0]);a.forEach(u=>{let d=this.displayWidth(u);if(l+d<=r){c.push(u),l+=d;return}o.push(c.join(""));let f=u.trimStart();c=[f],l=this.displayWidth(f)}),o.push(c.join(""))}),o.join(` -`)}};function I2(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}Uk.Help=Lk;Uk.stripColor=I2});var Gk=b(Zk=>{var{InvalidArgumentError:Dae}=Xu(),Bk=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=Nae(e);this.short=n.shortFlag,this.long=n.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,this.helpGroupHeading=void 0}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),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}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new Dae(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?P2(this.name().replace(/^no-/,"")):P2(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Hk=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function P2(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Nae(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} +`)}};function F2(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}Zk.Help=Hk;Zk.stripColor=F2});var Jk=v(Kk=>{var{InvalidArgumentError:qae}=rd(),Vk=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=Bae(e);this.short=n.shortFlag,this.long=n.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,this.helpGroupHeading=void 0}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),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}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new qae(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?z2(this.name().replace(/^no-/,"")):z2(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Wk=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function z2(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Bae(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} - a short flag is a single dash and a single character - either use a single dash and a single character (for a short flag) - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a} - too many short flags`):i.test(s)?new Error(`${a} - too many long flags`):new Error(`${a} -- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}Zk.Option=Bk;Zk.DualOptions=Hk});var C2=b(R2=>{function jae(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function Mae(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=jae(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` +- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}Kk.Option=Vk;Kk.DualOptions=Wk});var U2=v(L2=>{function Hae(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function Zae(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=Hae(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` (Did you mean one of ${n.join(", ")}?)`:n.length===1?` -(Did you mean ${n[0]}?)`:""}R2.suggestSimilar=Mae});var M2=b(Yk=>{var Fae=Ue("node:events").EventEmitter,Vk=Ue("node:child_process"),Li=Ue("node:path"),Jh=Ue("node:fs"),ze=Ue("node:process"),{Argument:zae,humanReadableArgName:Lae}=Kh(),{CommanderError:Wk}=Xu(),{Help:Uae,stripColor:qae}=qk(),{Option:D2,DualOptions:Bae}=Gk(),{suggestSimilar:N2}=C2(),Kk=class t extends Fae{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,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._savedState=null,this._outputConfiguration={writeOut:r=>ze.stdout.write(r),writeErr:r=>ze.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>ze.stdout.isTTY?ze.stdout.columns:void 0,getErrHelpWidth:()=>ze.stderr.isTTY?ze.stderr.columns:void 0,getOutHasColors:()=>Jk()??(ze.stdout.isTTY&&ze.stdout.hasColors?.()),getErrHasColors:()=>Jk()??(ze.stderr.isTTY&&ze.stderr.hasColors?.()),stripColor:r=>qae(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}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 r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new Uae,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...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,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name -- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new zae(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.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,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"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,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(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,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. -Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new Wk(e,r,n)),ze.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new D2(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=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 '${n}' -- already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof D2)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}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,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){ze.versions?.electron&&(r.from="electron");let i=ze.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=ze.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":ze.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. -- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(Jh.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist +(Did you mean ${n[0]}?)`:""}L2.suggestSimilar=Zae});var Z2=v(tE=>{var Gae=Be("node:events").EventEmitter,Yk=Be("node:child_process"),Hi=Be("node:path"),Xh=Be("node:fs"),Ue=Be("node:process"),{Argument:Vae,humanReadableArgName:Wae}=Yh(),{CommanderError:Xk}=rd(),{Help:Kae,stripColor:Jae}=Gk(),{Option:q2,DualOptions:Yae}=Jk(),{suggestSimilar:B2}=U2(),Qk=class t extends Gae{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,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._savedState=null,this._outputConfiguration={writeOut:r=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>eE()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>eE()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Jae(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}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 r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new Kae,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...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,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name +- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new Vae(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.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,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"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,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(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,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. +Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new Xk(e,r,n)),Ue.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new q2(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=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 '${n}' +- already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof q2)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}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,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":Ue.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. +- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(Xh.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=Li.resolve(u,d);if(Jh.existsSync(f))return f;if(i.includes(Li.extname(d)))return;let p=i.find(m=>Jh.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Jh.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=Li.resolve(Li.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=Li.basename(this._scriptPath,Li.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(Li.extname(s));let c;ze.platform!=="win32"?n?(r.unshift(s),r=j2(ze.execArgv).concat(r),c=Vk.spawn(ze.argv[0],r,{stdio:"inherit"})):c=Vk.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=j2(ze.execArgv).concat(r),c=Vk.spawn(ze.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{ze.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new Wk(u,"commander.executeSubCommandAsync","(close)")):ze.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)ze.exit(1);else{let d=new Wk(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==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=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} + - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=Hi.resolve(u,d);if(Xh.existsSync(f))return f;if(i.includes(Hi.extname(d)))return;let p=i.find(m=>Xh.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Xh.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=Hi.resolve(Hi.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=Hi.basename(this._scriptPath,Hi.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(Hi.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=H2(Ue.execArgv).concat(r),c=Yk.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=Yk.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=H2(Ue.execArgv).concat(r),c=Yk.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new Xk(u,"commander.executeSubCommandAsync","(close)")):Ue.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)Ue.exit(1);else{let d=new Xk(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==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=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` -`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in ze.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,ze.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Bae(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=N2(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=N2(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} -`),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>Lae(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Li.basename(e,Li.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(ze.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. +`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Ue.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Yae(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=B2(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=B2(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} +`),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>Wae(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Hi.basename(e,Hi.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(Ue.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,o=>{let s;typeof r=="function"?s=r({error:o.error,command:o.command}):s=r,s&&o.write(`${s} -`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function j2(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function Jk(){if(ze.env.NO_COLOR||ze.env.FORCE_COLOR==="0"||ze.env.FORCE_COLOR==="false")return!1;if(ze.env.FORCE_COLOR||ze.env.CLICOLOR_FORCE!==void 0)return!0}Yk.Command=Kk;Yk.useColor=Jk});var U2=b(un=>{var{Argument:F2}=Kh(),{Command:Xk}=M2(),{CommanderError:Hae,InvalidArgumentError:z2}=Xu(),{Help:Zae}=qk(),{Option:L2}=Gk();un.program=new Xk;un.createCommand=t=>new Xk(t);un.createOption=(t,e)=>new L2(t,e);un.createArgument=(t,e)=>new F2(t,e);un.Command=Xk;un.Option=L2;un.Argument=F2;un.Help=Zae;un.CommanderError=Hae;un.InvalidArgumentError=z2;un.InvalidOptionArgumentError=z2});var Pe=b(Vt=>{"use strict";var eE=Symbol.for("yaml.alias"),Z2=Symbol.for("yaml.document"),Yh=Symbol.for("yaml.map"),G2=Symbol.for("yaml.pair"),tE=Symbol.for("yaml.scalar"),Xh=Symbol.for("yaml.seq"),Ui=Symbol.for("yaml.node.type"),Yae=t=>!!t&&typeof t=="object"&&t[Ui]===eE,Xae=t=>!!t&&typeof t=="object"&&t[Ui]===Z2,Qae=t=>!!t&&typeof t=="object"&&t[Ui]===Yh,ece=t=>!!t&&typeof t=="object"&&t[Ui]===G2,V2=t=>!!t&&typeof t=="object"&&t[Ui]===tE,tce=t=>!!t&&typeof t=="object"&&t[Ui]===Xh;function W2(t){if(t&&typeof t=="object")switch(t[Ui]){case Yh:case Xh:return!0}return!1}function rce(t){if(t&&typeof t=="object")switch(t[Ui]){case eE:case Yh:case tE:case Xh:return!0}return!1}var nce=t=>(V2(t)||W2(t))&&!!t.anchor;Vt.ALIAS=eE;Vt.DOC=Z2;Vt.MAP=Yh;Vt.NODE_TYPE=Ui;Vt.PAIR=G2;Vt.SCALAR=tE;Vt.SEQ=Xh;Vt.hasAnchor=nce;Vt.isAlias=Yae;Vt.isCollection=W2;Vt.isDocument=Xae;Vt.isMap=Qae;Vt.isNode=rce;Vt.isPair=ece;Vt.isScalar=V2;Vt.isSeq=tce});var Qu=b(rE=>{"use strict";var jt=Pe(),$r=Symbol("break visit"),K2=Symbol("skip children"),ii=Symbol("remove node");function Qh(t,e){let r=J2(e);jt.isDocument(t)?rc(null,t.contents,r,Object.freeze([t]))===ii&&(t.contents=null):rc(null,t,r,Object.freeze([]))}Qh.BREAK=$r;Qh.SKIP=K2;Qh.REMOVE=ii;function rc(t,e,r,n){let i=Y2(t,e,r,n);if(jt.isNode(i)||jt.isPair(i))return X2(t,n,i),rc(t,i,r,n);if(typeof i!="symbol"){if(jt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var Q2=Pe(),ice=Qu(),oce={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},sce=t=>t.replace(/[!,[\]{}]/g,e=>oce[e]),ed=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+sce(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&Q2.isNode(e.contents)){let o={};ice.visit(e.contents,(s,a)=>{Q2.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` -`)}};ed.defaultYaml={explicit:!1,version:"1.2"};ed.defaultTags={"!!":"tag:yaml.org,2002:"};eU.Directives=ed});var tg=b(td=>{"use strict";var tU=Pe(),ace=Qu();function cce(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function rU(t){let e=new Set;return ace.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function nU(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function lce(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=rU(t));let s=nU(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(tU.isScalar(s.node)||tU.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}td.anchorIsValid=cce;td.anchorNames=rU;td.createNodeAnchors=lce;td.findNewAnchor=nU});var iE=b(iU=>{"use strict";function rd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var uce=Pe();function oU(t,e,r){if(Array.isArray(t))return t.map((n,i)=>oU(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!uce.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}sU.toJS=oU});var rg=b(cU=>{"use strict";var dce=iE(),aU=Pe(),fce=wo(),oE=class{constructor(e){Object.defineProperty(this,aU.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!aU.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=fce.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?dce.applyReviver(o,{"":a},"",a):a}};cU.NodeBase=oE});var nd=b(lU=>{"use strict";var pce=tg(),mce=Qu(),ic=Pe(),hce=rg(),gce=wo(),sE=class extends hce.NodeBase{constructor(e){super(ic.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],mce.visit(e,{Node:(o,s)=>{(ic.isAlias(s)||ic.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(gce.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=ng(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(pce.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function ng(t,e,r){if(ic.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(ic.isCollection(e)){let n=0;for(let i of e.items){let o=ng(t,i,r);o>n&&(n=o)}return n}else if(ic.isPair(e)){let n=ng(t,e.key,r),i=ng(t,e.value,r);return Math.max(n,i)}return 1}lU.Alias=sE});var It=b(aE=>{"use strict";var yce=Pe(),_ce=rg(),vce=wo(),bce=t=>!t||typeof t!="function"&&typeof t!="object",xo=class extends _ce.NodeBase{constructor(e){super(yce.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:vce.toJS(this.value,e,r)}toString(){return String(this.value)}};xo.BLOCK_FOLDED="BLOCK_FOLDED";xo.BLOCK_LITERAL="BLOCK_LITERAL";xo.PLAIN="PLAIN";xo.QUOTE_DOUBLE="QUOTE_DOUBLE";xo.QUOTE_SINGLE="QUOTE_SINGLE";aE.Scalar=xo;aE.isScalarValue=bce});var id=b(dU=>{"use strict";var Sce=nd(),Ms=Pe(),uU=It(),wce="tag:yaml.org,2002:";function xce(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function $ce(t,e,r){if(Ms.isDocument(t)&&(t=t.contents),Ms.isNode(t))return t;if(Ms.isPair(t)){let d=r.schema[Ms.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Sce.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=wce+e.slice(2));let l=xce(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new uU.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[Ms.MAP]:Symbol.iterator in Object(t)?s[Ms.SEQ]:s[Ms.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new uU.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}dU.createNode=$ce});var og=b(ig=>{"use strict";var kce=id(),oi=Pe(),Ece=rg();function cE(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return kce.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var fU=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,lE=class extends Ece.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>oi.isNode(n)||oi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(fU(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(oi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,cE(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(oi.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&oi.isScalar(o)?o.value:o:oi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!oi.isPair(r))return!1;let n=r.value;return n==null||e&&oi.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return oi.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(oi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,cE(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};ig.Collection=lE;ig.collectionFromPath=cE;ig.isEmptyPath=fU});var od=b(sg=>{"use strict";var Ace=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function uE(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Tce=(t,e,r)=>t.endsWith(` -`)?uE(r,e):r.includes(` +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function H2(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function eE(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}tE.Command=Qk;tE.useColor=eE});var K2=v(fn=>{var{Argument:G2}=Yh(),{Command:rE}=Z2(),{CommanderError:Xae,InvalidArgumentError:V2}=rd(),{Help:Qae}=Gk(),{Option:W2}=Jk();fn.program=new rE;fn.createCommand=t=>new rE(t);fn.createOption=(t,e)=>new W2(t,e);fn.createArgument=(t,e)=>new G2(t,e);fn.Command=rE;fn.Option=W2;fn.Argument=G2;fn.Help=Qae;fn.CommanderError=Xae;fn.InvalidArgumentError=V2;fn.InvalidOptionArgumentError=V2});var Pe=v(Jt=>{"use strict";var iE=Symbol.for("yaml.alias"),Q2=Symbol.for("yaml.document"),Qh=Symbol.for("yaml.map"),eU=Symbol.for("yaml.pair"),oE=Symbol.for("yaml.scalar"),eg=Symbol.for("yaml.seq"),Zi=Symbol.for("yaml.node.type"),oce=t=>!!t&&typeof t=="object"&&t[Zi]===iE,sce=t=>!!t&&typeof t=="object"&&t[Zi]===Q2,ace=t=>!!t&&typeof t=="object"&&t[Zi]===Qh,cce=t=>!!t&&typeof t=="object"&&t[Zi]===eU,tU=t=>!!t&&typeof t=="object"&&t[Zi]===oE,lce=t=>!!t&&typeof t=="object"&&t[Zi]===eg;function rU(t){if(t&&typeof t=="object")switch(t[Zi]){case Qh:case eg:return!0}return!1}function uce(t){if(t&&typeof t=="object")switch(t[Zi]){case iE:case Qh:case oE:case eg:return!0}return!1}var dce=t=>(tU(t)||rU(t))&&!!t.anchor;Jt.ALIAS=iE;Jt.DOC=Q2;Jt.MAP=Qh;Jt.NODE_TYPE=Zi;Jt.PAIR=eU;Jt.SCALAR=oE;Jt.SEQ=eg;Jt.hasAnchor=dce;Jt.isAlias=oce;Jt.isCollection=rU;Jt.isDocument=sce;Jt.isMap=ace;Jt.isNode=uce;Jt.isPair=cce;Jt.isScalar=tU;Jt.isSeq=lce});var nd=v(sE=>{"use strict";var Mt=Pe(),Ar=Symbol("break visit"),nU=Symbol("skip children"),li=Symbol("remove node");function tg(t,e){let r=iU(e);Mt.isDocument(t)?sc(null,t.contents,r,Object.freeze([t]))===li&&(t.contents=null):sc(null,t,r,Object.freeze([]))}tg.BREAK=Ar;tg.SKIP=nU;tg.REMOVE=li;function sc(t,e,r,n){let i=oU(t,e,r,n);if(Mt.isNode(i)||Mt.isPair(i))return sU(t,n,i),sc(t,i,r,n);if(typeof i!="symbol"){if(Mt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var aU=Pe(),fce=nd(),pce={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},mce=t=>t.replace(/[!,[\]{}]/g,e=>pce[e]),id=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+mce(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&aU.isNode(e.contents)){let o={};fce.visit(e.contents,(s,a)=>{aU.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` +`)}};id.defaultYaml={explicit:!1,version:"1.2"};id.defaultTags={"!!":"tag:yaml.org,2002:"};cU.Directives=id});var ng=v(od=>{"use strict";var lU=Pe(),hce=nd();function gce(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function uU(t){let e=new Set;return hce.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function dU(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function yce(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=uU(t));let s=dU(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(lU.isScalar(s.node)||lU.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}od.anchorIsValid=gce;od.anchorNames=uU;od.createNodeAnchors=yce;od.findNewAnchor=dU});var cE=v(fU=>{"use strict";function sd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var _ce=Pe();function pU(t,e,r){if(Array.isArray(t))return t.map((n,i)=>pU(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!_ce.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}mU.toJS=pU});var ig=v(gU=>{"use strict";var bce=cE(),hU=Pe(),vce=Eo(),lE=class{constructor(e){Object.defineProperty(this,hU.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!hU.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=vce.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?bce.applyReviver(o,{"":a},"",a):a}};gU.NodeBase=lE});var ad=v(yU=>{"use strict";var Sce=ng(),wce=nd(),cc=Pe(),xce=ig(),$ce=Eo(),uE=class extends xce.NodeBase{constructor(e){super(cc.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],wce.visit(e,{Node:(o,s)=>{(cc.isAlias(s)||cc.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||($ce.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=og(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Sce.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function og(t,e,r){if(cc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(cc.isCollection(e)){let n=0;for(let i of e.items){let o=og(t,i,r);o>n&&(n=o)}return n}else if(cc.isPair(e)){let n=og(t,e.key,r),i=og(t,e.value,r);return Math.max(n,i)}return 1}yU.Alias=uE});var Pt=v(dE=>{"use strict";var kce=Pe(),Ece=ig(),Ace=Eo(),Tce=t=>!t||typeof t!="function"&&typeof t!="object",Ao=class extends Ece.NodeBase{constructor(e){super(kce.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Ace.toJS(this.value,e,r)}toString(){return String(this.value)}};Ao.BLOCK_FOLDED="BLOCK_FOLDED";Ao.BLOCK_LITERAL="BLOCK_LITERAL";Ao.PLAIN="PLAIN";Ao.QUOTE_DOUBLE="QUOTE_DOUBLE";Ao.QUOTE_SINGLE="QUOTE_SINGLE";dE.Scalar=Ao;dE.isScalarValue=Tce});var cd=v(bU=>{"use strict";var Oce=ad(),Ls=Pe(),_U=Pt(),Ice="tag:yaml.org,2002:";function Pce(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Rce(t,e,r){if(Ls.isDocument(t)&&(t=t.contents),Ls.isNode(t))return t;if(Ls.isPair(t)){let d=r.schema[Ls.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Oce.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Ice+e.slice(2));let l=Pce(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new _U.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[Ls.MAP]:Symbol.iterator in Object(t)?s[Ls.SEQ]:s[Ls.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new _U.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}bU.createNode=Rce});var ag=v(sg=>{"use strict";var Cce=cd(),ui=Pe(),Dce=ig();function fE(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Cce.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var vU=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,pE=class extends Dce.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>ui.isNode(n)||ui.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(vU(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(ui.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,fE(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(ui.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&ui.isScalar(o)?o.value:o:ui.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!ui.isPair(r))return!1;let n=r.value;return n==null||e&&ui.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return ui.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(ui.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,fE(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};sg.Collection=pE;sg.collectionFromPath=fE;sg.isEmptyPath=vU});var ld=v(cg=>{"use strict";var Nce=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function mE(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var jce=(t,e,r)=>t.endsWith(` +`)?mE(r,e):r.includes(` `)?` -`+uE(r,e):(t.endsWith(" ")?"":" ")+r;sg.indentComment=uE;sg.lineComment=Tce;sg.stringifyComment=Ace});var mU=b(sd=>{"use strict";var Oce="flow",dE="block",ag="quoted";function Ice(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,v=-1;r===dE&&(h=pU(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===ag&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}v=h}if(S===` -`)r===dE&&(h=pU(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` -`&&p!==" "){let w=t[h+1];w&&w!==" "&&w!==` -`&&w!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===ag){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let w=h>v+1?h-2:g-1;if(u[w])return t;l.push(w),u[w]=!0,d=w+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S{"use strict";var Cn=It(),$o=mU(),lg=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),ug=t=>/^(%|---|\.\.\.)/m.test(t);function Pce(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function ad(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(ug(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length{"use strict";var Mce="flow",hE="block",lg="quoted";function Fce(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===hE&&(h=SU(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===lg&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` +`)r===hE&&(h=SU(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`&&p!==" "){let x=t[h+1];x&&x!==" "&&x!==` +`&&x!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===lg){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let x=h>b+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S{"use strict";var Mn=Pt(),To=wU(),dg=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),fg=t=>/^(%|---|\.\.\.)/m.test(t);function zce(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function dd(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(fg(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length -`;let d,f;for(f=r.length;f>0;--f){let x=r[f-1];if(x!==` -`&&x!==" "&&x!==" ")break}let p=r.substring(f),m=p.indexOf(` +`;let d,f;for(f=r.length;f>0;--f){let w=r[f-1];if(w!==` +`&&w!==" "&&w!==" ")break}let p=r.substring(f),m=p.indexOf(` `);m===-1?d="-":r===p||m!==p.length-1?(d="+",o&&o()):d="",p&&(r=r.slice(0,-p.length),p[p.length-1]===` -`&&(p=p.slice(0,-1)),p=p.replace(pE,`$&${l}`));let h=!1,g,v=-1;for(g=0;g{I=!0});let k=$o.foldFlowLines(`${_}${x}${p}`,l,$o.FOLD_BLOCK,T);if(!I)return`>${w} -${l}${k}`}return r=r.replace(/\n+/g,`$&${l}`),`|${w} -${l}${_}${r}${p}`}function Rce(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` -`)||u&&/[[\]{},]/.test(o))return oc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?oc(o,e):cg(t,e,r,n);if(!a&&!u&&i!==Cn.Scalar.PLAIN&&o.includes(` -`))return cg(t,e,r,n);if(ug(o)){if(c==="")return e.forceBlockIndent=!0,cg(t,e,r,n);if(a&&c===l)return oc(o,e)}let d=o.replace(/\n+/g,`$& -${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return oc(o,e)}return a?d:$o.foldFlowLines(d,c,$o.FOLD_FLOW,lg(e,!1))}function Cce(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Cn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Cn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Cn.Scalar.BLOCK_FOLDED:case Cn.Scalar.BLOCK_LITERAL:return i||o?oc(s.value,e):cg(s,e,r,n);case Cn.Scalar.QUOTE_DOUBLE:return ad(s.value,e);case Cn.Scalar.QUOTE_SINGLE:return fE(s.value,e);case Cn.Scalar.PLAIN:return Rce(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}hU.stringifyString=Cce});var ld=b(mE=>{"use strict";var Dce=tg(),ko=Pe(),Nce=od(),jce=cd();function Mce(t,e){let r=Object.assign({blockQuote:!0,commentString:Nce.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function Fce(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(ko.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function zce(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(ko.isScalar(t)||ko.isCollection(t))&&t.anchor;o&&Dce.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function Lce(t,e,r,n){if(ko.isPair(t))return t.toString(e,r,n);if(ko.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=ko.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Fce(e.doc.schema.tags,o));let s=zce(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):ko.isScalar(o)?jce.stringifyString(o,e,r,n):o.toString(e,r,n);return s?ko.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}mE.createStringifyContext=Mce;mE.stringify=Lce});var vU=b(_U=>{"use strict";var qi=Pe(),gU=It(),yU=ld(),ud=od();function Uce({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=qi.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(qi.isCollection(t)||!qi.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||qi.isCollection(t)||(qi.isScalar(t)?t.type===gU.Scalar.BLOCK_FOLDED||t.type===gU.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=yU.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=ud.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=ud.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=ud.lineComment(g,r.indent,l(f))));let v,_,S;qi.isNode(e)?(v=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(v=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&qi.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&qi.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let w=!1,x=yU.stringify(e,r,()=>w=!0,()=>h=!0),I=" ";if(f||v||_){if(I=v?` -`:"",_){let T=l(_);I+=` -${ud.indentComment(T,r.indent)}`}x===""&&!r.inFlow?I===` -`&&S&&(I=` - -`):I+=` -${r.indent}`}else if(!p&&qi.isCollection(e)){let T=x[0],k=x.indexOf(` -`),C=k!==-1,E=r.inFlow??e.flow??e.items.length===0;if(C||!E){let Z=!1;if(C&&(T==="&"||T==="!")){let ie=x.indexOf(" ");T==="&"&&ie!==-1&&ie{"use strict";var bU=Ue("process");function qce(t,...e){t==="debug"&&console.log(...e)}function Bce(t,e){(t==="debug"||t==="warn")&&(typeof bU.emitWarning=="function"?bU.emitWarning(e):console.warn(e))}hE.debug=qce;hE.warn=Bce});var hg=b(mg=>{"use strict";var pg=Pe(),SU=It(),dg="<<",fg={identify:t=>t===dg||typeof t=="symbol"&&t.description===dg,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new SU.Scalar(Symbol(dg)),{addToJSMap:wU}),stringify:()=>dg},Hce=(t,e)=>(fg.identify(e)||pg.isScalar(e)&&(!e.type||e.type===SU.Scalar.PLAIN)&&fg.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===fg.tag&&r.default);function wU(t,e,r){let n=xU(t,r);if(pg.isSeq(n))for(let i of n.items)yE(t,e,i);else if(Array.isArray(n))for(let i of n)yE(t,e,i);else yE(t,e,n)}function yE(t,e,r){let n=xU(t,r);if(!pg.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function xU(t,e){return t&&pg.isAlias(e)?e.resolve(t.doc,t):e}mg.addMergeToJSMap=wU;mg.isMergeKey=Hce;mg.merge=fg});var vE=b(EU=>{"use strict";var Zce=gE(),$U=hg(),Gce=ld(),kU=Pe(),_E=wo();function Vce(t,e,{key:r,value:n}){if(kU.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if($U.isMergeKey(t,r))$U.addMergeToJSMap(t,e,n);else{let i=_E.toJS(r,"",t);if(e instanceof Map)e.set(i,_E.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Wce(r,i,t),s=_E.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function Wce(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(kU.isNode(t)&&r?.doc){let n=Gce.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),Zce.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}EU.addPairToJSMap=Vce});var Eo=b(bE=>{"use strict";var AU=id(),Kce=vU(),Jce=vE(),gg=Pe();function Yce(t,e,r){let n=AU.createNode(t,void 0,r),i=AU.createNode(e,void 0,r);return new yg(n,i)}var yg=class t{constructor(e,r=null){Object.defineProperty(this,gg.NODE_TYPE,{value:gg.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return gg.isNode(r)&&(r=r.clone(e)),gg.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Jce.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Kce.stringifyPair(this,e,r,n):JSON.stringify(this)}};bE.Pair=yg;bE.createPair=Yce});var SE=b(OU=>{"use strict";var Fs=Pe(),TU=ld(),_g=od();function Xce(t,e,r){return(e.inFlow??t.flow?ele:Qce)(t,e,r)}function Qce({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(v+=_g.lineComment(v,o,l(g))),d&&g&&(d=!1),f.push(n+v)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;m{R=!0});let E=To.foldFlowLines(`${_}${w}${p}`,l,To.FOLD_BLOCK,A);if(!R)return`>${x} +${l}${E}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} +${l}${_}${r}${p}`}function Lce(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` +`)||u&&/[[\]{},]/.test(o))return lc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?lc(o,e):ug(t,e,r,n);if(!a&&!u&&i!==Mn.Scalar.PLAIN&&o.includes(` +`))return ug(t,e,r,n);if(fg(o)){if(c==="")return e.forceBlockIndent=!0,ug(t,e,r,n);if(a&&c===l)return lc(o,e)}let d=o.replace(/\n+/g,`$& +${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return lc(o,e)}return a?d:To.foldFlowLines(d,c,To.FOLD_FLOW,dg(e,!1))}function Uce(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Mn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Mn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Mn.Scalar.BLOCK_FOLDED:case Mn.Scalar.BLOCK_LITERAL:return i||o?lc(s.value,e):ug(s,e,r,n);case Mn.Scalar.QUOTE_DOUBLE:return dd(s.value,e);case Mn.Scalar.QUOTE_SINGLE:return gE(s.value,e);case Mn.Scalar.PLAIN:return Lce(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}xU.stringifyString=Uce});var pd=v(_E=>{"use strict";var qce=ng(),Oo=Pe(),Bce=ld(),Hce=fd();function Zce(t,e){let r=Object.assign({blockQuote:!0,commentString:Bce.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function Gce(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Oo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function Vce(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Oo.isScalar(t)||Oo.isCollection(t))&&t.anchor;o&&qce.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function Wce(t,e,r,n){if(Oo.isPair(t))return t.toString(e,r,n);if(Oo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Oo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Gce(e.doc.schema.tags,o));let s=Vce(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Oo.isScalar(o)?Hce.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Oo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}_E.createStringifyContext=Zce;_E.stringify=Wce});var AU=v(EU=>{"use strict";var Gi=Pe(),$U=Pt(),kU=pd(),md=ld();function Kce({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=Gi.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Gi.isCollection(t)||!Gi.isNode(t)&&typeof t=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||Gi.isCollection(t)||(Gi.isScalar(t)?t.type===$U.Scalar.BLOCK_FOLDED||t.type===$U.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=kU.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=md.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=md.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=md.lineComment(g,r.indent,l(f))));let b,_,S;Gi.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&Gi.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&Gi.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=kU.stringify(e,r,()=>x=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` +`:"",_){let A=l(_);R+=` +${md.indentComment(A,r.indent)}`}w===""&&!r.inFlow?R===` +`&&S&&(R=` + +`):R+=` +${r.indent}`}else if(!p&&Gi.isCollection(e)){let A=w[0],E=w.indexOf(` +`),C=E!==-1,k=r.inFlow??e.flow??e.items.length===0;if(C||!k){let L=!1;if(C&&(A==="&"||A==="!")){let te=w.indexOf(" ");A==="&"&&te!==-1&&te{"use strict";var TU=Be("process");function Jce(t,...e){t==="debug"&&console.log(...e)}function Yce(t,e){(t==="debug"||t==="warn")&&(typeof TU.emitWarning=="function"?TU.emitWarning(e):console.warn(e))}bE.debug=Jce;bE.warn=Yce});var yg=v(gg=>{"use strict";var hg=Pe(),OU=Pt(),pg="<<",mg={identify:t=>t===pg||typeof t=="symbol"&&t.description===pg,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new OU.Scalar(Symbol(pg)),{addToJSMap:IU}),stringify:()=>pg},Xce=(t,e)=>(mg.identify(e)||hg.isScalar(e)&&(!e.type||e.type===OU.Scalar.PLAIN)&&mg.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===mg.tag&&r.default);function IU(t,e,r){let n=PU(t,r);if(hg.isSeq(n))for(let i of n.items)SE(t,e,i);else if(Array.isArray(n))for(let i of n)SE(t,e,i);else SE(t,e,n)}function SE(t,e,r){let n=PU(t,r);if(!hg.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function PU(t,e){return t&&hg.isAlias(e)?e.resolve(t.doc,t):e}gg.addMergeToJSMap=IU;gg.isMergeKey=Xce;gg.merge=mg});var xE=v(DU=>{"use strict";var Qce=vE(),RU=yg(),ele=pd(),CU=Pe(),wE=Eo();function tle(t,e,{key:r,value:n}){if(CU.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(RU.isMergeKey(t,r))RU.addMergeToJSMap(t,e,n);else{let i=wE.toJS(r,"",t);if(e instanceof Map)e.set(i,wE.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=rle(r,i,t),s=wE.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function rle(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(CU.isNode(t)&&r?.doc){let n=ele.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),Qce.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}DU.addPairToJSMap=tle});var Io=v($E=>{"use strict";var NU=cd(),nle=AU(),ile=xE(),_g=Pe();function ole(t,e,r){let n=NU.createNode(t,void 0,r),i=NU.createNode(e,void 0,r);return new bg(n,i)}var bg=class t{constructor(e,r=null){Object.defineProperty(this,_g.NODE_TYPE,{value:_g.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return _g.isNode(r)&&(r=r.clone(e)),_g.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return ile.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?nle.stringifyPair(this,e,r,n):JSON.stringify(this)}};$E.Pair=bg;$E.createPair=ole});var kE=v(MU=>{"use strict";var Us=Pe(),jU=pd(),vg=ld();function sle(t,e,r){return(e.inFlow??t.flow?cle:ale)(t,e,r)}function ale({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=vg.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;mg=null);l||(l=d.length>u||v.includes(` -`)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(v.length+2)>e.options.lineWidth)),l&&(v+=",")),g&&(v+=_g.lineComment(v,n,a(g))),d.push(v),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` +`+vg.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function cle({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;mg=null);l||(l=d.length>u||b.includes(` +`)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=vg.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` ${o}${i}${h}`:` `;return`${m} -${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function vg({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=_g.indentComment(e(n),t);r.push(o.trimStart())}}OU.stringifyCollection=Xce});var To=b(xE=>{"use strict";var tle=SE(),rle=vE(),nle=og(),Ao=Pe(),bg=Eo(),ile=It();function dd(t,e){let r=Ao.isScalar(e)?e.value:e;for(let n of t)if(Ao.isPair(n)&&(n.key===e||n.key===r||Ao.isScalar(n.key)&&n.key.value===r))return n}var wE=class extends nle.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ao.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(bg.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Ao.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new bg.Pair(e,e?.value):n=new bg.Pair(e.key,e.value);let i=dd(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Ao.isScalar(i.value)&&ile.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=dd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=dd(this.items,e)?.value;return(!r&&Ao.isScalar(i)?i.value:i)??void 0}has(e){return!!dd(this.items,e)}set(e,r){this.add(new bg.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)rle.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Ao.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),tle.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};xE.YAMLMap=wE;xE.findPair=dd});var sc=b(PU=>{"use strict";var ole=Pe(),IU=To(),sle={collection:"map",default:!0,nodeClass:IU.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ole.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>IU.YAMLMap.from(t,e,r)};PU.map=sle});var Oo=b(RU=>{"use strict";var ale=id(),cle=SE(),lle=og(),wg=Pe(),ule=It(),dle=wo(),$E=class extends lle.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(wg.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Sg(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Sg(e);if(typeof n!="number")return;let i=this.items[n];return!r&&wg.isScalar(i)?i.value:i}has(e){let r=Sg(e);return typeof r=="number"&&r=0?e:null}RU.YAMLSeq=$E});var ac=b(DU=>{"use strict";var fle=Pe(),CU=Oo(),ple={collection:"seq",default:!0,nodeClass:CU.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return fle.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>CU.YAMLSeq.from(t,e,r)};DU.seq=ple});var fd=b(NU=>{"use strict";var mle=cd(),hle={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),mle.stringifyString(t,e,r,n)}};NU.string=hle});var xg=b(FU=>{"use strict";var jU=It(),MU={identify:t=>t==null,createNode:()=>new jU.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new jU.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&MU.test.test(t)?t:e.options.nullStr};FU.nullTag=MU});var kE=b(LU=>{"use strict";var gle=It(),zU={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new gle.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&zU.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};LU.boolTag=zU});var cc=b(UU=>{"use strict";function yle({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}UU.stringifyNumber=yle});var AE=b($g=>{"use strict";var _le=It(),EE=cc(),vle={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:EE.stringifyNumber},ble={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():EE.stringifyNumber(t)}},Sle={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new _le.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:EE.stringifyNumber};$g.float=Sle;$g.floatExp=ble;$g.floatNaN=vle});var OE=b(Eg=>{"use strict";var qU=cc(),kg=t=>typeof t=="bigint"||Number.isInteger(t),TE=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function BU(t,e,r){let{value:n}=t;return kg(n)&&n>=0?r+n.toString(e):qU.stringifyNumber(t)}var wle={identify:t=>kg(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>TE(t,2,8,r),stringify:t=>BU(t,8,"0o")},xle={identify:kg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>TE(t,0,10,r),stringify:qU.stringifyNumber},$le={identify:t=>kg(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>TE(t,2,16,r),stringify:t=>BU(t,16,"0x")};Eg.int=xle;Eg.intHex=$le;Eg.intOct=wle});var ZU=b(HU=>{"use strict";var kle=sc(),Ele=xg(),Ale=ac(),Tle=fd(),Ole=kE(),IE=AE(),PE=OE(),Ile=[kle.map,Ale.seq,Tle.string,Ele.nullTag,Ole.boolTag,PE.intOct,PE.int,PE.intHex,IE.floatNaN,IE.floatExp,IE.float];HU.schema=Ile});var WU=b(VU=>{"use strict";var Ple=It(),Rle=sc(),Cle=ac();function GU(t){return typeof t=="bigint"||Number.isInteger(t)}var Ag=({value:t})=>JSON.stringify(t),Dle=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Ag},{identify:t=>t==null,createNode:()=>new Ple.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ag},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Ag},{identify:GU,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>GU(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Ag}],Nle={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},jle=[Rle.map,Cle.seq].concat(Dle,Nle);VU.schema=jle});var CE=b(KU=>{"use strict";var pd=Ue("buffer"),RE=It(),Mle=cd(),Fle={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof pd.Buffer=="function")return pd.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var Tg=Pe(),DE=Eo(),zle=It(),Lle=Oo();function JU(t,e){if(Tg.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new DE.Pair(new zle.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Sg({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=vg.indentComment(e(n),t);r.push(o.trimStart())}}MU.stringifyCollection=sle});var Ro=v(AE=>{"use strict";var lle=kE(),ule=xE(),dle=ag(),Po=Pe(),wg=Io(),fle=Pt();function hd(t,e){let r=Po.isScalar(e)?e.value:e;for(let n of t)if(Po.isPair(n)&&(n.key===e||n.key===r||Po.isScalar(n.key)&&n.key.value===r))return n}var EE=class extends dle.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Po.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(wg.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Po.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new wg.Pair(e,e?.value):n=new wg.Pair(e.key,e.value);let i=hd(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Po.isScalar(i.value)&&fle.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=hd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=hd(this.items,e)?.value;return(!r&&Po.isScalar(i)?i.value:i)??void 0}has(e){return!!hd(this.items,e)}set(e,r){this.add(new wg.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)ule.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Po.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),lle.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};AE.YAMLMap=EE;AE.findPair=hd});var uc=v(zU=>{"use strict";var ple=Pe(),FU=Ro(),mle={collection:"map",default:!0,nodeClass:FU.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ple.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>FU.YAMLMap.from(t,e,r)};zU.map=mle});var Co=v(LU=>{"use strict";var hle=cd(),gle=kE(),yle=ag(),$g=Pe(),_le=Pt(),ble=Eo(),TE=class extends yle.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super($g.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=xg(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=xg(e);if(typeof n!="number")return;let i=this.items[n];return!r&&$g.isScalar(i)?i.value:i}has(e){let r=xg(e);return typeof r=="number"&&r=0?e:null}LU.YAMLSeq=TE});var dc=v(qU=>{"use strict";var vle=Pe(),UU=Co(),Sle={collection:"seq",default:!0,nodeClass:UU.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return vle.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>UU.YAMLSeq.from(t,e,r)};qU.seq=Sle});var gd=v(BU=>{"use strict";var wle=fd(),xle={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),wle.stringifyString(t,e,r,n)}};BU.string=xle});var kg=v(GU=>{"use strict";var HU=Pt(),ZU={identify:t=>t==null,createNode:()=>new HU.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new HU.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&ZU.test.test(t)?t:e.options.nullStr};GU.nullTag=ZU});var OE=v(WU=>{"use strict";var $le=Pt(),VU={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new $le.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&VU.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};WU.boolTag=VU});var fc=v(KU=>{"use strict";function kle({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}KU.stringifyNumber=kle});var PE=v(Eg=>{"use strict";var Ele=Pt(),IE=fc(),Ale={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:IE.stringifyNumber},Tle={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():IE.stringifyNumber(t)}},Ole={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Ele.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:IE.stringifyNumber};Eg.float=Ole;Eg.floatExp=Tle;Eg.floatNaN=Ale});var CE=v(Tg=>{"use strict";var JU=fc(),Ag=t=>typeof t=="bigint"||Number.isInteger(t),RE=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function YU(t,e,r){let{value:n}=t;return Ag(n)&&n>=0?r+n.toString(e):JU.stringifyNumber(t)}var Ile={identify:t=>Ag(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>RE(t,2,8,r),stringify:t=>YU(t,8,"0o")},Ple={identify:Ag,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>RE(t,0,10,r),stringify:JU.stringifyNumber},Rle={identify:t=>Ag(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>RE(t,2,16,r),stringify:t=>YU(t,16,"0x")};Tg.int=Ple;Tg.intHex=Rle;Tg.intOct=Ile});var QU=v(XU=>{"use strict";var Cle=uc(),Dle=kg(),Nle=dc(),jle=gd(),Mle=OE(),DE=PE(),NE=CE(),Fle=[Cle.map,Nle.seq,jle.string,Dle.nullTag,Mle.boolTag,NE.intOct,NE.int,NE.intHex,DE.floatNaN,DE.floatExp,DE.float];XU.schema=Fle});var rq=v(tq=>{"use strict";var zle=Pt(),Lle=uc(),Ule=dc();function eq(t){return typeof t=="bigint"||Number.isInteger(t)}var Og=({value:t})=>JSON.stringify(t),qle=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Og},{identify:t=>t==null,createNode:()=>new zle.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Og},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Og},{identify:eq,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>eq(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Og}],Ble={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Hle=[Lle.map,Ule.seq].concat(qle,Ble);tq.schema=Hle});var ME=v(nq=>{"use strict";var yd=Be("buffer"),jE=Pt(),Zle=fd(),Gle={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof yd.Buffer=="function")return yd.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var Ig=Pe(),FE=Io(),Vle=Pt(),Wle=Co();function iq(t,e){if(Ig.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new FE.Pair(new Vle.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} ${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment} -${o.comment}`:n.comment}n=i}t.items[r]=Tg.isPair(n)?n:new DE.Pair(n)}}else e("Expected a sequence for this tag");return t}function YU(t,e,r){let{replacer:n}=r,i=new Lle.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(DE.createPair(a,c,r))}return i}var Ule={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:JU,createNode:YU};Og.createPairs=YU;Og.pairs=Ule;Og.resolvePairs=JU});var ME=b(jE=>{"use strict";var XU=Pe(),NE=wo(),md=To(),qle=Oo(),QU=Ig(),zs=class t extends qle.YAMLSeq{constructor(){super(),this.add=md.YAMLMap.prototype.add.bind(this),this.delete=md.YAMLMap.prototype.delete.bind(this),this.get=md.YAMLMap.prototype.get.bind(this),this.has=md.YAMLMap.prototype.has.bind(this),this.set=md.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(XU.isPair(i)?(o=NE.toJS(i.key,"",r),s=NE.toJS(i.value,o,r)):o=NE.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=QU.createPairs(e,r,n),o=new this;return o.items=i.items,o}};zs.tag="tag:yaml.org,2002:omap";var Ble={collection:"seq",identify:t=>t instanceof Map,nodeClass:zs,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=QU.resolvePairs(t,e),n=[];for(let{key:i}of r.items)XU.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new zs,r)},createNode:(t,e,r)=>zs.from(t,e,r)};jE.YAMLOMap=zs;jE.omap=Ble});var iq=b(FE=>{"use strict";var eq=It();function tq({value:t,source:e},r){return e&&(t?rq:nq).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var rq={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new eq.Scalar(!0),stringify:tq},nq={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new eq.Scalar(!1),stringify:tq};FE.falseTag=nq;FE.trueTag=rq});var oq=b(Pg=>{"use strict";var Hle=It(),zE=cc(),Zle={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:zE.stringifyNumber},Gle={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():zE.stringifyNumber(t)}},Vle={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Hle.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:zE.stringifyNumber};Pg.float=Vle;Pg.floatExp=Gle;Pg.floatNaN=Zle});var aq=b(gd=>{"use strict";var sq=cc(),hd=t=>typeof t=="bigint"||Number.isInteger(t);function Rg(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function LE(t,e,r){let{value:n}=t;if(hd(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return sq.stringifyNumber(t)}var Wle={identify:hd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Rg(t,2,2,r),stringify:t=>LE(t,2,"0b")},Kle={identify:hd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Rg(t,1,8,r),stringify:t=>LE(t,8,"0")},Jle={identify:hd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Rg(t,0,10,r),stringify:sq.stringifyNumber},Yle={identify:hd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Rg(t,2,16,r),stringify:t=>LE(t,16,"0x")};gd.int=Jle;gd.intBin=Wle;gd.intHex=Yle;gd.intOct=Kle});var qE=b(UE=>{"use strict";var Ng=Pe(),Cg=Eo(),Dg=To(),Ls=class t extends Dg.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Ng.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Cg.Pair(e.key,null):r=new Cg.Pair(e,null),Dg.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Dg.findPair(this.items,e);return!r&&Ng.isPair(n)?Ng.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=Dg.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Cg.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(Cg.createPair(s,null,n));return o}};Ls.tag="tag:yaml.org,2002:set";var Xle={collection:"map",identify:t=>t instanceof Set,nodeClass:Ls,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Ls.from(t,e,r),resolve(t,e){if(Ng.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ls,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};UE.YAMLSet=Ls;UE.set=Xle});var HE=b(jg=>{"use strict";var Qle=cc();function BE(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function cq(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Qle.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var eue={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>BE(t,r),stringify:cq},tue={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>BE(t,!1),stringify:cq},lq={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(lq.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=BE(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};jg.floatTime=tue;jg.intTime=eue;jg.timestamp=lq});var fq=b(dq=>{"use strict";var rue=sc(),nue=xg(),iue=ac(),oue=fd(),sue=CE(),uq=iq(),ZE=oq(),Mg=aq(),aue=hg(),cue=ME(),lue=Ig(),uue=qE(),GE=HE(),due=[rue.map,iue.seq,oue.string,nue.nullTag,uq.trueTag,uq.falseTag,Mg.intBin,Mg.intOct,Mg.int,Mg.intHex,ZE.floatNaN,ZE.floatExp,ZE.float,sue.binary,aue.merge,cue.omap,lue.pairs,uue.set,GE.intTime,GE.floatTime,GE.timestamp];dq.schema=due});var wq=b(KE=>{"use strict";var gq=sc(),fue=xg(),yq=ac(),pue=fd(),mue=kE(),VE=AE(),WE=OE(),hue=ZU(),gue=WU(),_q=CE(),yd=hg(),vq=ME(),bq=Ig(),pq=fq(),Sq=qE(),Fg=HE(),mq=new Map([["core",hue.schema],["failsafe",[gq.map,yq.seq,pue.string]],["json",gue.schema],["yaml11",pq.schema],["yaml-1.1",pq.schema]]),hq={binary:_q.binary,bool:mue.boolTag,float:VE.float,floatExp:VE.floatExp,floatNaN:VE.floatNaN,floatTime:Fg.floatTime,int:WE.int,intHex:WE.intHex,intOct:WE.intOct,intTime:Fg.intTime,map:gq.map,merge:yd.merge,null:fue.nullTag,omap:vq.omap,pairs:bq.pairs,seq:yq.seq,set:Sq.set,timestamp:Fg.timestamp},yue={"tag:yaml.org,2002:binary":_q.binary,"tag:yaml.org,2002:merge":yd.merge,"tag:yaml.org,2002:omap":vq.omap,"tag:yaml.org,2002:pairs":bq.pairs,"tag:yaml.org,2002:set":Sq.set,"tag:yaml.org,2002:timestamp":Fg.timestamp};function _ue(t,e,r){let n=mq.get(e);if(n&&!t)return r&&!n.includes(yd.merge)?n.concat(yd.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(mq.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(yd.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?hq[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(hq).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}KE.coreKnownTags=yue;KE.getTags=_ue});var XE=b(xq=>{"use strict";var JE=Pe(),vue=sc(),bue=ac(),Sue=fd(),zg=wq(),wue=(t,e)=>t.keye.key?1:0,YE=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?zg.getTags(e,"compat"):e?zg.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?zg.coreKnownTags:{},this.tags=zg.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,JE.MAP,{value:vue.map}),Object.defineProperty(this,JE.SCALAR,{value:Sue.string}),Object.defineProperty(this,JE.SEQ,{value:bue.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?wue:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};xq.Schema=YE});var kq=b($q=>{"use strict";var xue=Pe(),QE=ld(),_d=od();function $ue(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=QE.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(_d.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(xue.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(_d.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=QE.stringify(t.contents,i,()=>a=null,c);a&&(l+=_d.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(QE.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(_d.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(_d.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=Ig.isPair(n)?n:new FE.Pair(n)}}else e("Expected a sequence for this tag");return t}function oq(t,e,r){let{replacer:n}=r,i=new Wle.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(FE.createPair(a,c,r))}return i}var Kle={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:iq,createNode:oq};Pg.createPairs=oq;Pg.pairs=Kle;Pg.resolvePairs=iq});var UE=v(LE=>{"use strict";var sq=Pe(),zE=Eo(),_d=Ro(),Jle=Co(),aq=Rg(),qs=class t extends Jle.YAMLSeq{constructor(){super(),this.add=_d.YAMLMap.prototype.add.bind(this),this.delete=_d.YAMLMap.prototype.delete.bind(this),this.get=_d.YAMLMap.prototype.get.bind(this),this.has=_d.YAMLMap.prototype.has.bind(this),this.set=_d.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(sq.isPair(i)?(o=zE.toJS(i.key,"",r),s=zE.toJS(i.value,o,r)):o=zE.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=aq.createPairs(e,r,n),o=new this;return o.items=i.items,o}};qs.tag="tag:yaml.org,2002:omap";var Yle={collection:"seq",identify:t=>t instanceof Map,nodeClass:qs,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=aq.resolvePairs(t,e),n=[];for(let{key:i}of r.items)sq.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new qs,r)},createNode:(t,e,r)=>qs.from(t,e,r)};LE.YAMLOMap=qs;LE.omap=Yle});var fq=v(qE=>{"use strict";var cq=Pt();function lq({value:t,source:e},r){return e&&(t?uq:dq).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var uq={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new cq.Scalar(!0),stringify:lq},dq={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new cq.Scalar(!1),stringify:lq};qE.falseTag=dq;qE.trueTag=uq});var pq=v(Cg=>{"use strict";var Xle=Pt(),BE=fc(),Qle={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:BE.stringifyNumber},eue={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():BE.stringifyNumber(t)}},tue={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Xle.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:BE.stringifyNumber};Cg.float=tue;Cg.floatExp=eue;Cg.floatNaN=Qle});var hq=v(vd=>{"use strict";var mq=fc(),bd=t=>typeof t=="bigint"||Number.isInteger(t);function Dg(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function HE(t,e,r){let{value:n}=t;if(bd(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return mq.stringifyNumber(t)}var rue={identify:bd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Dg(t,2,2,r),stringify:t=>HE(t,2,"0b")},nue={identify:bd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Dg(t,1,8,r),stringify:t=>HE(t,8,"0")},iue={identify:bd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Dg(t,0,10,r),stringify:mq.stringifyNumber},oue={identify:bd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Dg(t,2,16,r),stringify:t=>HE(t,16,"0x")};vd.int=iue;vd.intBin=rue;vd.intHex=oue;vd.intOct=nue});var GE=v(ZE=>{"use strict";var Mg=Pe(),Ng=Io(),jg=Ro(),Bs=class t extends jg.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Mg.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Ng.Pair(e.key,null):r=new Ng.Pair(e,null),jg.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=jg.findPair(this.items,e);return!r&&Mg.isPair(n)?Mg.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=jg.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Ng.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(Ng.createPair(s,null,n));return o}};Bs.tag="tag:yaml.org,2002:set";var sue={collection:"map",identify:t=>t instanceof Set,nodeClass:Bs,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Bs.from(t,e,r),resolve(t,e){if(Mg.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Bs,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};ZE.YAMLSet=Bs;ZE.set=sue});var WE=v(Fg=>{"use strict";var aue=fc();function VE(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function gq(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return aue.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var cue={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>VE(t,r),stringify:gq},lue={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>VE(t,!1),stringify:gq},yq={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(yq.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=VE(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Fg.floatTime=lue;Fg.intTime=cue;Fg.timestamp=yq});var vq=v(bq=>{"use strict";var uue=uc(),due=kg(),fue=dc(),pue=gd(),mue=ME(),_q=fq(),KE=pq(),zg=hq(),hue=yg(),gue=UE(),yue=Rg(),_ue=GE(),JE=WE(),bue=[uue.map,fue.seq,pue.string,due.nullTag,_q.trueTag,_q.falseTag,zg.intBin,zg.intOct,zg.int,zg.intHex,KE.floatNaN,KE.floatExp,KE.float,mue.binary,hue.merge,gue.omap,yue.pairs,_ue.set,JE.intTime,JE.floatTime,JE.timestamp];bq.schema=bue});var Iq=v(QE=>{"use strict";var $q=uc(),vue=kg(),kq=dc(),Sue=gd(),wue=OE(),YE=PE(),XE=CE(),xue=QU(),$ue=rq(),Eq=ME(),Sd=yg(),Aq=UE(),Tq=Rg(),Sq=vq(),Oq=GE(),Lg=WE(),wq=new Map([["core",xue.schema],["failsafe",[$q.map,kq.seq,Sue.string]],["json",$ue.schema],["yaml11",Sq.schema],["yaml-1.1",Sq.schema]]),xq={binary:Eq.binary,bool:wue.boolTag,float:YE.float,floatExp:YE.floatExp,floatNaN:YE.floatNaN,floatTime:Lg.floatTime,int:XE.int,intHex:XE.intHex,intOct:XE.intOct,intTime:Lg.intTime,map:$q.map,merge:Sd.merge,null:vue.nullTag,omap:Aq.omap,pairs:Tq.pairs,seq:kq.seq,set:Oq.set,timestamp:Lg.timestamp},kue={"tag:yaml.org,2002:binary":Eq.binary,"tag:yaml.org,2002:merge":Sd.merge,"tag:yaml.org,2002:omap":Aq.omap,"tag:yaml.org,2002:pairs":Tq.pairs,"tag:yaml.org,2002:set":Oq.set,"tag:yaml.org,2002:timestamp":Lg.timestamp};function Eue(t,e,r){let n=wq.get(e);if(n&&!t)return r&&!n.includes(Sd.merge)?n.concat(Sd.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(wq.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Sd.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?xq[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(xq).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}QE.coreKnownTags=kue;QE.getTags=Eue});var rA=v(Pq=>{"use strict";var eA=Pe(),Aue=uc(),Tue=dc(),Oue=gd(),Ug=Iq(),Iue=(t,e)=>t.keye.key?1:0,tA=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Ug.getTags(e,"compat"):e?Ug.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Ug.coreKnownTags:{},this.tags=Ug.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,eA.MAP,{value:Aue.map}),Object.defineProperty(this,eA.SCALAR,{value:Oue.string}),Object.defineProperty(this,eA.SEQ,{value:Tue.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Iue:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Pq.Schema=tA});var Cq=v(Rq=>{"use strict";var Pue=Pe(),nA=pd(),wd=ld();function Rue(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=nA.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(wd.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Pue.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(wd.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=nA.stringify(t.contents,i,()=>a=null,c);a&&(l+=wd.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(nA.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(wd.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(wd.indentComment(o(c),"")))}return r.join(` `)+` -`}$q.stringifyDocument=$ue});var vd=b(Eq=>{"use strict";var kue=nd(),lc=og(),dn=Pe(),Eue=Eo(),Aue=wo(),Tue=XE(),Oue=kq(),eA=tg(),Iue=iE(),Pue=id(),tA=nE(),rA=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,dn.NODE_TYPE,{value:dn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new tA.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[dn.NODE_TYPE]:{value:dn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=dn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){uc(this.contents)&&this.contents.add(e)}addIn(e,r){uc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=eA.anchorNames(this);e.anchor=!r||n.has(r)?eA.findNewAnchor(r||"a",n):r}return new kue.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,v=r.filter(g).map(String);v.length>0&&(r=r.concat(v)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=eA.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Pue.createNode(e,u,m);return a&&dn.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Eue.Pair(i,o)}delete(e){return uc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return lc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):uc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return dn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return lc.isEmptyPath(e)?!r&&dn.isScalar(this.contents)?this.contents.value:this.contents:dn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return dn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return lc.isEmptyPath(e)?this.contents!==void 0:dn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=lc.collectionFromPath(this.schema,[e],r):uc(this.contents)&&this.contents.set(e,r)}setIn(e,r){lc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=lc.collectionFromPath(this.schema,Array.from(e),r):uc(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new tA.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new tA.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new Tue.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Aue.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?Iue.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Oue.stringifyDocument(this,e)}};function uc(t){if(dn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Eq.Document=rA});var wd=b(Sd=>{"use strict";var bd=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},nA=class extends bd{constructor(e,r,n){super("YAMLParseError",e,r,n)}},iA=class extends bd{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Rue=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 +`}Rq.stringifyDocument=Rue});var xd=v(Dq=>{"use strict";var Cue=ad(),pc=ag(),pn=Pe(),Due=Io(),Nue=Eo(),jue=rA(),Mue=Cq(),iA=ng(),Fue=cE(),zue=cd(),oA=aE(),sA=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,pn.NODE_TYPE,{value:pn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new oA.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[pn.NODE_TYPE]:{value:pn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=pn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){mc(this.contents)&&this.contents.add(e)}addIn(e,r){mc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=iA.anchorNames(this);e.anchor=!r||n.has(r)?iA.findNewAnchor(r||"a",n):r}return new Cue.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=iA.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=zue.createNode(e,u,m);return a&&pn.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Due.Pair(i,o)}delete(e){return mc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return pc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):mc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return pn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return pc.isEmptyPath(e)?!r&&pn.isScalar(this.contents)?this.contents.value:this.contents:pn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return pn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return pc.isEmptyPath(e)?this.contents!==void 0:pn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=pc.collectionFromPath(this.schema,[e],r):mc(this.contents)&&this.contents.set(e,r)}setIn(e,r){pc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=pc.collectionFromPath(this.schema,Array.from(e),r):mc(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new oA.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new oA.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new jue.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Nue.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?Fue.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Mue.stringifyDocument(this,e)}};function mc(t){if(pn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Dq.Document=sA});var Ed=v(kd=>{"use strict";var $d=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},aA=class extends $d{constructor(e,r,n){super("YAMLParseError",e,r,n)}},cA=class extends $d{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Lue=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`: ${s} ${l} -`}};Sd.YAMLError=bd;Sd.YAMLParseError=nA;Sd.YAMLWarning=iA;Sd.prettifyError=Rue});var xd=b(Aq=>{"use strict";function Cue(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,v=null,_=null,S=null,w=null,x=null;for(let k of t)switch(m&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&o(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&k.type!=="comment"&&k.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),k.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&k.source.includes(" ")&&(h=k),u=!0;break;case"comment":{u||o(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=k.source.substring(1)||" ";d?d+=f+C:d=C,f="",l=!1;break}case"newline":l?d?d+=k.source:(!w||r!=="seq-item-ind")&&(c=!0):f+=k.source,l=!0,p=!0,(g||v)&&(_=k),u=!0;break;case"anchor":g&&o(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&o(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=k,x??(x=k.offset),l=!1,u=!1,m=!0;break;case"tag":{v&&o(k,"MULTIPLE_TAGS","A node can have at most one tag"),v=k,x??(x=k.offset),l=!1,u=!1,m=!0;break}case r:(g||v)&&o(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),w&&o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),w=k,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=k,l=!1,u=!1;break}default:o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),l=!1,u=!1}let I=t[t.length-1],T=I?I.offset+I.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:w,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:v,newlineAfterProp:_,end:T,start:x??T}}Aq.resolveProps=Cue});var Lg=b(Tq=>{"use strict";function oA(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` -`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(oA(e.key)||oA(e.value))return!0}return!1;default:return!0}}Tq.containsNewline=oA});var sA=b(Oq=>{"use strict";var Due=Lg();function Nue(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Due.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Oq.flowIndentCheck=Nue});var aA=b(Pq=>{"use strict";var Iq=Pe();function jue(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||Iq.isScalar(o)&&Iq.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}Pq.mapIncludes=jue});var Mq=b(jq=>{"use strict";var Rq=Eo(),Mue=To(),Cq=xd(),Fue=Lg(),Dq=sA(),zue=aA(),Nq="All mapping items must start at the same column";function Lue({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Mue.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=Cq.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",Nq)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Fue.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",Nq);r.atKey=!0;let v=h.end,_=f?t(r,f,h,i):e(r,v,d,null,h,i);r.schema.compat&&Dq.flowIndentCheck(n.indent,f,i),r.atKey=!1,zue.mapIncludes(r,a.items,_)&&i(v,"DUPLICATE_KEY","Map keys must be unique");let S=Cq.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var Uue=Oo(),que=xd(),Bue=sA();function Hue({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Uue.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=que.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&Bue.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}Fq.resolveBlockSeq=Hue});var dc=b(Lq=>{"use strict";function Zue(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}Lq.resolveEnd=Zue});var Hq=b(Bq=>{"use strict";var Gue=Pe(),Vue=Eo(),Uq=To(),Wue=Oo(),Kue=dc(),qq=xd(),Jue=Lg(),Yue=aA(),cA="Block collections are not allowed within flow collections",lA=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Xue({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Uq.YAMLMap:Wue.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=Kue.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` -`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}Bq.resolveFlowCollection=Xue});var Gq=b(Zq=>{"use strict";var Que=Pe(),ede=It(),tde=To(),rde=Oo(),nde=Mq(),ide=zq(),ode=Hq();function uA(t,e,r,n,i,o){let s=r.type==="block-map"?nde.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?ide.resolveBlockSeq(t,e,r,n,o):ode.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function sde(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),uA(t,e,r,i,s)}let l=uA(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Que.isNode(u)?u:new ede.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}Zq.composeCollection=sde});var fA=b(Vq=>{"use strict";var dA=It();function ade(t,e,r){let n=e.offset,i=cde(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?dA.Scalar.BLOCK_FOLDED:dA.Scalar.BLOCK_LITERAL,s=e.source?lde(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` -`.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||v[0]===" "?(f===" "?f=` +`}};kd.YAMLError=$d;kd.YAMLParseError=aA;kd.YAMLWarning=cA;kd.prettifyError=Lue});var Ad=v(Nq=>{"use strict";function Uue(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let E of t)switch(m&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&o(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&E.type!=="comment"&&E.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),E.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&E.source.includes(" ")&&(h=E),u=!0;break;case"comment":{u||o(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=E.source.substring(1)||" ";d?d+=f+C:d=C,f="",l=!1;break}case"newline":l?d?d+=E.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=E.source,l=!0,p=!0,(g||b)&&(_=E),u=!0;break;case"anchor":g&&o(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&o(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=E,w??(w=E.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(E,"MULTIPLE_TAGS","A node can have at most one tag"),b=E,w??(w=E.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),x&&o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),x=E,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=E,l=!1,u=!1;break}default:o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),l=!1,u=!1}let R=t[t.length-1],A=R?R.offset+R.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:A,start:w??A}}Nq.resolveProps=Uue});var qg=v(jq=>{"use strict";function lA(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` +`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(lA(e.key)||lA(e.value))return!0}return!1;default:return!0}}jq.containsNewline=lA});var uA=v(Mq=>{"use strict";var que=qg();function Bue(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&que.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Mq.flowIndentCheck=Bue});var dA=v(zq=>{"use strict";var Fq=Pe();function Hue(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||Fq.isScalar(o)&&Fq.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}zq.mapIncludes=Hue});var Zq=v(Hq=>{"use strict";var Lq=Io(),Zue=Ro(),Uq=Ad(),Gue=qg(),qq=uA(),Vue=dA(),Bq="All mapping items must start at the same column";function Wue({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Zue.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=Uq.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",Bq)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Gue.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",Bq);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&qq.flowIndentCheck(n.indent,f,i),r.atKey=!1,Vue.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=Uq.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var Kue=Co(),Jue=Ad(),Yue=uA();function Xue({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Kue.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=Jue.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&Yue.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}Gq.resolveBlockSeq=Xue});var hc=v(Wq=>{"use strict";function Que(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}Wq.resolveEnd=Que});var Xq=v(Yq=>{"use strict";var ede=Pe(),tde=Io(),Kq=Ro(),rde=Co(),nde=hc(),Jq=Ad(),ide=qg(),ode=dA(),fA="Block collections are not allowed within flow collections",pA=t=>t&&(t.type==="block-map"||t.type==="block-seq");function sde({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Kq.YAMLMap:rde.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=nde.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` +`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}Yq.resolveFlowCollection=sde});var e4=v(Qq=>{"use strict";var ade=Pe(),cde=Pt(),lde=Ro(),ude=Co(),dde=Zq(),fde=Vq(),pde=Xq();function mA(t,e,r,n,i,o){let s=r.type==="block-map"?dde.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?fde.resolveBlockSeq(t,e,r,n,o):pde.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function mde(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),mA(t,e,r,i,s)}let l=mA(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=ade.isNode(u)?u:new cde.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}Qq.composeCollection=mde});var gA=v(t4=>{"use strict";var hA=Pt();function hde(t,e,r){let n=e.offset,i=gde(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?hA.Scalar.BLOCK_FOLDED:hA.Scalar.BLOCK_LITERAL,s=e.source?yde(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` +`.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` `:!p&&f===` `&&(f=` -`),d+=f+g.slice(c)+v,f=` -`,p=!0):v===""?f===` +`),d+=f+g.slice(c)+b,f=` +`,p=!0):b===""?f===` `?d+=` `:f=` -`:(d+=f+v,f=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let h=a;h{"use strict";var pA=It(),ude=dc();function dde(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=pA.Scalar.PLAIN,c=fde(o,l);break;case"single-quoted-scalar":a=pA.Scalar.QUOTE_SINGLE,c=pde(o,l);break;case"double-quoted-scalar":a=pA.Scalar.QUOTE_DOUBLE,c=mde(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=ude.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function fde(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),Wq(t)}function pde(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Wq(t.slice(1,-1)).replace(/''/g,"'")}function Wq(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var yA=Pt(),_de=hc();function bde(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=yA.Scalar.PLAIN,c=vde(o,l);break;case"single-quoted-scalar":a=yA.Scalar.QUOTE_SINGLE,c=Sde(o,l);break;case"double-quoted-scalar":a=yA.Scalar.QUOTE_DOUBLE,c=wde(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=_de.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function vde(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),r4(t)}function Sde(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),r4(t.slice(1,-1)).replace(/''/g,"'")}function r4(t){let e,r;try{e=new RegExp(`(.*?)(?o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function hde(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` +`)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function xde(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` `||n==="\r")&&!(n==="\r"&&t[e+2]!==` `);)n===` `&&(r+=` -`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var gde={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function yde(t,e,r,n){let i=t.substr(e,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Kq.resolveFlowScalar=dde});var Xq=b(Yq=>{"use strict";var Us=Pe(),Jq=It(),_de=fA(),vde=mA();function bde(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?_de.resolveBlockScalar(t,e,n):vde.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Us.SCALAR]:c?l=Sde(t.schema,i,c,r,n):e.type==="scalar"?l=wde(t,i,e,n):l=t.schema[Us.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=Us.isScalar(d)?d:new Jq.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new Jq.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Sde(t,e,r,n,i){if(r==="!")return t[Us.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[Us.SCALAR])}function wde({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[Us.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[Us.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}Yq.composeScalar=bde});var e4=b(Qq=>{"use strict";function xde(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}Qq.emptyScalarPosition=xde});var n4=b(gA=>{"use strict";var $de=nd(),kde=Pe(),Ede=Gq(),t4=Xq(),Ade=dc(),Tde=e4(),Ode={composeNode:r4,composeEmptyNode:hA};function r4(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=Ide(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=t4.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Ede.composeCollection(Ode,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=hA(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!kde.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function hA(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Tde.emptyScalarPosition(e,r,n),indent:-1,source:""},d=t4.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function Ide({options:t},{offset:e,source:r,end:n},i){let o=new $de.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Ade.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}gA.composeEmptyNode=hA;gA.composeNode=r4});var s4=b(o4=>{"use strict";var Pde=vd(),i4=n4(),Rde=dc(),Cde=xd();function Dde(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Pde.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Cde.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?i4.composeNode(l,i,u,s):i4.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Rde.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}o4.composeDoc=Dde});var _A=b(l4=>{"use strict";var Nde=Ue("process"),jde=nE(),Mde=vd(),$d=wd(),a4=Pe(),Fde=s4(),zde=dc();function kd(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function c4(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var Hs=Pe(),i4=Pt(),Ede=gA(),Ade=_A();function Tde(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Ede.resolveBlockScalar(t,e,n):Ade.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Hs.SCALAR]:c?l=Ode(t.schema,i,c,r,n):e.type==="scalar"?l=Ide(t,i,e,n):l=t.schema[Hs.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=Hs.isScalar(d)?d:new i4.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new i4.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Ode(t,e,r,n,i){if(r==="!")return t[Hs.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[Hs.SCALAR])}function Ide({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[Hs.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[Hs.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}o4.composeScalar=Tde});var c4=v(a4=>{"use strict";function Pde(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}a4.emptyScalarPosition=Pde});var d4=v(vA=>{"use strict";var Rde=ad(),Cde=Pe(),Dde=e4(),l4=s4(),Nde=hc(),jde=c4(),Mde={composeNode:u4,composeEmptyNode:bA};function u4(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=Fde(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=l4.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Dde.composeCollection(Mde,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=bA(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Cde.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function bA(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:jde.emptyScalarPosition(e,r,n),indent:-1,source:""},d=l4.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function Fde({options:t},{offset:e,source:r,end:n},i){let o=new Rde.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Nde.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}vA.composeEmptyNode=bA;vA.composeNode=u4});var m4=v(p4=>{"use strict";var zde=xd(),f4=d4(),Lde=hc(),Ude=Ad();function qde(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new zde.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Ude.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?f4.composeNode(l,i,u,s):f4.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Lde.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}p4.composeDoc=qde});var wA=v(y4=>{"use strict";var Bde=Be("process"),Hde=aE(),Zde=xd(),Td=Ed(),h4=Pe(),Gde=m4(),Vde=hc();function Od(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function g4(t){let e="",r=!1,n=!1;for(let i=0;i{let s=kd(r);o?this.warnings.push(new $d.YAMLWarning(s,n,i)):this.errors.push(new $d.YAMLParseError(s,n,i))},this.directives=new jde.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=c4(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} -${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(a4.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];a4.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} +`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var SA=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=Od(r);o?this.warnings.push(new Td.YAMLWarning(s,n,i)):this.errors.push(new Td.YAMLParseError(s,n,i))},this.directives=new Hde.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=g4(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} +${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(h4.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];h4.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} ${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n} -${s}`:n}}if(r){for(let o=0;o{let o=kd(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Fde.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new $d.YAMLParseError(kd(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new $d.YAMLParseError(kd(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=zde.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} -${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new $d.YAMLParseError(kd(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new Mde.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};l4.Composer=yA});var f4=b(Ug=>{"use strict";var Lde=fA(),Ude=mA(),qde=wd(),u4=cd();function Bde(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new qde.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ude.resolveFlowScalar(t,e,n);case"block-scalar":return Lde.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Hde(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=u4.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` +${s}`:n}}if(r){for(let o=0;o{let o=Od(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Gde.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Td.YAMLParseError(Od(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Td.YAMLParseError(Od(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Vde.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} +${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Td.YAMLParseError(Od(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new Zde.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};y4.Composer=SA});var v4=v(Bg=>{"use strict";var Wde=gA(),Kde=_A(),Jde=Ed(),_4=fd();function Yde(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new Jde.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Kde.resolveFlowScalar(t,e,n);case"block-scalar":return Wde.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Xde(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=_4.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` `}];switch(a[0]){case"|":case">":{let l=a.indexOf(` `),u=a.substring(0,l),d=a.substring(l+1)+` -`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return d4(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` -`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function Zde(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=u4.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Gde(t,c);break;case'"':vA(t,c,"double-quoted-scalar");break;case"'":vA(t,c,"single-quoted-scalar");break;default:vA(t,c,"scalar")}}function Gde(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return b4(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` +`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function Qde(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=_4.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":efe(t,c);break;case'"':xA(t,c,"double-quoted-scalar");break;case"'":xA(t,c,"single-quoted-scalar");break;default:xA(t,c,"scalar")}}function efe(t,e){let r=e.indexOf(` `),n=e.substring(0,r),i=e.substring(r+1)+` -`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];d4(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` -`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function d4(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function vA(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` -`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}Ug.createScalarToken=Hde;Ug.resolveAsScalar=Bde;Ug.setScalarValue=Zde});var m4=b(p4=>{"use strict";var Vde=t=>"type"in t?Bg(t):qg(t);function Bg(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Bg(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=qg(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=qg(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=qg(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function qg({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Bg(e)),r)for(let o of r)i+=o.source;return n&&(i+=Bg(n)),i}p4.stringify=Vde});var _4=b(y4=>{"use strict";var bA=Symbol("break visit"),Wde=Symbol("skip children"),h4=Symbol("remove item");function qs(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),g4(Object.freeze([]),t,e)}qs.BREAK=bA;qs.SKIP=Wde;qs.REMOVE=h4;qs.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};qs.parentCollection=(t,e)=>{let r=qs.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function g4(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var SA=f4(),Kde=m4(),Jde=_4(),wA="\uFEFF",xA="",$A="",kA="",Yde=t=>!!t&&"items"in t,Xde=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Qde(t){switch(t){case wA:return"";case xA:return"";case $A:return"";case kA:return"";default:return JSON.stringify(t)}}function efe(t){switch(t){case wA:return"byte-order-mark";case xA:return"doc-mode";case $A:return"flow-error-end";case kA:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];b4(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` +`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function b4(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function xA(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` +`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}Bg.createScalarToken=Xde;Bg.resolveAsScalar=Yde;Bg.setScalarValue=Qde});var w4=v(S4=>{"use strict";var tfe=t=>"type"in t?Zg(t):Hg(t);function Zg(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Zg(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Hg(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Hg(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Hg(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function Hg({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Zg(e)),r)for(let o of r)i+=o.source;return n&&(i+=Zg(n)),i}S4.stringify=tfe});var E4=v(k4=>{"use strict";var $A=Symbol("break visit"),rfe=Symbol("skip children"),x4=Symbol("remove item");function Zs(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),$4(Object.freeze([]),t,e)}Zs.BREAK=$A;Zs.SKIP=rfe;Zs.REMOVE=x4;Zs.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};Zs.parentCollection=(t,e)=>{let r=Zs.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function $4(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var kA=v4(),nfe=w4(),ife=E4(),EA="\uFEFF",AA="",TA="",OA="",ofe=t=>!!t&&"items"in t,sfe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function afe(t){switch(t){case EA:return"";case AA:return"";case TA:return"";case OA:return"";default:return JSON.stringify(t)}}function cfe(t){switch(t){case EA:return"byte-order-mark";case AA:return"doc-mode";case TA:return"flow-error-end";case OA:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r -`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}kr.createScalarToken=SA.createScalarToken;kr.resolveAsScalar=SA.resolveAsScalar;kr.setScalarValue=SA.setScalarValue;kr.stringify=Kde.stringify;kr.visit=Jde.visit;kr.BOM=wA;kr.DOCUMENT=xA;kr.FLOW_END=$A;kr.SCALAR=kA;kr.isCollection=Yde;kr.isScalar=Xde;kr.prettyToken=Qde;kr.tokenType=efe});var TA=b(b4=>{"use strict";var Ed=Hg();function Dn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var v4=new Set("0123456789ABCDEFabcdef"),tfe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Zg=new Set(",[]{}"),rfe=new Set(` ,[]{} -\r `),EA=t=>!t||rfe.has(t),AA=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Tr.createScalarToken=kA.createScalarToken;Tr.resolveAsScalar=kA.resolveAsScalar;Tr.setScalarValue=kA.setScalarValue;Tr.stringify=nfe.stringify;Tr.visit=ife.visit;Tr.BOM=EA;Tr.DOCUMENT=AA;Tr.FLOW_END=TA;Tr.SCALAR=OA;Tr.isCollection=ofe;Tr.isScalar=sfe;Tr.prettyToken=afe;Tr.tokenType=cfe});var RA=v(T4=>{"use strict";var Id=Gg();function Fn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var A4=new Set("0123456789ABCDEFabcdef"),lfe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Vg=new Set(",[]{}"),ufe=new Set(` ,[]{} +\r `),IA=t=>!t||ufe.has(t),PA=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` `?!0:r==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===` `||!i&&!this.atEnd)return e+n+1}return r===` -`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Dn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Dn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Dn(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(EA),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Fn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Fn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Fn(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(IA),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Dn(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case` +`,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Fn(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case` `:e=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===` `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(` `,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===` `;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===` -`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Ed.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Dn(o)||e&&Zg.has(o))break;r=n}else if(Dn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` +`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Id.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Fn(o)||e&&Vg.has(o))break;r=n}else if(Fn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&Zg.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Zg.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Ed.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(EA),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Dn(n)||r&&Zg.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Dn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(tfe.has(r))r=this.buffer[++e];else if(r==="%"&&v4.has(this.buffer[e+1])&&v4.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` +`,o=this.buffer[n+1]):r=n),o==="#"||e&&Vg.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Vg.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Id.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(IA),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Fn(n)||r&&Vg.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Fn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(lfe.has(r))r=this.buffer[++e];else if(r==="%"&&A4.has(this.buffer[e+1])&&A4.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};b4.Lexer=AA});var IA=b(S4=>{"use strict";var OA=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var nfe=Ue("process"),w4=Hg(),ife=TA();function Io(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Vg(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&$4(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&x4(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};T4.Lexer=PA});var DA=v(O4=>{"use strict";var CA=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var dfe=Be("process"),I4=Gg(),ffe=RA();function Do(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Kg(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&R4(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&P4(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Io(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(k4(r.key)&&!Io(r.sep,"newline")){let s=fc(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Io(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=fc(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Io(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Io(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Vg(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Io(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Gg(n),o=fc(i);$4(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` +`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Kg(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Do(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(C4(r.key)&&!Do(r.sep,"newline")){let s=gc(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Do(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=gc(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Do(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Do(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Kg(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Do(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Wg(n),o=gc(i);R4(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(` -`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Gg(e),n=fc(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Gg(e),n=fc(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};E4.Parser=PA});var P4=b(Td=>{"use strict";var A4=_A(),ofe=vd(),Ad=wd(),sfe=gE(),afe=Pe(),cfe=IA(),T4=RA();function O4(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new cfe.LineCounter||null,prettyErrors:e}}function lfe(t,e={}){let{lineCounter:r,prettyErrors:n}=O4(e),i=new T4.Parser(r?.addNewLine),o=new A4.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Ad.prettifyError(t,r)),a.warnings.forEach(Ad.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function I4(t,e={}){let{lineCounter:r,prettyErrors:n}=O4(e),i=new T4.Parser(r?.addNewLine),o=new A4.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Ad.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Ad.prettifyError(t,r)),s.warnings.forEach(Ad.prettifyError(t,r))),s}function ufe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=I4(t,r);if(!i)return null;if(i.warnings.forEach(o=>sfe.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function dfe(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return afe.isDocument(t)&&!n?t.toString(r):new ofe.Document(t,n,r).toString(r)}Td.parse=ufe;Td.parseAllDocuments=lfe;Td.parseDocument=I4;Td.stringify=dfe});var rr=b(qe=>{"use strict";var ffe=_A(),pfe=vd(),mfe=XE(),CA=wd(),hfe=nd(),Po=Pe(),gfe=Eo(),yfe=It(),_fe=To(),vfe=Oo(),bfe=Hg(),Sfe=TA(),wfe=IA(),xfe=RA(),Wg=P4(),R4=Qu();qe.Composer=ffe.Composer;qe.Document=pfe.Document;qe.Schema=mfe.Schema;qe.YAMLError=CA.YAMLError;qe.YAMLParseError=CA.YAMLParseError;qe.YAMLWarning=CA.YAMLWarning;qe.Alias=hfe.Alias;qe.isAlias=Po.isAlias;qe.isCollection=Po.isCollection;qe.isDocument=Po.isDocument;qe.isMap=Po.isMap;qe.isNode=Po.isNode;qe.isPair=Po.isPair;qe.isScalar=Po.isScalar;qe.isSeq=Po.isSeq;qe.Pair=gfe.Pair;qe.Scalar=yfe.Scalar;qe.YAMLMap=_fe.YAMLMap;qe.YAMLSeq=vfe.YAMLSeq;qe.CST=bfe;qe.Lexer=Sfe.Lexer;qe.LineCounter=wfe.LineCounter;qe.Parser=xfe.Parser;qe.parse=Wg.parse;qe.parseAllDocuments=Wg.parseAllDocuments;qe.parseDocument=Wg.parseDocument;qe.stringify=Wg.stringify;qe.visit=R4.visit;qe.visitAsync=R4.visitAsync});import{execFileSync as $fe}from"node:child_process";import{existsSync as kfe,readFileSync as Efe}from"node:fs";import{join as N4}from"node:path";function mc(t,e){return $fe("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Xg(t){try{let e=mc(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function Qg(t,e){Afe(t,e);let r=mc(t,["rev-parse","HEAD"]).trim(),n=Tfe(t,e);return{groups:Ofe(t,n),head:r,inventory:{after:D4(Jg(t,"spec.yaml")),before:D4(DA(t,e,"spec.yaml"))},since:e,unsharded_commits:Cfe(t,e)}}function NA(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function Afe(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");try{mc(t,["rev-parse","--verify","--quiet",`${r}^{commit}`])}catch{throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}}function Tfe(t,e){let r=mc(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!C4(c)&&!C4(a)))if(s.startsWith("A")){let l=Kg(Jg(t,c));if(!l)continue;l.status==="done"?n.push(pc(l,"added-as-done")):l.status==="archived"&&n.push(pc(l,"archived"))}else if(s.startsWith("D")){let l=Kg(DA(t,e,a));l&&n.push(pc(l,"archived"))}else{let l=Kg(Jg(t,c));if(!l)continue;let d=Kg(DA(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(pc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(pc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(pc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function C4(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function pc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>NA(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function Kg(t){if(t===null)return null;let e;try{e=(0,Yg.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function Jg(t,e){let r=N4(t,e);if(!kfe(r))return null;try{return Efe(r,"utf8")}catch{return null}}function DA(t,e,r){try{return mc(t,["show",`${e}:${r}`])}catch{return null}}function Ofe(t,e){let r=Ife(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function Ife(t){let e=Jg(t,N4("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,Yg.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function D4(t){let e={};if(t!==null)try{let n=(0,Yg.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function Cfe(t,e){let r=mc(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);Pfe.test(a)&&(Rfe.test(a)||n.push({hash:s,subject:a}))}return n}var Yg,Pfe,Rfe,ey=y(()=>{"use strict";Yg=$t(rr(),1);Pfe=/^(feat|fix)(\([^)]*\))?!?:/,Rfe=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{existsSync as Dfe}from"node:fs";import{join as Nfe}from"node:path";function ty(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${jfe[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` -`)}function ry(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${Ffe(l,r)} |`)}return n.join(` -`)}function Ffe(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of Mfe)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Dfe(Nfe(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function ny(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),j4(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)j4(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function j4(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=NA(r);n&&t.push(`- ${n}`)}t.push("")}var jfe,Mfe,jA=y(()=>{"use strict";ey();jfe={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Mfe=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as zfe}from"node:fs";function si(t="./spec.yaml"){let e=zfe(t,"utf8");return(0,M4.parse)(e)}var M4,iy=y(()=>{"use strict";M4=$t(rr(),1)});var Ro=b((Er,LA)=>{"use strict";var MA=Er.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+z4(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};MA.prototype.toString=function(){return this.property+" "+this.message};var oy=Er.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};oy.prototype.addError=function(e){var r;if(typeof e=="string")r=new MA(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new MA(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new Bs(this);if(this.throwError)throw r;return r};oy.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Lfe(t,e){return e+": "+t.toString()+` -`}oy.prototype.toString=function(e){return this.errors.map(Lfe).join("")};Object.defineProperty(oy.prototype,"valid",{get:function(){return!this.errors.length}});LA.exports.ValidatorResultError=Bs;function Bs(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Bs),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}Bs.prototype=new Error;Bs.prototype.constructor=Bs;Bs.prototype.name="Validation Error";var F4=Er.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};F4.prototype=Object.create(Error.prototype,{constructor:{value:F4,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var FA=Er.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+z4(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};FA.prototype.resolve=function(e){return L4(this.base,e)};FA.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=L4(this.base,i||"");var s=new FA(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Nn=Er.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};Nn.regexp=Nn.regex;Nn.pattern=Nn.regex;Nn.ipv4=Nn["ip-address"];Er.isFormat=function(e,r,n){if(typeof e=="string"&&Nn[r]!==void 0){if(Nn[r]instanceof RegExp)return Nn[r].test(e);if(typeof Nn[r]=="function")return Nn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var z4=Er.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Er.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function Ufe(t,e,r,n){typeof r=="object"?e[n]=zA(t[n],r):t.indexOf(r)===-1&&e.push(r)}function qfe(t,e,r){e[r]=t[r]}function Bfe(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=zA(t[n],e[n]):r[n]=e[n]}function zA(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Ufe.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(qfe.bind(null,t,n)),Object.keys(e).forEach(Bfe.bind(null,t,e,n))),n}LA.exports.deepMerge=zA;Er.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function Hfe(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Er.encodePath=function(e){return e.map(Hfe).join("")};Er.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Er.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var L4=Er.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var H4=b((J9e,B4)=>{"use strict";var Lr=Ro(),je=Lr.ValidatorResult,Co=Lr.SchemaError,UA={};UA.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Me=UA.validators={};Me.type=function(e,r,n,i){if(e===void 0)return null;var o=new je(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function qA(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}Me.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new je(e,r,n,i),s=new je(e,r,n,i);if(!Array.isArray(r.anyOf))throw new Co("anyOf must be an array");if(!r.anyOf.some(qA.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};Me.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new Co("allOf must be an array");var o=new je(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};Me.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new Co("oneOf must be an array");var o=new je(e,r,n,i),s=new je(e,r,n,i),a=r.oneOf.filter(qA.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};Me.if=function(e,r,n,i){if(e===void 0)return null;if(!Lr.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=qA.call(this,e,n,i,null,r.if),s=new je(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!Lr.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!Lr.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function BA(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}Me.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!Lr.isSchema(s))throw new Co('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(BA(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Me.properties=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new Co('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=BA(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function U4(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}Me.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new Co('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&U4.call(this,e,r,n,i,a,o)}return o}};Me.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new je(e,r,n,i);for(var s in e)U4.call(this,e,r,n,i,s,o);return o}};Me.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};Me.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new je(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};Me.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new je(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};Me.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!Lr.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new je(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};Me.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new je(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};Me.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new je(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};Me.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new je(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};Me.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new je(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};Me.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new je(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};Me.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new je(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function Zfe(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var HA=Ro();ZA.exports.SchemaScanResult=Z4;function Z4(t,e){this.id=t,this.ref=e}ZA.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=HA.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=HA.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!HA.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var G4=H4(),Do=Ro(),V4=sy().scan,W4=Do.ValidatorResult,Gfe=Do.ValidatorResultError,Od=Do.SchemaError,K4=Do.SchemaContext,Vfe="/",Zt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(ai),this.attributes=Object.create(G4.validators)};Zt.prototype.customFormats={};Zt.prototype.schemas=null;Zt.prototype.types=null;Zt.prototype.attributes=null;Zt.prototype.unresolvedRefs=null;Zt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=V4(r||Vfe,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Zt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=Do.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Od("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Zt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Od('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var ai=Zt.prototype.types={};ai.string=function(e){return typeof e=="string"};ai.number=function(e){return typeof e=="number"&&isFinite(e)};ai.integer=function(e){return typeof e=="number"&&e%1===0};ai.boolean=function(e){return typeof e=="boolean"};ai.array=function(e){return Array.isArray(e)};ai.null=function(e){return e===null};ai.date=function(e){return e instanceof Date};ai.any=function(e){return!0};ai.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};Y4.exports=Zt});var Q4=b((Q9e,Bi)=>{"use strict";var Wfe=Bi.exports.Validator=X4();Bi.exports.ValidatorResult=Ro().ValidatorResult;Bi.exports.ValidatorResultError=Ro().ValidatorResultError;Bi.exports.ValidationError=Ro().ValidationError;Bi.exports.SchemaError=Ro().SchemaError;Bi.exports.SchemaScanResult=sy().SchemaScanResult;Bi.exports.scan=sy().scan;Bi.exports.validate=function(t,e,r){var n=new Wfe;return n.validate(t,e,r)}});import{readFileSync as Kfe}from"node:fs";import{dirname as Jfe,join as Yfe}from"node:path";import{fileURLToPath as Xfe}from"node:url";function npe(t){let e=rpe.validate(t,tpe);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function t6(t){let e=npe(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Wg(e),n=gc(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Wg(e),n=gc(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};D4.Parser=NA});var z4=v(Rd=>{"use strict";var N4=wA(),pfe=xd(),Pd=Ed(),mfe=vE(),hfe=Pe(),gfe=DA(),j4=jA();function M4(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new gfe.LineCounter||null,prettyErrors:e}}function yfe(t,e={}){let{lineCounter:r,prettyErrors:n}=M4(e),i=new j4.Parser(r?.addNewLine),o=new N4.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Pd.prettifyError(t,r)),a.warnings.forEach(Pd.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function F4(t,e={}){let{lineCounter:r,prettyErrors:n}=M4(e),i=new j4.Parser(r?.addNewLine),o=new N4.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Pd.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Pd.prettifyError(t,r)),s.warnings.forEach(Pd.prettifyError(t,r))),s}function _fe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=F4(t,r);if(!i)return null;if(i.warnings.forEach(o=>mfe.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function bfe(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return hfe.isDocument(t)&&!n?t.toString(r):new pfe.Document(t,n,r).toString(r)}Rd.parse=_fe;Rd.parseAllDocuments=yfe;Rd.parseDocument=F4;Rd.stringify=bfe});var or=v(He=>{"use strict";var vfe=wA(),Sfe=xd(),wfe=rA(),MA=Ed(),xfe=ad(),No=Pe(),$fe=Io(),kfe=Pt(),Efe=Ro(),Afe=Co(),Tfe=Gg(),Ofe=RA(),Ife=DA(),Pfe=jA(),Jg=z4(),L4=nd();He.Composer=vfe.Composer;He.Document=Sfe.Document;He.Schema=wfe.Schema;He.YAMLError=MA.YAMLError;He.YAMLParseError=MA.YAMLParseError;He.YAMLWarning=MA.YAMLWarning;He.Alias=xfe.Alias;He.isAlias=No.isAlias;He.isCollection=No.isCollection;He.isDocument=No.isDocument;He.isMap=No.isMap;He.isNode=No.isNode;He.isPair=No.isPair;He.isScalar=No.isScalar;He.isSeq=No.isSeq;He.Pair=$fe.Pair;He.Scalar=kfe.Scalar;He.YAMLMap=Efe.YAMLMap;He.YAMLSeq=Afe.YAMLSeq;He.CST=Tfe;He.Lexer=Ofe.Lexer;He.LineCounter=Ife.LineCounter;He.Parser=Pfe.Parser;He.parse=Jg.parse;He.parseAllDocuments=Jg.parseAllDocuments;He.parseDocument=Jg.parseDocument;He.stringify=Jg.stringify;He.visit=L4.visit;He.visitAsync=L4.visitAsync});import{execFileSync as Rfe}from"node:child_process";import{existsSync as Cfe,readFileSync as Dfe}from"node:fs";import{join as B4}from"node:path";function _c(t,e){return Rfe("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ey(t){try{let e=_c(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function ty(t,e){Nfe(t,e);let r=_c(t,["rev-parse","HEAD"]).trim(),n=jfe(t,e);return{groups:Mfe(t,n),head:r,inventory:{after:q4(Xg(t,"spec.yaml")),before:q4(FA(t,e,"spec.yaml"))},since:e,unsharded_commits:Ufe(t,e)}}function zA(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function Nfe(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");try{_c(t,["rev-parse","--verify","--quiet",`${r}^{commit}`])}catch{throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}}function jfe(t,e){let r=_c(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!U4(c)&&!U4(a)))if(s.startsWith("A")){let l=Yg(Xg(t,c));if(!l)continue;l.status==="done"?n.push(yc(l,"added-as-done")):l.status==="archived"&&n.push(yc(l,"archived"))}else if(s.startsWith("D")){let l=Yg(FA(t,e,a));l&&n.push(yc(l,"archived"))}else{let l=Yg(Xg(t,c));if(!l)continue;let d=Yg(FA(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(yc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(yc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(yc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function U4(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function yc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>zA(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function Yg(t){if(t===null)return null;let e;try{e=(0,Qg.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function Xg(t,e){let r=B4(t,e);if(!Cfe(r))return null;try{return Dfe(r,"utf8")}catch{return null}}function FA(t,e,r){try{return _c(t,["show",`${e}:${r}`])}catch{return null}}function Mfe(t,e){let r=Ffe(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function Ffe(t){let e=Xg(t,B4("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,Qg.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function q4(t){let e={};if(t!==null)try{let n=(0,Qg.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function Ufe(t,e){let r=_c(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);zfe.test(a)&&(Lfe.test(a)||n.push({hash:s,subject:a}))}return n}var Qg,zfe,Lfe,ry=y(()=>{"use strict";Qg=kt(or(),1);zfe=/^(feat|fix)(\([^)]*\))?!?:/,Lfe=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{existsSync as qfe}from"node:fs";import{join as Bfe}from"node:path";function ny(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${Hfe[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` +`)}function iy(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${Gfe(l,r)} |`)}return n.join(` +`)}function Gfe(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of Zfe)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${qfe(Bfe(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function oy(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),H4(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)H4(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function H4(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=zA(r);n&&t.push(`- ${n}`)}t.push("")}var Hfe,Zfe,LA=y(()=>{"use strict";ry();Hfe={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Zfe=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Vfe}from"node:fs";function di(t="./spec.yaml"){let e=Vfe(t,"utf8");return(0,Z4.parse)(e)}var Z4,sy=y(()=>{"use strict";Z4=kt(or(),1)});var jo=v((Or,HA)=>{"use strict";var UA=Or.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+V4(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};UA.prototype.toString=function(){return this.property+" "+this.message};var ay=Or.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};ay.prototype.addError=function(e){var r;if(typeof e=="string")r=new UA(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new UA(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new Gs(this);if(this.throwError)throw r;return r};ay.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Wfe(t,e){return e+": "+t.toString()+` +`}ay.prototype.toString=function(e){return this.errors.map(Wfe).join("")};Object.defineProperty(ay.prototype,"valid",{get:function(){return!this.errors.length}});HA.exports.ValidatorResultError=Gs;function Gs(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Gs),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}Gs.prototype=new Error;Gs.prototype.constructor=Gs;Gs.prototype.name="Validation Error";var G4=Or.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};G4.prototype=Object.create(Error.prototype,{constructor:{value:G4,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var qA=Or.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+V4(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};qA.prototype.resolve=function(e){return W4(this.base,e)};qA.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=W4(this.base,i||"");var s=new qA(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var zn=Or.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};zn.regexp=zn.regex;zn.pattern=zn.regex;zn.ipv4=zn["ip-address"];Or.isFormat=function(e,r,n){if(typeof e=="string"&&zn[r]!==void 0){if(zn[r]instanceof RegExp)return zn[r].test(e);if(typeof zn[r]=="function")return zn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var V4=Or.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Or.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function Kfe(t,e,r,n){typeof r=="object"?e[n]=BA(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Jfe(t,e,r){e[r]=t[r]}function Yfe(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=BA(t[n],e[n]):r[n]=e[n]}function BA(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Kfe.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Jfe.bind(null,t,n)),Object.keys(e).forEach(Yfe.bind(null,t,e,n))),n}HA.exports.deepMerge=BA;Or.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function Xfe(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Or.encodePath=function(e){return e.map(Xfe).join("")};Or.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Or.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var W4=Or.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var X4=v((aVe,Y4)=>{"use strict";var Hr=jo(),Fe=Hr.ValidatorResult,Mo=Hr.SchemaError,ZA={};ZA.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=ZA.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function GA(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new Mo("anyOf must be an array");if(!r.anyOf.some(GA.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new Mo("allOf must be an array");var o=new Fe(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new Mo("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(GA.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!Hr.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=GA.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!Hr.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!Hr.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function VA(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!Hr.isSchema(s))throw new Mo('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(VA(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new Mo('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=VA(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function K4(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new Mo('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&K4.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)K4.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!Hr.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function Qfe(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var WA=jo();KA.exports.SchemaScanResult=Q4;function Q4(t,e){this.id=t,this.ref=e}KA.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=WA.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=WA.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!WA.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var e6=X4(),Fo=jo(),t6=cy().scan,r6=Fo.ValidatorResult,epe=Fo.ValidatorResultError,Cd=Fo.SchemaError,n6=Fo.SchemaContext,tpe="/",Vt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(fi),this.attributes=Object.create(e6.validators)};Vt.prototype.customFormats={};Vt.prototype.schemas=null;Vt.prototype.types=null;Vt.prototype.attributes=null;Vt.prototype.unresolvedRefs=null;Vt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=t6(r||tpe,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Vt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=Fo.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Cd("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Vt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Cd('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var fi=Vt.prototype.types={};fi.string=function(e){return typeof e=="string"};fi.number=function(e){return typeof e=="number"&&isFinite(e)};fi.integer=function(e){return typeof e=="number"&&e%1===0};fi.boolean=function(e){return typeof e=="boolean"};fi.array=function(e){return Array.isArray(e)};fi.null=function(e){return e===null};fi.date=function(e){return e instanceof Date};fi.any=function(e){return!0};fi.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};o6.exports=Vt});var a6=v((uVe,Vi)=>{"use strict";var rpe=Vi.exports.Validator=s6();Vi.exports.ValidatorResult=jo().ValidatorResult;Vi.exports.ValidatorResultError=jo().ValidatorResultError;Vi.exports.ValidationError=jo().ValidationError;Vi.exports.SchemaError=jo().SchemaError;Vi.exports.SchemaScanResult=cy().SchemaScanResult;Vi.exports.scan=cy().scan;Vi.exports.validate=function(t,e,r){var n=new rpe;return n.validate(t,e,r)}});import{readFileSync as npe}from"node:fs";import{dirname as ipe,join as ope}from"node:path";import{fileURLToPath as spe}from"node:url";function dpe(t){let e=upe.validate(t,lpe);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function l6(t){let e=dpe(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var e6,Qfe,epe,tpe,rpe,r6=y(()=>{"use strict";e6=$t(Q4(),1),Qfe=Jfe(Xfe(import.meta.url)),epe=Yfe(Qfe,"schema.json"),tpe=JSON.parse(Kfe(epe,"utf8")),rpe=new e6.Validator});import{existsSync as GA,readdirSync as ipe}from"node:fs";import{dirname as ope,join as Hs,resolve as i6}from"node:path";function n6(t){return GA(t)?ipe(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>si(Hs(t,r))):[]}function cy(t,e){ay=e?{cwd:i6(t),spec:e}:null}function J(t=".",e="spec.yaml"){return ay&&e==="spec.yaml"&&i6(t)===ay.cwd?ay.spec:spe(t,e)}function spe(t,e){let r=Hs(t,e),n=si(r),i=Hs(t,ope(e),"spec");if(!n.features||n.features.length===0){let o=n6(Hs(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=n6(Hs(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Hs(i,"architecture.yaml");GA(o)&&(n.architecture=si(o))}if(!n.capabilities||n.capabilities.length===0){let o=Hs(i,"capabilities.yaml");if(GA(o)){let s=si(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return t6(n),n}var ay,lt=y(()=>{"use strict";iy();r6();ay=null});import hc from"node:process";function KA(){return!!hc.stdout.isTTY}function H(t,e,r=""){let n=o6[t],i=r?` ${r}`:"";KA()?hc.stdout.write(`${VA[t]}${n}${WA} ${e}${i} -`):hc.stdout.write(`${n} ${e}${i} -`)}function Id(t,e,r=""){if(!KA())return;let n=r?` ${r}`:"";hc.stdout.write(`${s6}${VA.start}\xB7${WA} ${t} \xB7 ${e}${n}`)}function Zs(t,e,r=""){let n=o6[t],i=r?` ${r}`:"";KA()?hc.stdout.write(`${s6}${VA[t]}${n}${WA} ${e}${i} -`):hc.stdout.write(`${n} ${e}${i} -`)}var o6,VA,WA,s6,No=y(()=>{"use strict";o6={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},VA={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},WA="\x1B[0m",s6="\r\x1B[K"});import{execFileSync as c6}from"node:child_process";import{appendFileSync as ape,existsSync as JA,mkdirSync as cpe,readFileSync as lpe,renameSync as upe,statSync as dpe}from"node:fs";import{userInfo as fpe}from"node:os";import{dirname as ppe,join as l6}from"node:path";function u6(t){return l6(t,mpe,hpe)}function Ur(t,e){let r=u6(t),n=ppe(r);JA(n)||cpe(n,{recursive:!0});try{JA(r)&&dpe(r).size>ype&&upe(r,l6(n,gpe))}catch{}ape(r,`${JSON.stringify(e)} -`,"utf8")}function Pd(t){let e=u6(t);if(!JA(e))return[];let r=lpe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}function qr(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function _pe(t){let e;try{e=c6("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=fpe().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function vpe(t){try{return c6("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function YA(t,e){try{let r=Pd(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function Zi(t,e,r){try{let n=vpe(t),i=_pe(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=YA(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Ur(t,qr(e,o))}catch{}}var mpe,hpe,gpe,ype,ci=y(()=>{"use strict";mpe=".cladding",hpe="events.log.jsonl",gpe="events.log.1.jsonl",ype=5*1024*1024});import{createHash as bpe}from"node:crypto";import{existsSync as Spe,readFileSync as d6,writeFileSync as wpe}from"node:fs";import{join as XA}from"node:path";function Rd(t,e){let r=bpe("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(d6(XA(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function gc(t){let e=XA(t,...f6);if(!Spe(e))return null;let r=new Map;try{for(let n of d6(e,"utf8").split(` -`)){let i=n.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);i&&r.set(i[1],i[2])}}catch{return null}return r}function p6(t,e){let r=(e.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return!1;let i=`# Cladding \xB7 Tier C \u2014 verification attestation (GREEN strict pre-push gate). Do not edit by hand. + `)}`)}var c6,ape,cpe,lpe,upe,u6=y(()=>{"use strict";c6=kt(a6(),1),ape=ipe(spe(import.meta.url)),cpe=ope(ape,"schema.json"),lpe=JSON.parse(npe(cpe,"utf8")),upe=new c6.Validator});import{existsSync as JA,readdirSync as fpe}from"node:fs";import{dirname as ppe,join as Vs,resolve as f6}from"node:path";function d6(t){return JA(t)?fpe(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>di(Vs(t,r))):[]}function Ws(t,e){ly=e?{cwd:f6(t),spec:e}:null}function J(t=".",e="spec.yaml"){return ly&&e==="spec.yaml"&&f6(t)===ly.cwd?ly.spec:mpe(t,e)}function mpe(t,e){let r=Vs(t,e),n=di(r),i=Vs(t,ppe(e),"spec");if(!n.features||n.features.length===0){let o=d6(Vs(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=d6(Vs(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Vs(i,"architecture.yaml");JA(o)&&(n.architecture=di(o))}if(!n.capabilities||n.capabilities.length===0){let o=Vs(i,"capabilities.yaml");if(JA(o)){let s=di(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return l6(n),n}var ly,at=y(()=>{"use strict";sy();u6();ly=null});import bc from"node:process";function QA(){return!!bc.stdout.isTTY}function B(t,e,r=""){let n=p6[t],i=r?` ${r}`:"";QA()?bc.stdout.write(`${YA[t]}${n}${XA} ${e}${i} +`):bc.stdout.write(`${n} ${e}${i} +`)}function Dd(t,e,r=""){if(!QA())return;let n=r?` ${r}`:"";bc.stdout.write(`${m6}${YA.start}\xB7${XA} ${t} \xB7 ${e}${n}`)}function Ks(t,e,r=""){let n=p6[t],i=r?` ${r}`:"";QA()?bc.stdout.write(`${m6}${YA[t]}${n}${XA} ${e}${i} +`):bc.stdout.write(`${n} ${e}${i} +`)}var p6,YA,XA,m6,zo=y(()=>{"use strict";p6={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},YA={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},XA="\x1B[0m",m6="\r\x1B[K"});import{execFileSync as g6}from"node:child_process";import{appendFileSync as hpe,existsSync as eT,mkdirSync as gpe,readFileSync as ype,renameSync as _pe,statSync as bpe}from"node:fs";import{userInfo as vpe}from"node:os";import{dirname as Spe,join as y6}from"node:path";function _6(t){return y6(t,wpe,xpe)}function Zr(t,e){let r=_6(t),n=Spe(r);eT(n)||gpe(n,{recursive:!0});try{eT(r)&&bpe(r).size>kpe&&_pe(r,y6(n,$pe))}catch{}hpe(r,`${JSON.stringify(e)} +`,"utf8")}function Nd(t){let e=_6(t);if(!eT(e))return[];let r=ype(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}function Gr(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function Epe(t){let e;try{e=g6("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=vpe().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Ape(t){try{return g6("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function tT(t,e){try{let r=Nd(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function Ki(t,e,r){try{let n=Ape(t),i=Epe(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=tT(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Zr(t,Gr(e,o))}catch{}}var wpe,xpe,$pe,kpe,pi=y(()=>{"use strict";wpe=".cladding",xpe="events.log.jsonl",$pe="events.log.1.jsonl",kpe=5*1024*1024});import{createHash as Tpe}from"node:crypto";import{existsSync as Ope,readFileSync as b6,writeFileSync as Ipe}from"node:fs";import{join as rT}from"node:path";function jd(t,e){let r=Tpe("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(b6(rT(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function vc(t){let e=rT(t,...v6);if(!Ope(e))return null;let r=new Map;try{for(let n of b6(e,"utf8").split(` +`)){let i=n.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);i&&r.set(i[1],i[2])}}catch{return null}return r}function S6(t,e){let r=(e.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return!1;let i=`# Cladding \xB7 Tier C \u2014 verification attestation (GREEN strict pre-push gate). Do not edit by hand. # One line per done feature: sha256 tree-hash of its modules at the last # attested verification. STALE_ATTESTATION compares; \`clad check # --tier=pre-push --strict\` GREEN refreshes. Content-anchored: survives # fresh clones and squash/rebase (suggested .gitattributes: merge=union). attested: -`+r.map(o=>` ${o.id}: ${Rd(t,o.modules??[])}`).sort().join(` +`+r.map(o=>` ${o.id}: ${jd(t,o.modules??[])}`).sort().join(` `)+` -`;return wpe(XA(t,...f6),i,"utf8"),!0}var f6,Cd=y(()=>{"use strict";f6=["spec","attestation.yaml"]});function kt(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var Gi=y(()=>{});import{fileURLToPath as Rpe}from"node:url";var yc,Cpe,tT,rT,_c=y(()=>{yc=(t,e)=>{let r=rT(Cpe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Cpe=t=>tT(t)?t.toString():t,tT=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,rT=t=>t instanceof URL?Rpe(t):t});var uy,nT=y(()=>{Gi();_c();uy=(t,e=[],r={})=>{let n=yc(t,"First argument"),[i,o]=kt(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!kt(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as Dpe}from"node:string_decoder";var b6,S6,Mt,Vi,Npe,w6,jpe,dy,x6,Mpe,Dd,Fpe,iT,zpe,Br=y(()=>{({toString:b6}=Object.prototype),S6=t=>b6.call(t)==="[object ArrayBuffer]",Mt=t=>b6.call(t)==="[object Uint8Array]",Vi=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Npe=new TextEncoder,w6=t=>Npe.encode(t),jpe=new TextDecoder,dy=t=>jpe.decode(t),x6=(t,e)=>Mpe(t,e).join(""),Mpe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Dpe(e),n=t.map(o=>typeof o=="string"?w6(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Dd=t=>t.length===1&&Mt(t[0])?t[0]:iT(Fpe(t)),Fpe=t=>t.map(e=>typeof e=="string"?w6(e):e),iT=t=>{let e=new Uint8Array(zpe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},zpe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Lpe}from"node:child_process";var A6,T6,Upe,qpe,$6,Bpe,k6,E6,Hpe,O6=y(()=>{Gi();Br();A6=t=>Array.isArray(t)&&Array.isArray(t.raw),T6=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Upe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},Upe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=qpe(i,t.raw[n]),c=k6(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>E6(d)):[E6(l)];return k6(c,u,a)},qpe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=$6.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],E6=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(kt(t)&&("stdout"in t||"isMaxBuffer"in t))return Hpe(t);throw t instanceof Lpe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},Hpe=({stdout:t})=>{if(typeof t=="string")return t;if(Mt(t))return dy(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import oT from"node:process";var jn,fy,fn,py,Wi=y(()=>{jn=t=>fy.includes(t),fy=[oT.stdin,oT.stdout,oT.stderr],fn=["stdin","stdout","stderr"],py=t=>fn[t]??`stdio[${t}]`});import{debuglog as Zpe}from"node:util";var P6,sT,Gpe,Vpe,Wpe,Kpe,I6,Jpe,aT,Ype,Xpe,Qpe,eme,cT,Ki,Ji=y(()=>{Gi();Wi();P6=t=>{let e={...t};for(let r of cT)e[r]=sT(t,r);return e},sT=(t,e)=>{let r=Array.from({length:Gpe(t)+1}),n=Vpe(t[e],r,e);return Xpe(n,e)},Gpe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,fn.length):fn.length,Vpe=(t,e,r)=>kt(t)?Wpe(t,e,r):e.fill(t),Wpe=(t,e,r)=>{for(let n of Object.keys(t).sort(Kpe))for(let i of Jpe(n,r,e))e[i]=t[n];return e},Kpe=(t,e)=>I6(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,Jpe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=aT(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`;return Ipe(rT(t,...v6),i,"utf8"),!0}var v6,Md=y(()=>{"use strict";v6=["spec","attestation.yaml"]});function Et(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var Ji=y(()=>{});import{fileURLToPath as Lpe}from"node:url";var Sc,Upe,oT,sT,wc=y(()=>{Sc=(t,e)=>{let r=sT(Upe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Upe=t=>oT(t)?t.toString():t,oT=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,sT=t=>t instanceof URL?Lpe(t):t});var dy,aT=y(()=>{Ji();wc();dy=(t,e=[],r={})=>{let n=Sc(t,"First argument"),[i,o]=Et(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Et(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as qpe}from"node:string_decoder";var T6,O6,Ft,Yi,Bpe,I6,Hpe,fy,P6,Zpe,Fd,Gpe,cT,Vpe,Vr=y(()=>{({toString:T6}=Object.prototype),O6=t=>T6.call(t)==="[object ArrayBuffer]",Ft=t=>T6.call(t)==="[object Uint8Array]",Yi=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Bpe=new TextEncoder,I6=t=>Bpe.encode(t),Hpe=new TextDecoder,fy=t=>Hpe.decode(t),P6=(t,e)=>Zpe(t,e).join(""),Zpe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new qpe(e),n=t.map(o=>typeof o=="string"?I6(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Fd=t=>t.length===1&&Ft(t[0])?t[0]:cT(Gpe(t)),Gpe=t=>t.map(e=>typeof e=="string"?I6(e):e),cT=t=>{let e=new Uint8Array(Vpe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Vpe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Wpe}from"node:child_process";var N6,j6,Kpe,Jpe,R6,Ype,C6,D6,Xpe,M6=y(()=>{Ji();Vr();N6=t=>Array.isArray(t)&&Array.isArray(t.raw),j6=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Kpe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},Kpe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=Jpe(i,t.raw[n]),c=C6(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>D6(d)):[D6(l)];return C6(c,u,a)},Jpe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=R6.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],D6=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Et(t)&&("stdout"in t||"isMaxBuffer"in t))return Xpe(t);throw t instanceof Wpe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},Xpe=({stdout:t})=>{if(typeof t=="string")return t;if(Ft(t))return fy(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import lT from"node:process";var Ln,py,mn,my,Xi=y(()=>{Ln=t=>py.includes(t),py=[lT.stdin,lT.stdout,lT.stderr],mn=["stdin","stdout","stderr"],my=t=>mn[t]??`stdio[${t}]`});import{debuglog as Qpe}from"node:util";var z6,uT,eme,tme,rme,nme,F6,ime,dT,ome,sme,ame,cme,fT,Qi,eo=y(()=>{Ji();Xi();z6=t=>{let e={...t};for(let r of fT)e[r]=uT(t,r);return e},uT=(t,e)=>{let r=Array.from({length:eme(t)+1}),n=tme(t[e],r,e);return sme(n,e)},eme=({stdio:t})=>Array.isArray(t)?Math.max(t.length,mn.length):mn.length,tme=(t,e,r)=>Et(t)?rme(t,e,r):e.fill(t),rme=(t,e,r)=>{for(let n of Object.keys(t).sort(nme))for(let i of ime(n,r,e))e[i]=t[n];return e},nme=(t,e)=>F6(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,ime=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=dT(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},aT=t=>{if(t==="all")return t;if(fn.includes(t))return fn.indexOf(t);let e=Ype.exec(t);if(e!==null)return Number(e[1])},Ype=/^fd(\d+)$/,Xpe=(t,e)=>t.map(r=>r===void 0?eme[e]:r),Qpe=Zpe("execa").enabled?"full":"none",eme={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Qpe,stripFinalNewline:!0},cT=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Ki=(t,e)=>e==="ipc"?t.at(-1):t[e]});var vc,bc,R6,lT,tme,my,hy,jo=y(()=>{Ji();vc=({verbose:t},e)=>lT(t,e)!=="none",bc=({verbose:t},e)=>!["none","short"].includes(lT(t,e)),R6=({verbose:t},e)=>{let r=lT(t,e);return my(r)?r:void 0},lT=(t,e)=>e===void 0?tme(t):Ki(t,e),tme=t=>t.find(e=>my(e))??hy.findLast(e=>t.includes(e)),my=t=>typeof t=="function",hy=["none","short","full"]});import{platform as rme}from"node:process";import{stripVTControlCharacters as nme}from"node:util";var C6,Nd,D6,ime,ome,sme,ame,cme,lme,ume,gy=y(()=>{C6=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>lme(D6(o))).join(" ");return{command:n,escapedCommand:i}},Nd=t=>nme(t).split(` -`).map(e=>D6(e)).join(` -`),D6=t=>t.replaceAll(sme,e=>ime(e)),ime=t=>{let e=ame[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=cme?`\\u${n.padStart(4,"0")}`:`\\U${n}`},ome=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},sme=ome(),ame={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},cme=65535,lme=t=>ume.test(t)?t:rme==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,ume=/^[\w./-]+$/});import N6 from"node:process";function uT(){let{env:t}=N6,{TERM:e,TERM_PROGRAM:r}=t;return N6.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var j6=y(()=>{});var M6,F6,dme,fme,pme,mme,hme,yy,fWe,z6=y(()=>{j6();M6={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},F6={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},dme={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},fme={...M6,...F6},pme={...M6,...dme},mme=uT(),hme=mme?fme:pme,yy=hme,fWe=Object.entries(F6)});import gme from"node:tty";var yme,ge,hWe,L6,gWe,yWe,_We,vWe,bWe,SWe,wWe,xWe,$We,kWe,EWe,AWe,TWe,OWe,IWe,_y,PWe,RWe,CWe,DWe,NWe,jWe,MWe,FWe,zWe,U6,LWe,q6,UWe,qWe,BWe,HWe,ZWe,GWe,VWe,WWe,KWe,JWe,YWe,dT=y(()=>{yme=gme?.WriteStream?.prototype?.hasColors?.()??!1,ge=(t,e)=>{if(!yme)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},hWe=ge(0,0),L6=ge(1,22),gWe=ge(2,22),yWe=ge(3,23),_We=ge(4,24),vWe=ge(53,55),bWe=ge(7,27),SWe=ge(8,28),wWe=ge(9,29),xWe=ge(30,39),$We=ge(31,39),kWe=ge(32,39),EWe=ge(33,39),AWe=ge(34,39),TWe=ge(35,39),OWe=ge(36,39),IWe=ge(37,39),_y=ge(90,39),PWe=ge(40,49),RWe=ge(41,49),CWe=ge(42,49),DWe=ge(43,49),NWe=ge(44,49),jWe=ge(45,49),MWe=ge(46,49),FWe=ge(47,49),zWe=ge(100,49),U6=ge(91,39),LWe=ge(92,39),q6=ge(93,39),UWe=ge(94,39),qWe=ge(95,39),BWe=ge(96,39),HWe=ge(97,39),ZWe=ge(101,49),GWe=ge(102,49),VWe=ge(103,49),WWe=ge(104,49),KWe=ge(105,49),JWe=ge(106,49),YWe=ge(107,49)});var B6=y(()=>{dT();dT()});var G6,vme,vy,H6,bme,Z6,Sme,V6=y(()=>{z6();B6();G6=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=vme(r),c=bme[t]({failed:o,reject:s,piped:n}),l=Sme[t]({reject:s});return`${_y(`[${a}]`)} ${_y(`[${i}]`)} ${l(c)} ${l(e)}`},vme=t=>`${vy(t.getHours(),2)}:${vy(t.getMinutes(),2)}:${vy(t.getSeconds(),2)}.${vy(t.getMilliseconds(),3)}`,vy=(t,e)=>String(t).padStart(e,"0"),H6=({failed:t,reject:e})=>t?e?yy.cross:yy.warning:yy.tick,bme={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:H6,duration:H6},Z6=t=>t,Sme={command:()=>L6,output:()=>Z6,ipc:()=>Z6,error:({reject:t})=>t?U6:q6,duration:()=>_y}});var W6,wme,xme,K6=y(()=>{jo();W6=(t,e,r)=>{let n=R6(e,r);return t.map(({verboseLine:i,verboseObject:o})=>wme(i,o,n)).filter(i=>i!==void 0).map(i=>xme(i)).join("")},wme=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},xme=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},dT=t=>{if(t==="all")return t;if(mn.includes(t))return mn.indexOf(t);let e=ome.exec(t);if(e!==null)return Number(e[1])},ome=/^fd(\d+)$/,sme=(t,e)=>t.map(r=>r===void 0?cme[e]:r),ame=Qpe("execa").enabled?"full":"none",cme={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:ame,stripFinalNewline:!0},fT=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Qi=(t,e)=>e==="ipc"?t.at(-1):t[e]});var xc,$c,L6,pT,lme,hy,gy,Lo=y(()=>{eo();xc=({verbose:t},e)=>pT(t,e)!=="none",$c=({verbose:t},e)=>!["none","short"].includes(pT(t,e)),L6=({verbose:t},e)=>{let r=pT(t,e);return hy(r)?r:void 0},pT=(t,e)=>e===void 0?lme(t):Qi(t,e),lme=t=>t.find(e=>hy(e))??gy.findLast(e=>t.includes(e)),hy=t=>typeof t=="function",gy=["none","short","full"]});import{platform as ume}from"node:process";import{stripVTControlCharacters as dme}from"node:util";var U6,zd,q6,fme,pme,mme,hme,gme,yme,_me,yy=y(()=>{U6=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>yme(q6(o))).join(" ");return{command:n,escapedCommand:i}},zd=t=>dme(t).split(` +`).map(e=>q6(e)).join(` +`),q6=t=>t.replaceAll(mme,e=>fme(e)),fme=t=>{let e=hme[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=gme?`\\u${n.padStart(4,"0")}`:`\\U${n}`},pme=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},mme=pme(),hme={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},gme=65535,yme=t=>_me.test(t)?t:ume==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,_me=/^[\w./-]+$/});import B6 from"node:process";function mT(){let{env:t}=B6,{TERM:e,TERM_PROGRAM:r}=t;return B6.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var H6=y(()=>{});var Z6,G6,bme,vme,Sme,wme,xme,_y,xWe,V6=y(()=>{H6();Z6={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},G6={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},bme={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},vme={...Z6,...G6},Sme={...Z6,...bme},wme=mT(),xme=wme?vme:Sme,_y=xme,xWe=Object.entries(G6)});import $me from"node:tty";var kme,ge,EWe,W6,AWe,TWe,OWe,IWe,PWe,RWe,CWe,DWe,NWe,jWe,MWe,FWe,zWe,LWe,UWe,by,qWe,BWe,HWe,ZWe,GWe,VWe,WWe,KWe,JWe,K6,YWe,J6,XWe,QWe,eKe,tKe,rKe,nKe,iKe,oKe,sKe,aKe,cKe,hT=y(()=>{kme=$me?.WriteStream?.prototype?.hasColors?.()??!1,ge=(t,e)=>{if(!kme)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},EWe=ge(0,0),W6=ge(1,22),AWe=ge(2,22),TWe=ge(3,23),OWe=ge(4,24),IWe=ge(53,55),PWe=ge(7,27),RWe=ge(8,28),CWe=ge(9,29),DWe=ge(30,39),NWe=ge(31,39),jWe=ge(32,39),MWe=ge(33,39),FWe=ge(34,39),zWe=ge(35,39),LWe=ge(36,39),UWe=ge(37,39),by=ge(90,39),qWe=ge(40,49),BWe=ge(41,49),HWe=ge(42,49),ZWe=ge(43,49),GWe=ge(44,49),VWe=ge(45,49),WWe=ge(46,49),KWe=ge(47,49),JWe=ge(100,49),K6=ge(91,39),YWe=ge(92,39),J6=ge(93,39),XWe=ge(94,39),QWe=ge(95,39),eKe=ge(96,39),tKe=ge(97,39),rKe=ge(101,49),nKe=ge(102,49),iKe=ge(103,49),oKe=ge(104,49),sKe=ge(105,49),aKe=ge(106,49),cKe=ge(107,49)});var Y6=y(()=>{hT();hT()});var eB,Ame,vy,X6,Tme,Q6,Ome,tB=y(()=>{V6();Y6();eB=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Ame(r),c=Tme[t]({failed:o,reject:s,piped:n}),l=Ome[t]({reject:s});return`${by(`[${a}]`)} ${by(`[${i}]`)} ${l(c)} ${l(e)}`},Ame=t=>`${vy(t.getHours(),2)}:${vy(t.getMinutes(),2)}:${vy(t.getSeconds(),2)}.${vy(t.getMilliseconds(),3)}`,vy=(t,e)=>String(t).padStart(e,"0"),X6=({failed:t,reject:e})=>t?e?_y.cross:_y.warning:_y.tick,Tme={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:X6,duration:X6},Q6=t=>t,Ome={command:()=>W6,output:()=>Q6,ipc:()=>Q6,error:({reject:t})=>t?K6:J6,duration:()=>by}});var rB,Ime,Pme,nB=y(()=>{Lo();rB=(t,e,r)=>{let n=L6(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Ime(i,o,n)).filter(i=>i!==void 0).map(i=>Pme(i)).join("")},Ime=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Pme=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as $me}from"node:util";var li,kme,Eme,Ame,by,Tme,Sc=y(()=>{gy();V6();K6();li=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=kme({type:t,result:i,verboseInfo:n}),s=Eme(e,o),a=W6(s,n,r);a!==""&&console.warn(a.slice(0,-1))},kme=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),Eme=(t,e)=>t.split(` -`).map(r=>Ame({...e,message:r})),Ame=t=>({verboseLine:G6(t),verboseObject:t}),by=t=>{let e=typeof t=="string"?t:$me(t);return Nd(e).replaceAll(" "," ".repeat(Tme))},Tme=2});var J6,Y6=y(()=>{jo();Sc();J6=(t,e)=>{vc(e)&&li({type:"command",verboseMessage:t,verboseInfo:e})}});var X6,Ome,Ime,Pme,Q6=y(()=>{jo();X6=(t,e,r)=>{Pme(t);let n=Ome(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Ome=t=>vc({verbose:t})?Ime++:void 0,Ime=0n,Pme=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!hy.includes(e)&&!my(e)){let r=hy.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as eB}from"node:process";var Sy,fT,wy=y(()=>{Sy=()=>eB.bigint(),fT=t=>Number(eB.bigint()-t)/1e6});var xy,pT=y(()=>{Y6();Q6();wy();gy();Ji();xy=(t,e,r)=>{let n=Sy(),{command:i,escapedCommand:o}=C6(t,e),s=sT(r,"verbose"),a=X6(s,o,{...r});return J6(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var oB=b((xKe,iB)=>{iB.exports=nB;nB.sync=Cme;var tB=Ue("fs");function Rme(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{lB.exports=aB;aB.sync=Dme;var sB=Ue("fs");function aB(t,e,r){sB.stat(t,function(n,i){r(n,n?!1:cB(i,e))})}function Dme(t,e){return cB(sB.statSync(t),e)}function cB(t,e){return t.isFile()&&Nme(t,e)}function Nme(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var fB=b((EKe,dB)=>{var kKe=Ue("fs"),$y;process.platform==="win32"||global.TESTING_WINDOWS?$y=oB():$y=uB();dB.exports=mT;mT.sync=jme;function mT(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){mT(t,e||{},function(o,s){o?i(o):n(s)})})}$y(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function jme(t,e){try{return $y.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var vB=b((AKe,_B)=>{var wc=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",pB=Ue("path"),Mme=wc?";":":",mB=fB(),hB=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),gB=(t,e)=>{let r=e.colon||Mme,n=t.match(/\//)||wc&&t.match(/\\/)?[""]:[...wc?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=wc?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=wc?i.split(r):[""];return wc&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},yB=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=gB(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(hB(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=pB.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];mB(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},Fme=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=gB(t,e),o=[];for(let s=0;s{"use strict";var bB=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};hT.exports=bB;hT.exports.default=bB});var kB=b((OKe,$B)=>{"use strict";var wB=Ue("path"),zme=vB(),Lme=SB();function xB(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=zme.sync(t.command,{path:r[Lme({env:r})],pathExt:e?wB.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=wB.resolve(i?t.options.cwd:"",s)),s}function Ume(t){return xB(t)||xB(t,!0)}$B.exports=Ume});var EB=b((IKe,yT)=>{"use strict";var gT=/([()\][%!^"`<>&|;, *?])/g;function qme(t){return t=t.replace(gT,"^$1"),t}function Bme(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(gT,"^$1"),e&&(t=t.replace(gT,"^$1")),t}yT.exports.command=qme;yT.exports.argument=Bme});var TB=b((PKe,AB)=>{"use strict";AB.exports=/^#!(.*)/});var IB=b((RKe,OB)=>{"use strict";var Hme=TB();OB.exports=(t="")=>{let e=t.match(Hme);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var RB=b((CKe,PB)=>{"use strict";var _T=Ue("fs"),Zme=IB();function Gme(t){let r=Buffer.alloc(150),n;try{n=_T.openSync(t,"r"),_T.readSync(n,r,0,150,0),_T.closeSync(n)}catch{}return Zme(r.toString())}PB.exports=Gme});var jB=b((DKe,NB)=>{"use strict";var Vme=Ue("path"),CB=kB(),DB=EB(),Wme=RB(),Kme=process.platform==="win32",Jme=/\.(?:com|exe)$/i,Yme=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Xme(t){t.file=CB(t);let e=t.file&&Wme(t.file);return e?(t.args.unshift(t.file),t.command=e,CB(t)):t.file}function Qme(t){if(!Kme)return t;let e=Xme(t),r=!Jme.test(e);if(t.options.forceShell||r){let n=Yme.test(e);t.command=Vme.normalize(t.command),t.command=DB.command(t.command),t.args=t.args.map(o=>DB.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function ehe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Qme(n)}NB.exports=ehe});var zB=b((NKe,FB)=>{"use strict";var vT=process.platform==="win32";function bT(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function the(t,e){if(!vT)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=MB(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function MB(t,e){return vT&&t===1&&!e.file?bT(e.original,"spawn"):null}function rhe(t,e){return vT&&t===1&&!e.file?bT(e.original,"spawnSync"):null}FB.exports={hookChildProcess:the,verifyENOENT:MB,verifyENOENTSync:rhe,notFoundError:bT}});var qB=b((jKe,xc)=>{"use strict";var LB=Ue("child_process"),ST=jB(),wT=zB();function UB(t,e,r){let n=ST(t,e,r),i=LB.spawn(n.command,n.args,n.options);return wT.hookChildProcess(i,n),i}function nhe(t,e,r){let n=ST(t,e,r),i=LB.spawnSync(n.command,n.args,n.options);return i.error=i.error||wT.verifyENOENTSync(i.status,n),i}xc.exports=UB;xc.exports.spawn=UB;xc.exports.sync=nhe;xc.exports._parse=ST;xc.exports._enoent=wT});function ky(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var BB=y(()=>{});var HB=y(()=>{});import{promisify as ihe}from"node:util";import{execFile as ohe,execFileSync as UKe}from"node:child_process";import ZB from"node:path";import{fileURLToPath as she}from"node:url";function Ey(t){return t instanceof URL?she(t):t}function GB(t){return{*[Symbol.iterator](){let e=ZB.resolve(Ey(t)),r;for(;r!==e;)yield e,r=e,e=ZB.resolve(e,"..")}}}var HKe,ZKe,VB=y(()=>{HB();HKe=ihe(ohe);ZKe=10*1024*1024});import Ay from"node:process";import Gs from"node:path";var ahe,che,lhe,WB,KB=y(()=>{BB();VB();ahe=({cwd:t=Ay.cwd(),path:e=Ay.env[ky()],preferLocal:r=!0,execPath:n=Ay.execPath,addExecPath:i=!0}={})=>{let o=Gs.resolve(Ey(t)),s=[],a=e.split(Gs.delimiter);return r&&che(s,a,o),i&&lhe(s,a,n,o),e===""||e===Gs.delimiter?`${s.join(Gs.delimiter)}${e}`:[...s,e].join(Gs.delimiter)},che=(t,e,r)=>{for(let n of GB(r)){let i=Gs.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},lhe=(t,e,r,n)=>{let i=Gs.resolve(n,Ey(r),"..");e.includes(i)||t.push(i)},WB=({env:t=Ay.env,...e}={})=>{t={...t};let r=ky({env:t});return e.path=t[r],t[r]=ahe(e),t}});var JB,Mn,YB,XB,QB,Ty,jd,Md,Vs=y(()=>{JB=(t,e,r)=>{let n=r?Md:jd,i=t instanceof Mn?{}:{cause:t};return new n(e,i)},Mn=class extends Error{},YB=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,QB,{value:!0,writable:!1,enumerable:!1,configurable:!1})},XB=t=>Ty(t)&&QB in t,QB=Symbol("isExecaError"),Ty=t=>Object.prototype.toString.call(t)==="[object Error]",jd=class extends Error{};YB(jd,jd.name);Md=class extends Error{};YB(Md,Md.name)});var eH,uhe,tH,rH,nH=y(()=>{eH=()=>{let t=rH-tH+1;return Array.from({length:t},uhe)},uhe=(t,e)=>({name:`SIGRT${e+1}`,number:tH+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),tH=34,rH=64});var iH,oH=y(()=>{iH=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as dhe}from"node:os";var xT,fhe,sH=y(()=>{oH();nH();xT=()=>{let t=eH();return[...iH,...t].map(fhe)},fhe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=dhe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as phe}from"node:os";var mhe,hhe,aH,ghe,yhe,_he,c3e,cH=y(()=>{sH();mhe=()=>{let t=xT();return Object.fromEntries(t.map(hhe))},hhe=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],aH=mhe(),ghe=()=>{let t=xT(),e=65,r=Array.from({length:e},(n,i)=>yhe(i,t));return Object.assign({},...r)},yhe=(t,e)=>{let r=_he(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},_he=(t,e)=>{let r=e.find(({name:n})=>phe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},c3e=ghe()});import{constants as Fd}from"node:os";var uH,dH,fH,vhe,bhe,lH,She,$T,whe,xhe,Oy,zd=y(()=>{cH();uH=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return fH(t,e)},dH=t=>t===0?t:fH(t,"`subprocess.kill()`'s argument"),fH=(t,e)=>{if(Number.isInteger(t))return vhe(t,e);if(typeof t=="string")return She(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${$T()}`)},vhe=(t,e)=>{if(lH.has(t))return lH.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${$T()}`)},bhe=()=>new Map(Object.entries(Fd.signals).reverse().map(([t,e])=>[e,t])),lH=bhe(),She=(t,e)=>{if(t in Fd.signals)return t;throw t.toUpperCase()in Fd.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${$T()}`)},$T=()=>`Available signal names: ${whe()}. -Available signal numbers: ${xhe()}.`,whe=()=>Object.keys(Fd.signals).sort().map(t=>`'${t}'`).join(", "),xhe=()=>[...new Set(Object.values(Fd.signals).sort((t,e)=>t-e))].join(", "),Oy=t=>aH[t].description});import{setTimeout as $he}from"node:timers/promises";var pH,khe,mH,Ehe,Ahe,The,kT,Iy=y(()=>{Vs();zd();pH=t=>{if(t===!1)return t;if(t===!0)return khe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},khe=1e3*5,mH=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Ehe(s,a,r);Ahe(l,n);let u=t(c);return The({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Ehe=(t,e,r)=>{let[n=r,i]=Ty(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!Ty(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:dH(n),error:i}},Ahe=(t,e)=>{t!==void 0&&e.reject(t)},The=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&kT({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},kT=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await $he(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Ohe}from"node:events";var Py,ET=y(()=>{Py=async(t,e)=>{t.aborted||await Ohe(t,"abort",{signal:e})}});var hH,gH,Ihe,AT=y(()=>{ET();hH=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},gH=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Ihe(t,e,n,i)],Ihe=async(t,e,r,{signal:n})=>{throw await Py(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var $c,Phe,TT,yH,_H,Ry,vH,bH,SH,wH,xH,$H,Rhe,Che,Dhe,Fn,Nhe,Mo,kc,Ec=y(()=>{$c=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Phe(t,e,r),TT(t,e,n)},Phe=(t,e,r)=>{if(!r)throw new Error(`${Fn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},TT=(t,e,r)=>{if(!r)throw new Error(`${Fn(t,e)} cannot be used: the ${Mo(e)} has already exited or disconnected.`)},yH=t=>{throw new Error(`${Fn("getOneMessage",t)} could not complete: the ${Mo(t)} exited or disconnected.`)},_H=t=>{throw new Error(`${Fn("sendMessage",t)} failed: the ${Mo(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as Rme}from"node:util";var mi,Cme,Dme,Nme,Sy,jme,kc=y(()=>{yy();tB();nB();mi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Cme({type:t,result:i,verboseInfo:n}),s=Dme(e,o),a=rB(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Cme=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),Dme=(t,e)=>t.split(` +`).map(r=>Nme({...e,message:r})),Nme=t=>({verboseLine:eB(t),verboseObject:t}),Sy=t=>{let e=typeof t=="string"?t:Rme(t);return zd(e).replaceAll(" "," ".repeat(jme))},jme=2});var iB,oB=y(()=>{Lo();kc();iB=(t,e)=>{xc(e)&&mi({type:"command",verboseMessage:t,verboseInfo:e})}});var sB,Mme,Fme,zme,aB=y(()=>{Lo();sB=(t,e,r)=>{zme(t);let n=Mme(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Mme=t=>xc({verbose:t})?Fme++:void 0,Fme=0n,zme=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!gy.includes(e)&&!hy(e)){let r=gy.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as cB}from"node:process";var wy,gT,xy=y(()=>{wy=()=>cB.bigint(),gT=t=>Number(cB.bigint()-t)/1e6});var $y,yT=y(()=>{oB();aB();xy();yy();eo();$y=(t,e,r)=>{let n=wy(),{command:i,escapedCommand:o}=U6(t,e),s=uT(r,"verbose"),a=sB(s,o,{...r});return iB(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var pB=v((DKe,fB)=>{fB.exports=dB;dB.sync=Ume;var lB=Be("fs");function Lme(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{yB.exports=hB;hB.sync=qme;var mB=Be("fs");function hB(t,e,r){mB.stat(t,function(n,i){r(n,n?!1:gB(i,e))})}function qme(t,e){return gB(mB.statSync(t),e)}function gB(t,e){return t.isFile()&&Bme(t,e)}function Bme(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var vB=v((MKe,bB)=>{var jKe=Be("fs"),ky;process.platform==="win32"||global.TESTING_WINDOWS?ky=pB():ky=_B();bB.exports=_T;_T.sync=Hme;function _T(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){_T(t,e||{},function(o,s){o?i(o):n(s)})})}ky(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Hme(t,e){try{return ky.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var AB=v((FKe,EB)=>{var Ec=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",SB=Be("path"),Zme=Ec?";":":",wB=vB(),xB=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),$B=(t,e)=>{let r=e.colon||Zme,n=t.match(/\//)||Ec&&t.match(/\\/)?[""]:[...Ec?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Ec?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Ec?i.split(r):[""];return Ec&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},kB=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=$B(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(xB(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=SB.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];wB(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},Gme=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=$B(t,e),o=[];for(let s=0;s{"use strict";var TB=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};bT.exports=TB;bT.exports.default=TB});var CB=v((LKe,RB)=>{"use strict";var IB=Be("path"),Vme=AB(),Wme=OB();function PB(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=Vme.sync(t.command,{path:r[Wme({env:r})],pathExt:e?IB.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=IB.resolve(i?t.options.cwd:"",s)),s}function Kme(t){return PB(t)||PB(t,!0)}RB.exports=Kme});var DB=v((UKe,ST)=>{"use strict";var vT=/([()\][%!^"`<>&|;, *?])/g;function Jme(t){return t=t.replace(vT,"^$1"),t}function Yme(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(vT,"^$1"),e&&(t=t.replace(vT,"^$1")),t}ST.exports.command=Jme;ST.exports.argument=Yme});var jB=v((qKe,NB)=>{"use strict";NB.exports=/^#!(.*)/});var FB=v((BKe,MB)=>{"use strict";var Xme=jB();MB.exports=(t="")=>{let e=t.match(Xme);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var LB=v((HKe,zB)=>{"use strict";var wT=Be("fs"),Qme=FB();function ehe(t){let r=Buffer.alloc(150),n;try{n=wT.openSync(t,"r"),wT.readSync(n,r,0,150,0),wT.closeSync(n)}catch{}return Qme(r.toString())}zB.exports=ehe});var HB=v((ZKe,BB)=>{"use strict";var the=Be("path"),UB=CB(),qB=DB(),rhe=LB(),nhe=process.platform==="win32",ihe=/\.(?:com|exe)$/i,ohe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function she(t){t.file=UB(t);let e=t.file&&rhe(t.file);return e?(t.args.unshift(t.file),t.command=e,UB(t)):t.file}function ahe(t){if(!nhe)return t;let e=she(t),r=!ihe.test(e);if(t.options.forceShell||r){let n=ohe.test(e);t.command=the.normalize(t.command),t.command=qB.command(t.command),t.args=t.args.map(o=>qB.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function che(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:ahe(n)}BB.exports=che});var VB=v((GKe,GB)=>{"use strict";var xT=process.platform==="win32";function $T(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function lhe(t,e){if(!xT)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=ZB(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function ZB(t,e){return xT&&t===1&&!e.file?$T(e.original,"spawn"):null}function uhe(t,e){return xT&&t===1&&!e.file?$T(e.original,"spawnSync"):null}GB.exports={hookChildProcess:lhe,verifyENOENT:ZB,verifyENOENTSync:uhe,notFoundError:$T}});var JB=v((VKe,Ac)=>{"use strict";var WB=Be("child_process"),kT=HB(),ET=VB();function KB(t,e,r){let n=kT(t,e,r),i=WB.spawn(n.command,n.args,n.options);return ET.hookChildProcess(i,n),i}function dhe(t,e,r){let n=kT(t,e,r),i=WB.spawnSync(n.command,n.args,n.options);return i.error=i.error||ET.verifyENOENTSync(i.status,n),i}Ac.exports=KB;Ac.exports.spawn=KB;Ac.exports.sync=dhe;Ac.exports._parse=kT;Ac.exports._enoent=ET});function Ey(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var YB=y(()=>{});var XB=y(()=>{});import{promisify as fhe}from"node:util";import{execFile as phe,execFileSync as XKe}from"node:child_process";import QB from"node:path";import{fileURLToPath as mhe}from"node:url";function Ay(t){return t instanceof URL?mhe(t):t}function eH(t){return{*[Symbol.iterator](){let e=QB.resolve(Ay(t)),r;for(;r!==e;)yield e,r=e,e=QB.resolve(e,"..")}}}var t3e,r3e,tH=y(()=>{XB();t3e=fhe(phe);r3e=10*1024*1024});import Ty from"node:process";import Js from"node:path";var hhe,ghe,yhe,rH,nH=y(()=>{YB();tH();hhe=({cwd:t=Ty.cwd(),path:e=Ty.env[Ey()],preferLocal:r=!0,execPath:n=Ty.execPath,addExecPath:i=!0}={})=>{let o=Js.resolve(Ay(t)),s=[],a=e.split(Js.delimiter);return r&&ghe(s,a,o),i&&yhe(s,a,n,o),e===""||e===Js.delimiter?`${s.join(Js.delimiter)}${e}`:[...s,e].join(Js.delimiter)},ghe=(t,e,r)=>{for(let n of eH(r)){let i=Js.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},yhe=(t,e,r,n)=>{let i=Js.resolve(n,Ay(r),"..");e.includes(i)||t.push(i)},rH=({env:t=Ty.env,...e}={})=>{t={...t};let r=Ey({env:t});return e.path=t[r],t[r]=hhe(e),t}});var iH,Un,oH,sH,aH,Oy,Ld,Ud,Ys=y(()=>{iH=(t,e,r)=>{let n=r?Ud:Ld,i=t instanceof Un?{}:{cause:t};return new n(e,i)},Un=class extends Error{},oH=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,aH,{value:!0,writable:!1,enumerable:!1,configurable:!1})},sH=t=>Oy(t)&&aH in t,aH=Symbol("isExecaError"),Oy=t=>Object.prototype.toString.call(t)==="[object Error]",Ld=class extends Error{};oH(Ld,Ld.name);Ud=class extends Error{};oH(Ud,Ud.name)});var cH,_he,lH,uH,dH=y(()=>{cH=()=>{let t=uH-lH+1;return Array.from({length:t},_he)},_he=(t,e)=>({name:`SIGRT${e+1}`,number:lH+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),lH=34,uH=64});var fH,pH=y(()=>{fH=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as bhe}from"node:os";var AT,vhe,mH=y(()=>{pH();dH();AT=()=>{let t=cH();return[...fH,...t].map(vhe)},vhe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=bhe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as She}from"node:os";var whe,xhe,hH,$he,khe,Ehe,b3e,gH=y(()=>{mH();whe=()=>{let t=AT();return Object.fromEntries(t.map(xhe))},xhe=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],hH=whe(),$he=()=>{let t=AT(),e=65,r=Array.from({length:e},(n,i)=>khe(i,t));return Object.assign({},...r)},khe=(t,e)=>{let r=Ehe(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},Ehe=(t,e)=>{let r=e.find(({name:n})=>She.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},b3e=$he()});import{constants as qd}from"node:os";var _H,bH,vH,Ahe,The,yH,Ohe,TT,Ihe,Phe,Iy,Bd=y(()=>{gH();_H=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return vH(t,e)},bH=t=>t===0?t:vH(t,"`subprocess.kill()`'s argument"),vH=(t,e)=>{if(Number.isInteger(t))return Ahe(t,e);if(typeof t=="string")return Ohe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${TT()}`)},Ahe=(t,e)=>{if(yH.has(t))return yH.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${TT()}`)},The=()=>new Map(Object.entries(qd.signals).reverse().map(([t,e])=>[e,t])),yH=The(),Ohe=(t,e)=>{if(t in qd.signals)return t;throw t.toUpperCase()in qd.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${TT()}`)},TT=()=>`Available signal names: ${Ihe()}. +Available signal numbers: ${Phe()}.`,Ihe=()=>Object.keys(qd.signals).sort().map(t=>`'${t}'`).join(", "),Phe=()=>[...new Set(Object.values(qd.signals).sort((t,e)=>t-e))].join(", "),Iy=t=>hH[t].description});import{setTimeout as Rhe}from"node:timers/promises";var SH,Che,wH,Dhe,Nhe,jhe,OT,Py=y(()=>{Ys();Bd();SH=t=>{if(t===!1)return t;if(t===!0)return Che;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},Che=1e3*5,wH=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Dhe(s,a,r);Nhe(l,n);let u=t(c);return jhe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Dhe=(t,e,r)=>{let[n=r,i]=Oy(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!Oy(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:bH(n),error:i}},Nhe=(t,e)=>{t!==void 0&&e.reject(t)},jhe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&OT({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},OT=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Rhe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Mhe}from"node:events";var Ry,IT=y(()=>{Ry=async(t,e)=>{t.aborted||await Mhe(t,"abort",{signal:e})}});var xH,$H,Fhe,PT=y(()=>{IT();xH=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},$H=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Fhe(t,e,n,i)],Fhe=async(t,e,r,{signal:n})=>{throw await Ry(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Tc,zhe,RT,kH,EH,Cy,AH,TH,OH,IH,PH,RH,Lhe,Uhe,qhe,qn,Bhe,Uo,Oc,Ic=y(()=>{Tc=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{zhe(t,e,r),RT(t,e,n)},zhe=(t,e,r)=>{if(!r)throw new Error(`${qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},RT=(t,e,r)=>{if(!r)throw new Error(`${qn(t,e)} cannot be used: the ${Uo(e)} has already exited or disconnected.`)},kH=t=>{throw new Error(`${qn("getOneMessage",t)} could not complete: the ${Uo(t)} exited or disconnected.`)},EH=t=>{throw new Error(`${qn("sendMessage",t)} failed: the ${Uo(t)} is sending a message too, instead of listening to incoming messages. This can be fixed by both sending a message and listening to incoming messages at the same time: const [receivedMessage] = await Promise.all([ - ${Fn("getOneMessage",t)}, - ${Fn("sendMessage",t,"message, {strict: true}")}, -]);`)},Ry=(t,e)=>new Error(`${Fn("sendMessage",e)} failed when sending an acknowledgment response to the ${Mo(e)}.`,{cause:t}),vH=t=>{throw new Error(`${Fn("sendMessage",t)} failed: the ${Mo(t)} is not listening to incoming messages.`)},bH=t=>{throw new Error(`${Fn("sendMessage",t)} failed: the ${Mo(t)} exited without listening to incoming messages.`)},SH=()=>new Error(`\`cancelSignal\` aborted: the ${Mo(!0)} disconnected.`),wH=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},xH=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Fn(e,r)} cannot be used: the ${Mo(r)} is disconnecting.`,{cause:t})},$H=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Rhe(t))throw new Error(`${Fn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Rhe=({code:t,message:e})=>Che.has(t)||Dhe.some(r=>e.includes(r)),Che=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Dhe=["could not be cloned","circular structure","call stack size exceeded"],Fn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Nhe(e)}${t}(${r})`,Nhe=t=>t?"":"subprocess.",Mo=t=>t?"parent process":"subprocess",kc=t=>{t.connected&&t.disconnect()}});var ui,Ac=y(()=>{ui=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var Dy,Tc,di,kH,jhe,Mhe,EH,Fhe,AH,Ld,Cy,Fo=y(()=>{Ji();Dy=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=di.get(t),o=kH(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(EH(o,e,n,!0));return s},Tc=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=di.get(t),o=kH(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(EH(o,e,n,!1));return s},di=new WeakMap,kH=(t,e,r)=>{let n=jhe(e,r);return Mhe(n,e,r,t),n},jhe=(t,e)=>{let r=aT(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Ld(e)}" must not be "${t}". + ${qn("getOneMessage",t)}, + ${qn("sendMessage",t,"message, {strict: true}")}, +]);`)},Cy=(t,e)=>new Error(`${qn("sendMessage",e)} failed when sending an acknowledgment response to the ${Uo(e)}.`,{cause:t}),AH=t=>{throw new Error(`${qn("sendMessage",t)} failed: the ${Uo(t)} is not listening to incoming messages.`)},TH=t=>{throw new Error(`${qn("sendMessage",t)} failed: the ${Uo(t)} exited without listening to incoming messages.`)},OH=()=>new Error(`\`cancelSignal\` aborted: the ${Uo(!0)} disconnected.`),IH=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},PH=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${qn(e,r)} cannot be used: the ${Uo(r)} is disconnecting.`,{cause:t})},RH=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Lhe(t))throw new Error(`${qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Lhe=({code:t,message:e})=>Uhe.has(t)||qhe.some(r=>e.includes(r)),Uhe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),qhe=["could not be cloned","circular structure","call stack size exceeded"],qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Bhe(e)}${t}(${r})`,Bhe=t=>t?"":"subprocess.",Uo=t=>t?"parent process":"subprocess",Oc=t=>{t.connected&&t.disconnect()}});var hi,Pc=y(()=>{hi=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var Ny,Rc,gi,CH,Hhe,Zhe,DH,Ghe,NH,Hd,Dy,qo=y(()=>{eo();Ny=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=gi.get(t),o=CH(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(DH(o,e,n,!0));return s},Rc=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=gi.get(t),o=CH(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(DH(o,e,n,!1));return s},gi=new WeakMap,CH=(t,e,r)=>{let n=Hhe(e,r);return Zhe(n,e,r,t),n},Hhe=(t,e)=>{let r=dT(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Hd(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},Mhe=(t,e,r,n)=>{let i=n[AH(t)];if(i===void 0)throw new TypeError(`"${Ld(r)}" must not be ${e}. That file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${Ld(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Ld(r)}" must not be ${e}. It must be a writable stream, not readable.`)},EH=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=Fhe(t,r);return`The "${i}: ${Cy(o)}" option is incompatible with using "${Ld(n)}: ${Cy(e)}". -Please set this option with "pipe" instead.`},Fhe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=AH(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},AH=t=>t==="all"?1:t,Ld=t=>t?"to":"from",Cy=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as zhe}from"node:events";var Ws,Ny=y(()=>{Ws=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),zhe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var jy,OT,My,IT,TH,OH,Ud=y(()=>{jy=(t,e)=>{e&&OT(t)},OT=t=>{t.refCounted()},My=(t,e)=>{e&&IT(t)},IT=t=>{t.unrefCounted()},TH=(t,e)=>{e&&(IT(t),IT(t))},OH=(t,e)=>{e&&(OT(t),OT(t))}});import{once as Lhe}from"node:events";import{scheduler as Uhe}from"node:timers/promises";var IH,PH,Fy,RH=y(()=>{Ly();Ud();zy();Uy();IH=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(DH(i)||jH(i))return;Fy.has(t)||Fy.set(t,[]);let o=Fy.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await NH(t,n,i),await Uhe.yield();let s=await CH({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},PH=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{PT();let o=Fy.get(t);for(;o?.length>0;)await Lhe(n,"message:done");t.removeListener("message",i),OH(e,r),n.connected=!1,n.emit("disconnect")},Fy=new WeakMap});import{EventEmitter as qhe}from"node:events";var zo,qy,Bhe,By,qd=y(()=>{RH();Ud();zo=(t,e,r)=>{if(qy.has(t))return qy.get(t);let n=new qhe;return n.connected=!0,qy.set(t,n),Bhe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},qy=new WeakMap,Bhe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=IH.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",PH.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),TH(r,n)},By=t=>{let e=qy.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Hhe}from"node:events";var MH,Zhe,FH,CH,DH,zH,Hy,Ghe,Zy,LH,zy=y(()=>{Ac();Ny();Wy();Ec();qd();Ly();MH=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=zo(t,e,r),s=Gy(t,o);return{id:Zhe++,type:Zy,message:n,hasListeners:s}},Zhe=0n,FH=(t,e)=>{if(!(e?.type!==Zy||e.hasListeners))for(let{id:r}of t)r!==void 0&&Hy[r].resolve({isDeadlock:!0,hasListeners:!1})},CH=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Zy||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:LH,message:Gy(e,i)};try{await Vy({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},DH=t=>{if(t?.type!==LH)return!1;let{id:e,message:r}=t;return Hy[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},zH=async(t,e,r)=>{if(t?.type!==Zy)return;let n=ui();Hy[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,Ghe(e,r,i)]);o&&_H(r),s||vH(r)}finally{i.abort(),delete Hy[t.id]}},Hy={},Ghe=async(t,e,{signal:r})=>{Ws(t,1,r),await Hhe(t,"disconnect",{signal:r}),bH(e)},Zy="execa:ipc:request",LH="execa:ipc:response"});var UH,qH,NH,Bd,Gy,Vhe,Ly=y(()=>{Ac();Ji();Fo();zy();UH=(t,e,r)=>{Bd.has(t)||Bd.set(t,new Set);let n=Bd.get(t),i=ui(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},qH=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},NH=async(t,e,r)=>{for(;!Gy(t,e)&&Bd.get(t)?.size>0;){let n=[...Bd.get(t)];FH(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Bd=new WeakMap,Gy=(t,e)=>e.listenerCount("message")>Vhe(t),Vhe=t=>di.has(t)&&!Ki(di.get(t).options.buffer,"ipc")?1:0});import{promisify as Whe}from"node:util";var Vy,Khe,CT,Jhe,RT,Wy=y(()=>{Ec();Ly();zy();Vy=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return $c({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Khe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Khe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=MH({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=UH(t,s,o);try{await CT({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw kc(t),c}finally{qH(a)}},CT=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Jhe(t);try{await Promise.all([zH(n,t,r),o(n)])}catch(s){throw xH({error:s,methodName:e,isSubprocess:r}),$H({error:s,methodName:e,isSubprocess:r,message:i}),s}},Jhe=t=>{if(RT.has(t))return RT.get(t);let e=Whe(t.send.bind(t));return RT.set(t,e),e},RT=new WeakMap});import{scheduler as Yhe}from"node:timers/promises";var HH,ZH,Xhe,BH,jH,GH,PT,DT,Uy=y(()=>{Wy();qd();Ec();HH=(t,e)=>{let r="cancelSignal";return TT(r,!1,t.connected),CT({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:GH,message:e},message:e})},ZH=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Xhe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),DT.signal),Xhe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!BH){if(BH=!0,!n){wH();return}if(e===null){PT();return}zo(t,e,r),await Yhe.yield()}},BH=!1,jH=t=>t?.type!==GH?!1:(DT.abort(t.message),!0),GH="execa:ipc:cancel",PT=()=>{DT.abort(SH())},DT=new AbortController});var VH,WH,Qhe,ege,NT=y(()=>{ET();Uy();Iy();VH=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},WH=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Qhe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Qhe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await Py(e,i);let o=ege(e);throw await HH(t,o),kT({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},ege=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as tge}from"node:timers/promises";var KH,JH,rge,jT=y(()=>{Vs();KH=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},JH=(t,e,r,n)=>e===0||e===void 0?[]:[rge(t,e,r,n)],rge=async(t,e,r,{signal:n})=>{throw await tge(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Mn}});import{execPath as nge,execArgv as ige}from"node:process";import YH from"node:path";var XH,QH,MT=y(()=>{_c();XH=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},QH=(t,e,{node:r=!1,nodePath:n=nge,nodeOptions:i=ige.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=yc(n,'The "nodePath" option'),l=YH.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(YH.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as oge}from"node:v8";var eZ,sge,age,cge,tZ,FT=y(()=>{eZ=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");cge[r](t)}},sge=t=>{try{oge(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},age=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},cge={advanced:sge,json:age},tZ=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var nZ,lge,Hr,zT,uge,rZ,Ky,Ks=y(()=>{nZ=({encoding:t})=>{if(zT.has(t))return;let e=uge(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Ky(t)}\`. -Please rename it to ${Ky(e)}.`);let r=[...zT].map(n=>Ky(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Ky(t)}\`. -Please rename it to one of: ${r}.`)},lge=new Set(["utf8","utf16le"]),Hr=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),zT=new Set([...lge,...Hr]),uge=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in rZ)return rZ[e];if(zT.has(e))return e},rZ={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Ky=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as dge}from"node:fs";import fge from"node:path";import pge from"node:process";var iZ,oZ,sZ,LT=y(()=>{_c();iZ=(t=oZ())=>{let e=yc(t,'The "cwd" option');return fge.resolve(e)},oZ=()=>{try{return pge.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},sZ=(t,e)=>{if(e===oZ())return t;let r;try{r=dge(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},Zhe=(t,e,r,n)=>{let i=n[NH(t)];if(i===void 0)throw new TypeError(`"${Hd(r)}" must not be ${e}. That file descriptor does not exist. +Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${Hd(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Hd(r)}" must not be ${e}. It must be a writable stream, not readable.`)},DH=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=Ghe(t,r);return`The "${i}: ${Dy(o)}" option is incompatible with using "${Hd(n)}: ${Dy(e)}". +Please set this option with "pipe" instead.`},Ghe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=NH(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},NH=t=>t==="all"?1:t,Hd=t=>t?"to":"from",Dy=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Vhe}from"node:events";var Xs,jy=y(()=>{Xs=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Vhe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var My,CT,Fy,DT,jH,MH,Zd=y(()=>{My=(t,e)=>{e&&CT(t)},CT=t=>{t.refCounted()},Fy=(t,e)=>{e&&DT(t)},DT=t=>{t.unrefCounted()},jH=(t,e)=>{e&&(DT(t),DT(t))},MH=(t,e)=>{e&&(CT(t),CT(t))}});import{once as Whe}from"node:events";import{scheduler as Khe}from"node:timers/promises";var FH,zH,zy,LH=y(()=>{Uy();Zd();Ly();qy();FH=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(qH(i)||HH(i))return;zy.has(t)||zy.set(t,[]);let o=zy.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await BH(t,n,i),await Khe.yield();let s=await UH({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},zH=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{NT();let o=zy.get(t);for(;o?.length>0;)await Whe(n,"message:done");t.removeListener("message",i),MH(e,r),n.connected=!1,n.emit("disconnect")},zy=new WeakMap});import{EventEmitter as Jhe}from"node:events";var Bo,By,Yhe,Hy,Gd=y(()=>{LH();Zd();Bo=(t,e,r)=>{if(By.has(t))return By.get(t);let n=new Jhe;return n.connected=!0,By.set(t,n),Yhe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},By=new WeakMap,Yhe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=FH.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",zH.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),jH(r,n)},Hy=t=>{let e=By.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Xhe}from"node:events";var ZH,Qhe,GH,UH,qH,VH,Zy,ege,Gy,WH,Ly=y(()=>{Pc();jy();Ky();Ic();Gd();Uy();ZH=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=Bo(t,e,r),s=Vy(t,o);return{id:Qhe++,type:Gy,message:n,hasListeners:s}},Qhe=0n,GH=(t,e)=>{if(!(e?.type!==Gy||e.hasListeners))for(let{id:r}of t)r!==void 0&&Zy[r].resolve({isDeadlock:!0,hasListeners:!1})},UH=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Gy||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:WH,message:Vy(e,i)};try{await Wy({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},qH=t=>{if(t?.type!==WH)return!1;let{id:e,message:r}=t;return Zy[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},VH=async(t,e,r)=>{if(t?.type!==Gy)return;let n=hi();Zy[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,ege(e,r,i)]);o&&EH(r),s||AH(r)}finally{i.abort(),delete Zy[t.id]}},Zy={},ege=async(t,e,{signal:r})=>{Xs(t,1,r),await Xhe(t,"disconnect",{signal:r}),TH(e)},Gy="execa:ipc:request",WH="execa:ipc:response"});var KH,JH,BH,Vd,Vy,tge,Uy=y(()=>{Pc();eo();qo();Ly();KH=(t,e,r)=>{Vd.has(t)||Vd.set(t,new Set);let n=Vd.get(t),i=hi(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},JH=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},BH=async(t,e,r)=>{for(;!Vy(t,e)&&Vd.get(t)?.size>0;){let n=[...Vd.get(t)];GH(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Vd=new WeakMap,Vy=(t,e)=>e.listenerCount("message")>tge(t),tge=t=>gi.has(t)&&!Qi(gi.get(t).options.buffer,"ipc")?1:0});import{promisify as rge}from"node:util";var Wy,nge,MT,ige,jT,Ky=y(()=>{Ic();Uy();Ly();Wy=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Tc({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),nge({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},nge=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=ZH({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=KH(t,s,o);try{await MT({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Oc(t),c}finally{JH(a)}},MT=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=ige(t);try{await Promise.all([VH(n,t,r),o(n)])}catch(s){throw PH({error:s,methodName:e,isSubprocess:r}),RH({error:s,methodName:e,isSubprocess:r,message:i}),s}},ige=t=>{if(jT.has(t))return jT.get(t);let e=rge(t.send.bind(t));return jT.set(t,e),e},jT=new WeakMap});import{scheduler as oge}from"node:timers/promises";var XH,QH,sge,YH,HH,eZ,NT,FT,qy=y(()=>{Ky();Gd();Ic();XH=(t,e)=>{let r="cancelSignal";return RT(r,!1,t.connected),MT({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:eZ,message:e},message:e})},QH=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await sge({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),FT.signal),sge=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!YH){if(YH=!0,!n){IH();return}if(e===null){NT();return}Bo(t,e,r),await oge.yield()}},YH=!1,HH=t=>t?.type!==eZ?!1:(FT.abort(t.message),!0),eZ="execa:ipc:cancel",NT=()=>{FT.abort(OH())},FT=new AbortController});var tZ,rZ,age,cge,zT=y(()=>{IT();qy();Py();tZ=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},rZ=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[age({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],age=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await Ry(e,i);let o=cge(e);throw await XH(t,o),OT({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},cge=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as lge}from"node:timers/promises";var nZ,iZ,uge,LT=y(()=>{Ys();nZ=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},iZ=(t,e,r,n)=>e===0||e===void 0?[]:[uge(t,e,r,n)],uge=async(t,e,r,{signal:n})=>{throw await lge(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Un}});import{execPath as dge,execArgv as fge}from"node:process";import oZ from"node:path";var sZ,aZ,UT=y(()=>{wc();sZ=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},aZ=(t,e,{node:r=!1,nodePath:n=dge,nodeOptions:i=fge.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=Sc(n,'The "nodePath" option'),l=oZ.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(oZ.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as pge}from"node:v8";var cZ,mge,hge,gge,lZ,qT=y(()=>{cZ=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");gge[r](t)}},mge=t=>{try{pge(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},hge=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},gge={advanced:mge,json:hge},lZ=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var dZ,yge,Wr,BT,_ge,uZ,Jy,Qs=y(()=>{dZ=({encoding:t})=>{if(BT.has(t))return;let e=_ge(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Jy(t)}\`. +Please rename it to ${Jy(e)}.`);let r=[...BT].map(n=>Jy(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Jy(t)}\`. +Please rename it to one of: ${r}.`)},yge=new Set(["utf8","utf16le"]),Wr=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),BT=new Set([...yge,...Wr]),_ge=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in uZ)return uZ[e];if(BT.has(e))return e},uZ={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Jy=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as bge}from"node:fs";import vge from"node:path";import Sge from"node:process";var fZ,pZ,mZ,HT=y(()=>{wc();fZ=(t=pZ())=>{let e=Sc(t,'The "cwd" option');return vge.resolve(e)},pZ=()=>{try{return Sge.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},mZ=(t,e)=>{if(e===pZ())return t;let r;try{r=bge(e)}catch(n){return`The "cwd" option is invalid: ${e}. ${n.message} ${t}`}return r.isDirectory()?t:`The "cwd" option is not a directory: ${e}. -${t}`}});import mge from"node:path";import aZ from"node:process";var cZ,Jy,hge,gge,UT=y(()=>{cZ=$t(qB(),1);KB();Iy();zd();AT();NT();jT();MT();FT();Ks();LT();_c();Ji();Jy=(t,e,r)=>{r.cwd=iZ(r.cwd);let[n,i,o]=QH(t,e,r),{command:s,args:a,options:c}=cZ.default._parse(n,i,o),l=P6(c),u=hge(l);return KH(u),nZ(u),eZ(u),hH(u),VH(u),u.shell=rT(u.shell),u.env=gge(u),u.killSignal=uH(u.killSignal),u.forceKillAfterDelay=pH(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!Hr.has(u.encoding)&&u.buffer[f]),aZ.platform==="win32"&&mge.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},hge=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),gge=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...aZ.env,...t}:t;return r||n?WB({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Yy,qT=y(()=>{Yy=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Oc(t){if(typeof t=="string")return yge(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return _ge(t)}var yge,_ge,lZ,vge,uZ,bge,BT=y(()=>{yge=t=>t.at(-1)===lZ?t.slice(0,t.at(-2)===uZ?-2:-1):t,_ge=t=>t.at(-1)===vge?t.subarray(0,t.at(-2)===bge?-2:-1):t,lZ=` -`,vge=lZ.codePointAt(0),uZ="\r",bge=uZ.codePointAt(0)});function zn(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function HT(t,{checkOpen:e=!0}={}){return zn(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Js(t,{checkOpen:e=!0}={}){return zn(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function ZT(t,e){return HT(t,e)&&Js(t,e)}var Ys=y(()=>{});function dZ(){return this[VT].next()}function fZ(t){return this[VT].return(t)}function WT({preventCancel:t=!1}={}){let e=this.getReader(),r=new GT(e,t),n=Object.create(wge);return n[VT]=r,n}var Sge,GT,VT,wge,pZ=y(()=>{Sge=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),GT=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},VT=Symbol();Object.defineProperty(dZ,"name",{value:"next"});Object.defineProperty(fZ,"name",{value:"return"});wge=Object.create(Sge,{next:{enumerable:!0,configurable:!0,writable:!0,value:dZ},return:{enumerable:!0,configurable:!0,writable:!0,value:fZ}})});var mZ=y(()=>{});var hZ=y(()=>{pZ();mZ()});var gZ,xge,$ge,kge,Hd,KT=y(()=>{Ys();hZ();gZ=t=>{if(Js(t,{checkOpen:!1})&&Hd.on!==void 0)return $ge(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(xge.call(t)==="[object ReadableStream]")return WT.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:xge}=Object.prototype,$ge=async function*(t){let e=new AbortController,r={};kge(t,e,r);try{for await(let[n]of Hd.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},kge=async(t,e,r)=>{try{await Hd.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Hd={}});var Ic,Ege,vZ,yZ,Age,_Z,fi,Zd=y(()=>{KT();Ic=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=gZ(t),u=e();u.length=0;try{for await(let d of l){let f=Age(d),p=r[f](d,u);vZ({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Ege({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},Ege=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&vZ({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},vZ=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){yZ(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&yZ(c,e,i,o),new fi},yZ=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Age=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=_Z.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&_Z.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:_Z}=Object.prototype,fi=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var Yi,Gd,Xy,Qy,e_,t_=y(()=>{Yi=t=>t,Gd=()=>{},Xy=({contents:t})=>t,Qy=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},e_=t=>t.length});async function r_(t,e){return Ic(t,Pge,e)}var Tge,Oge,Ige,Pge,bZ=y(()=>{Zd();t_();Tge=()=>({contents:[]}),Oge=()=>1,Ige=(t,{contents:e})=>(e.push(t),e),Pge={init:Tge,convertChunk:{string:Yi,buffer:Yi,arrayBuffer:Yi,dataView:Yi,typedArray:Yi,others:Yi},getSize:Oge,truncateChunk:Gd,addChunk:Ige,getFinalChunk:Gd,finalize:Xy}});async function n_(t,e){return Ic(t,Lge,e)}var Rge,Cge,Dge,SZ,wZ,Nge,jge,Mge,Fge,$Z,xZ,zge,kZ,Lge,EZ=y(()=>{Zd();t_();Rge=()=>({contents:new ArrayBuffer(0)}),Cge=t=>Dge.encode(t),Dge=new TextEncoder,SZ=t=>new Uint8Array(t),wZ=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Nge=(t,e)=>t.slice(0,e),jge=(t,{contents:e,length:r},n)=>{let i=kZ()?Fge(e,n):Mge(e,n);return new Uint8Array(i).set(t,r),i},Mge=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer($Z(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Fge=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:$Z(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},$Z=t=>xZ**Math.ceil(Math.log(t)/Math.log(xZ)),xZ=2,zge=({contents:t,length:e})=>kZ()?t:t.slice(0,e),kZ=()=>"resize"in ArrayBuffer.prototype,Lge={init:Rge,convertChunk:{string:Cge,buffer:SZ,arrayBuffer:SZ,dataView:wZ,typedArray:wZ,others:Qy},getSize:e_,truncateChunk:Nge,addChunk:jge,getFinalChunk:Gd,finalize:zge}});async function o_(t,e){return Ic(t,Zge,e)}var Uge,i_,qge,Bge,Hge,Zge,AZ=y(()=>{Zd();t_();Uge=()=>({contents:"",textDecoder:new TextDecoder}),i_=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),qge=(t,{contents:e})=>e+t,Bge=(t,e)=>t.slice(0,e),Hge=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Zge={init:Uge,convertChunk:{string:Yi,buffer:i_,arrayBuffer:i_,dataView:i_,typedArray:i_,others:Qy},getSize:e_,truncateChunk:Bge,addChunk:qge,getFinalChunk:Hge,finalize:Xy}});var TZ=y(()=>{bZ();EZ();AZ();Zd()});import{on as Gge}from"node:events";import{finished as Vge}from"node:stream/promises";var s_=y(()=>{KT();TZ();Object.assign(Hd,{on:Gge,finished:Vge})});var OZ,Wge,IZ,PZ,Kge,RZ,CZ,a_,Xs=y(()=>{s_();Wi();Ji();OZ=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof fi))throw t;if(o==="all")return t;let s=Wge(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Wge=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",IZ=(t,e,r)=>{if(e.length!==r)return;let n=new fi;throw n.maxBufferInfo={fdNumber:"ipc"},n},PZ=(t,e)=>{let{streamName:r,threshold:n,unit:i}=Kge(t,e);return`Command's ${r} was larger than ${n} ${i}`},Kge=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=Ki(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:py(r),threshold:i,unit:n}},RZ=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>a_(r)),CZ=(t,e,r)=>{if(!e)return t;let n=a_(r);return t.length>n?t.slice(0,n):t},a_=([,t])=>t});import{inspect as Jge}from"node:util";var NZ,Yge,Xge,Qge,eye,tye,DZ,jZ=y(()=>{BT();Br();LT();gy();Xs();zd();Vs();NZ=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:v})=>{let _=n?.code,S=Yge({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),w=Qge(n,v),x=w===void 0?"":` -${w}`,I=`${S}: ${a}${x}`,T=e===void 0?[t[2],t[1]]:[e],k=[I,...T,...t.slice(3),r.map(C=>eye(C)).join(` -`)].map(C=>Nd(Oc(tye(C)))).filter(Boolean).join(` - -`);return{originalMessage:w,shortMessage:I,message:k}},Yge=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Xge(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${PZ(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${Oy(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Xge=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Qge=(t,e)=>{if(t instanceof Mn)return;let r=XB(t)?t.originalMessage:String(t?.message??t),n=Nd(sZ(r,e));return n===""?void 0:n},eye=t=>typeof t=="string"?t:Jge(t),tye=t=>Array.isArray(t)?t.map(e=>Oc(DZ(e))).filter(Boolean).join(` -`):DZ(t),DZ=t=>typeof t=="string"?t:Mt(t)?dy(t):""});var c_,Pc,Vd,rye,MZ,nye,Wd=y(()=>{zd();wy();Vs();jZ();c_=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>MZ({command:t,escapedCommand:e,cwd:o,durationMs:fT(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Pc=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Vd({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),Vd=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:v,cwd:_,maxBuffer:S},isSync:w})=>{let{exitCode:x,signal:I,signalDescription:T}=nye(l,u),{originalMessage:k,shortMessage:C,message:E}=NZ({stdio:d,all:f,ipcOutput:p,originalError:t,signal:I,signalDescription:T,exitCode:x,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:v,maxBuffer:S,timeout:h,cwd:_}),Z=JB(t,E,w);return Object.assign(Z,rye({error:Z,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:x,signal:I,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:k,shortMessage:C})),Z},rye=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:v})=>MZ({shortMessage:v,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:fT(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),MZ=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),nye=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:Oy(e);return{exitCode:r,signal:n,signalDescription:i}}});function iye(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(FZ(t*1e3)%1e3),nanoseconds:Math.trunc(FZ(t*1e6)%1e3)}}function oye(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function JT(t){switch(typeof t){case"number":{if(Number.isFinite(t))return iye(t);break}case"bigint":return oye(t)}throw new TypeError("Expected a finite number or bigint")}var FZ,zZ=y(()=>{FZ=t=>Number.isFinite(t)?t:0});function YT(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+cye);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&sye(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+aye(d,u):f;i.push(p)}},a=JT(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),v=h?m.toFixed(h):g;s(Number.parseFloat(v),"millisecond","ms",v)}}else{let u=(r?Number(t%lye):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var sye,aye,cye,lye,LZ=y(()=>{zZ();sye=t=>t===0||t===0n,aye=(t,e)=>e===1||e===1n?t:`${t}s`,cye=1e-7,lye=24n*60n*60n*1000n});var UZ,qZ=y(()=>{Sc();UZ=(t,e)=>{t.failed&&li({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var BZ,uye,HZ=y(()=>{LZ();jo();Sc();qZ();BZ=(t,e)=>{vc(e)&&(UZ(t,e),uye(t,e))},uye=(t,e)=>{let r=`(done in ${YT(t.durationMs)})`;li({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Rc,l_=y(()=>{HZ();Rc=(t,e,{reject:r})=>{if(BZ(t,e),t.failed&&r)throw t;return t}});var VZ,dye,fye,WZ,KZ,ZZ,pye,XT,GZ,Qs,JZ,mye,u_,YZ,hye,gye,QT,XZ,yye,QZ,d_,_ye,eO,vye,bye,eG,pn,f_,tO,tG,rG,Lo,dr=y(()=>{Ys();Gi();Br();VZ=(t,e)=>Qs(t)?"asyncGenerator":JZ(t)?"generator":u_(t)?"fileUrl":hye(t)?"filePath":_ye(t)?"webStream":zn(t,{checkOpen:!1})?"native":Mt(t)?"uint8Array":vye(t)?"asyncIterable":bye(t)?"iterable":eO(t)?WZ({transform:t},e):mye(t)?dye(t,e):"native",dye=(t,e)=>ZT(t.transform,{checkOpen:!1})?fye(t,e):eO(t.transform)?WZ(t,e):pye(t,e),fye=(t,e)=>(KZ(t,e,"Duplex stream"),"duplex"),WZ=(t,e)=>(KZ(t,e,"web TransformStream"),"webTransform"),KZ=({final:t,binary:e,objectMode:r},n,i)=>{ZZ(t,`${n}.final`,i),ZZ(e,`${n}.binary`,i),XT(r,`${n}.objectMode`)},ZZ=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},pye=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!GZ(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(ZT(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(eO(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!GZ(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return XT(r,`${i}.binary`),XT(n,`${i}.objectMode`),Qs(t)||Qs(e)?"asyncGenerator":"generator"},XT=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},GZ=t=>Qs(t)||JZ(t),Qs=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",JZ=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",mye=t=>kt(t)&&(t.transform!==void 0||t.final!==void 0),u_=t=>Object.prototype.toString.call(t)==="[object URL]",YZ=t=>u_(t)&&t.protocol!=="file:",hye=t=>kt(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>gye.has(e))&&QT(t.file),gye=new Set(["file","append"]),QT=t=>typeof t=="string",XZ=(t,e)=>t==="native"&&typeof e=="string"&&!yye.has(e),yye=new Set(["ipc","ignore","inherit","overlapped","pipe"]),QZ=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",d_=t=>Object.prototype.toString.call(t)==="[object WritableStream]",_ye=t=>QZ(t)||d_(t),eO=t=>QZ(t?.readable)&&d_(t?.writable),vye=t=>eG(t)&&typeof t[Symbol.asyncIterator]=="function",bye=t=>eG(t)&&typeof t[Symbol.iterator]=="function",eG=t=>typeof t=="object"&&t!==null,pn=new Set(["generator","asyncGenerator","duplex","webTransform"]),f_=new Set(["fileUrl","filePath","fileNumber"]),tO=new Set(["fileUrl","filePath"]),tG=new Set([...tO,"webStream","nodeStream"]),rG=new Set(["webTransform","duplex"]),Lo={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var rO,Sye,wye,nG,nO=y(()=>{dr();rO=(t,e,r,n)=>n==="output"?Sye(t,e,r):wye(t,e,r),Sye=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},wye=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},nG=(t,e)=>{let r=t.findLast(({type:n})=>pn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var iG,xye,$ye,kye,Eye,Aye,Tye,oG=y(()=>{Gi();Ks();dr();nO();iG=(t,e,r,n)=>[...t.filter(({type:i})=>!pn.has(i)),...xye(t,e,r,n)],xye=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>pn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=$ye({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Tye(o,r)},$ye=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?kye({stdioItem:t,optionName:i}):e==="webTransform"?Eye({stdioItem:t,index:r,newTransforms:n,direction:o}):Aye({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),kye=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},Eye=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=kt(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=rO(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Aye=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=kt(e)?e:{transform:e},d=c||Hr.has(o),{writableObjectMode:f,readableObjectMode:p}=rO(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Tye=(t,e)=>e==="input"?t.reverse():t});import iO from"node:process";var sG,Oye,Iye,Cc,oO,aG,Pye,Rye,cG=y(()=>{Ys();dr();sG=(t,e,r)=>{let n=t.map(i=>Oye(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??Rye},Oye=({type:t,value:e},r)=>Iye[r]??aG[t](e),Iye=["input","output","output"],Cc=()=>{},oO=()=>"input",aG={generator:Cc,asyncGenerator:Cc,fileUrl:Cc,filePath:Cc,iterable:oO,asyncIterable:oO,uint8Array:oO,webStream:t=>d_(t)?"output":"input",nodeStream(t){return Js(t,{checkOpen:!1})?HT(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Cc,duplex:Cc,native(t){let e=Pye(t);if(e!==void 0)return e;if(zn(t,{checkOpen:!1}))return aG.nodeStream(t)}},Pye=t=>{if([0,iO.stdin].includes(t))return"input";if([1,2,iO.stdout,iO.stderr].includes(t))return"output"},Rye="output"});var lG,uG=y(()=>{lG=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var dG,Cye,Dye,fG,Nye,jye,pG=y(()=>{Wi();uG();jo();dG=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Cye(t,n).map((a,c)=>fG(a,c));return o?Nye(s,r,i):lG(s,e)},Cye=(t,e)=>{if(t===void 0)return fn.map(n=>e[n]);if(Dye(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${fn.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,fn.length);return Array.from({length:r},(n,i)=>t[i])},Dye=t=>fn.some(e=>t[e]!==void 0),fG=(t,e)=>Array.isArray(t)?t.map(r=>fG(r,e)):t??(e>=fn.length?"ignore":"pipe"),Nye=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!bc(r,i)&&jye(n)?"ignore":n),jye=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Mye}from"node:fs";import Fye from"node:tty";var hG,zye,Lye,Uye,qye,mG,gG=y(()=>{Ys();Wi();Br();Fo();hG=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?zye({stdioItem:t,fdNumber:n,direction:i}):qye({stdioItem:t,fdNumber:n}),zye=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Lye({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(zn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Lye=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Uye(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Fye.isatty(i))throw new TypeError(`The \`${e}: ${Cy(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Vi(Mye(i)),optionName:e}}},Uye=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=fy.indexOf(t);if(r!==-1)return r},qye=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:mG(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:mG(e,e,r),optionName:r}:zn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,mG=(t,e,r)=>{let n=fy[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var yG,Bye,Hye,Zye,Gye,_G=y(()=>{Ys();Br();dr();yG=({input:t,inputFile:e},r)=>r===0?[...Bye(t),...Zye(e)]:[],Bye=t=>t===void 0?[]:[{type:Hye(t),value:t,optionName:"input"}],Hye=t=>{if(Js(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Mt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Zye=t=>t===void 0?[]:[{...Gye(t),optionName:"inputFile"}],Gye=t=>{if(u_(t))return{type:"fileUrl",value:t};if(QT(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var vG,bG,Vye,Wye,SG,Kye,Jye,wG,xG=y(()=>{dr();vG=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),bG=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Vye(i,t);if(s.length!==0){if(o){Wye({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(tG.has(t))return SG({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});rG.has(t)&&Jye({otherStdioItems:s,type:t,value:e,optionName:r})}},Vye=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Wye=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{tO.has(e)&&SG({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},SG=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Kye(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return wG(s,n,e),i==="output"?o[0].stream:void 0},Kye=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Jye=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);wG(i,n,e)},wG=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${Lo[r]} that is the same.`)}});var p_,Yye,Xye,Qye,e_e,t_e,r_e,n_e,i_e,o_e,s_e,a_e,sO,c_e,m_=y(()=>{Wi();oG();nO();dr();cG();pG();gG();_G();xG();p_=(t,e,r,n)=>{let o=dG(e,r,n).map((a,c)=>Yye({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=o_e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>c_e(a)),s},Yye=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=py(e),{stdioItems:o,isStdioArray:s}=Xye({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=sG(o,e,i),c=o.map(d=>hG({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=iG(c,i,a,r),u=nG(l,a);return i_e(l,u),{direction:a,objectMode:u,stdioItems:l}},Xye=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Qye(c,n)),...yG(r,e)],s=vG(o),a=s.length>1;return e_e(s,a,n),r_e(s),{stdioItems:s,isStdioArray:a}},Qye=(t,e)=>({type:VZ(t,e),value:t,optionName:e}),e_e=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(t_e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},t_e=new Set(["ignore","ipc"]),r_e=t=>{for(let e of t)n_e(e)},n_e=({type:t,value:e,optionName:r})=>{if(YZ(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. -For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(XZ(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},i_e=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>f_.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},o_e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(s_e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw sO(i),o}},s_e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>a_e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},a_e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=bG({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},sO=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!jn(r)&&r.destroy()},c_e=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as $G}from"node:fs";var EG,pi,l_e,AG,kG,u_e,TG=y(()=>{Br();m_();dr();EG=(t,e)=>p_(u_e,t,e,!0),pi=({type:t,optionName:e})=>{AG(e,Lo[t])},l_e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&AG(t,`"${e}"`),{}),AG=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},kG={generator(){},asyncGenerator:pi,webStream:pi,nodeStream:pi,webTransform:pi,duplex:pi,asyncIterable:pi,native:l_e},u_e={input:{...kG,fileUrl:({value:t})=>({contents:[Vi($G(t))]}),filePath:({value:{file:t}})=>({contents:[Vi($G(t))]}),fileNumber:pi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...kG,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:pi,string:pi,uint8Array:pi}}});var Xi,aO,Kd=y(()=>{BT();Xi=(t,{stripFinalNewline:e},r)=>aO(e,r)&&t!==void 0&&!Array.isArray(t)?Oc(t):t,aO=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var h_,lO,OG,IG,d_e,f_e,p_e,PG,m_e,cO,h_e,g_e,y_e,g_=y(()=>{h_=(t,e,r,n)=>t||r?void 0:IG(e,n),lO=(t,e,r)=>r?t.flatMap(n=>OG(n,e)):OG(t,e),OG=(t,e)=>{let{transform:r,final:n}=IG(e,{});return[...r(t),...n()]},IG=(t,e)=>(e.previousChunks="",{transform:d_e.bind(void 0,e,t),final:p_e.bind(void 0,e)}),d_e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=cO(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=cO(n,r.slice(i+1))),t.previousChunks=n},f_e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),p_e=function*({previousChunks:t}){t.length>0&&(yield t)},PG=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:m_e.bind(void 0,n)},m_e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?h_e:y_e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},cO=(t,e)=>`${t}${e}`,h_e={windowsNewline:`\r +${t}`}});import wge from"node:path";import hZ from"node:process";var gZ,Yy,xge,$ge,ZT=y(()=>{gZ=kt(JB(),1);nH();Py();Bd();PT();zT();LT();UT();qT();Qs();HT();wc();eo();Yy=(t,e,r)=>{r.cwd=fZ(r.cwd);let[n,i,o]=aZ(t,e,r),{command:s,args:a,options:c}=gZ.default._parse(n,i,o),l=z6(c),u=xge(l);return nZ(u),dZ(u),cZ(u),xH(u),tZ(u),u.shell=sT(u.shell),u.env=$ge(u),u.killSignal=_H(u.killSignal),u.forceKillAfterDelay=SH(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!Wr.has(u.encoding)&&u.buffer[f]),hZ.platform==="win32"&&wge.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},xge=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),$ge=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...hZ.env,...t}:t;return r||n?rH({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Xy,GT=y(()=>{Xy=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Cc(t){if(typeof t=="string")return kge(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Ege(t)}var kge,Ege,yZ,Age,_Z,Tge,VT=y(()=>{kge=t=>t.at(-1)===yZ?t.slice(0,t.at(-2)===_Z?-2:-1):t,Ege=t=>t.at(-1)===Age?t.subarray(0,t.at(-2)===Tge?-2:-1):t,yZ=` +`,Age=yZ.codePointAt(0),_Z="\r",Tge=_Z.codePointAt(0)});function Bn(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function WT(t,{checkOpen:e=!0}={}){return Bn(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function ea(t,{checkOpen:e=!0}={}){return Bn(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function KT(t,e){return WT(t,e)&&ea(t,e)}var ta=y(()=>{});function bZ(){return this[YT].next()}function vZ(t){return this[YT].return(t)}function XT({preventCancel:t=!1}={}){let e=this.getReader(),r=new JT(e,t),n=Object.create(Ige);return n[YT]=r,n}var Oge,JT,YT,Ige,SZ=y(()=>{Oge=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),JT=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},YT=Symbol();Object.defineProperty(bZ,"name",{value:"next"});Object.defineProperty(vZ,"name",{value:"return"});Ige=Object.create(Oge,{next:{enumerable:!0,configurable:!0,writable:!0,value:bZ},return:{enumerable:!0,configurable:!0,writable:!0,value:vZ}})});var wZ=y(()=>{});var xZ=y(()=>{SZ();wZ()});var $Z,Pge,Rge,Cge,Wd,QT=y(()=>{ta();xZ();$Z=t=>{if(ea(t,{checkOpen:!1})&&Wd.on!==void 0)return Rge(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Pge.call(t)==="[object ReadableStream]")return XT.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Pge}=Object.prototype,Rge=async function*(t){let e=new AbortController,r={};Cge(t,e,r);try{for await(let[n]of Wd.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},Cge=async(t,e,r)=>{try{await Wd.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Wd={}});var Dc,Dge,AZ,kZ,Nge,EZ,yi,Kd=y(()=>{QT();Dc=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=$Z(t),u=e();u.length=0;try{for await(let d of l){let f=Nge(d),p=r[f](d,u);AZ({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Dge({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},Dge=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&AZ({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},AZ=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){kZ(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&kZ(c,e,i,o),new yi},kZ=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Nge=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=EZ.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&EZ.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:EZ}=Object.prototype,yi=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var to,Jd,Qy,e_,t_,r_=y(()=>{to=t=>t,Jd=()=>{},Qy=({contents:t})=>t,e_=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},t_=t=>t.length});async function n_(t,e){return Dc(t,zge,e)}var jge,Mge,Fge,zge,TZ=y(()=>{Kd();r_();jge=()=>({contents:[]}),Mge=()=>1,Fge=(t,{contents:e})=>(e.push(t),e),zge={init:jge,convertChunk:{string:to,buffer:to,arrayBuffer:to,dataView:to,typedArray:to,others:to},getSize:Mge,truncateChunk:Jd,addChunk:Fge,getFinalChunk:Jd,finalize:Qy}});async function i_(t,e){return Dc(t,Wge,e)}var Lge,Uge,qge,OZ,IZ,Bge,Hge,Zge,Gge,RZ,PZ,Vge,CZ,Wge,DZ=y(()=>{Kd();r_();Lge=()=>({contents:new ArrayBuffer(0)}),Uge=t=>qge.encode(t),qge=new TextEncoder,OZ=t=>new Uint8Array(t),IZ=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Bge=(t,e)=>t.slice(0,e),Hge=(t,{contents:e,length:r},n)=>{let i=CZ()?Gge(e,n):Zge(e,n);return new Uint8Array(i).set(t,r),i},Zge=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(RZ(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Gge=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:RZ(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},RZ=t=>PZ**Math.ceil(Math.log(t)/Math.log(PZ)),PZ=2,Vge=({contents:t,length:e})=>CZ()?t:t.slice(0,e),CZ=()=>"resize"in ArrayBuffer.prototype,Wge={init:Lge,convertChunk:{string:Uge,buffer:OZ,arrayBuffer:OZ,dataView:IZ,typedArray:IZ,others:e_},getSize:t_,truncateChunk:Bge,addChunk:Hge,getFinalChunk:Jd,finalize:Vge}});async function s_(t,e){return Dc(t,Qge,e)}var Kge,o_,Jge,Yge,Xge,Qge,NZ=y(()=>{Kd();r_();Kge=()=>({contents:"",textDecoder:new TextDecoder}),o_=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Jge=(t,{contents:e})=>e+t,Yge=(t,e)=>t.slice(0,e),Xge=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Qge={init:Kge,convertChunk:{string:to,buffer:o_,arrayBuffer:o_,dataView:o_,typedArray:o_,others:e_},getSize:t_,truncateChunk:Yge,addChunk:Jge,getFinalChunk:Xge,finalize:Qy}});var jZ=y(()=>{TZ();DZ();NZ();Kd()});import{on as eye}from"node:events";import{finished as tye}from"node:stream/promises";var a_=y(()=>{QT();jZ();Object.assign(Wd,{on:eye,finished:tye})});var MZ,rye,FZ,zZ,nye,LZ,UZ,c_,ra=y(()=>{a_();Xi();eo();MZ=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof yi))throw t;if(o==="all")return t;let s=rye(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},rye=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",FZ=(t,e,r)=>{if(e.length!==r)return;let n=new yi;throw n.maxBufferInfo={fdNumber:"ipc"},n},zZ=(t,e)=>{let{streamName:r,threshold:n,unit:i}=nye(t,e);return`Command's ${r} was larger than ${n} ${i}`},nye=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=Qi(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:my(r),threshold:i,unit:n}},LZ=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>c_(r)),UZ=(t,e,r)=>{if(!e)return t;let n=c_(r);return t.length>n?t.slice(0,n):t},c_=([,t])=>t});import{inspect as iye}from"node:util";var BZ,oye,sye,aye,cye,lye,qZ,HZ=y(()=>{VT();Vr();HT();yy();ra();Bd();Ys();BZ=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=oye({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=aye(n,b),w=x===void 0?"":` +${x}`,R=`${S}: ${a}${w}`,A=e===void 0?[t[2],t[1]]:[e],E=[R,...A,...t.slice(3),r.map(C=>cye(C)).join(` +`)].map(C=>zd(Cc(lye(C)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:R,message:E}},oye=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=sye(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${zZ(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${Iy(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},sye=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",aye=(t,e)=>{if(t instanceof Un)return;let r=sH(t)?t.originalMessage:String(t?.message??t),n=zd(mZ(r,e));return n===""?void 0:n},cye=t=>typeof t=="string"?t:iye(t),lye=t=>Array.isArray(t)?t.map(e=>Cc(qZ(e))).filter(Boolean).join(` +`):qZ(t),qZ=t=>typeof t=="string"?t:Ft(t)?fy(t):""});var l_,Nc,Yd,uye,ZZ,dye,Xd=y(()=>{Bd();xy();Ys();HZ();l_=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>ZZ({command:t,escapedCommand:e,cwd:o,durationMs:gT(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Nc=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Yd({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),Yd=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:R,signalDescription:A}=dye(l,u),{originalMessage:E,shortMessage:C,message:k}=BZ({stdio:d,all:f,ipcOutput:p,originalError:t,signal:R,signalDescription:A,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),L=iH(t,k,x);return Object.assign(L,uye({error:L,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:R,signalDescription:A,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:E,shortMessage:C})),L},uye=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>ZZ({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:gT(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),ZZ=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),dye=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:Iy(e);return{exitCode:r,signal:n,signalDescription:i}}});function fye(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(GZ(t*1e3)%1e3),nanoseconds:Math.trunc(GZ(t*1e6)%1e3)}}function pye(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function eO(t){switch(typeof t){case"number":{if(Number.isFinite(t))return fye(t);break}case"bigint":return pye(t)}throw new TypeError("Expected a finite number or bigint")}var GZ,VZ=y(()=>{GZ=t=>Number.isFinite(t)?t:0});function tO(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+gye);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&mye(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+hye(d,u):f;i.push(p)}},a=eO(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%yye):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var mye,hye,gye,yye,WZ=y(()=>{VZ();mye=t=>t===0||t===0n,hye=(t,e)=>e===1||e===1n?t:`${t}s`,gye=1e-7,yye=24n*60n*60n*1000n});var KZ,JZ=y(()=>{kc();KZ=(t,e)=>{t.failed&&mi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var YZ,_ye,XZ=y(()=>{WZ();Lo();kc();JZ();YZ=(t,e)=>{xc(e)&&(KZ(t,e),_ye(t,e))},_ye=(t,e)=>{let r=`(done in ${tO(t.durationMs)})`;mi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var jc,u_=y(()=>{XZ();jc=(t,e,{reject:r})=>{if(YZ(t,e),t.failed&&r)throw t;return t}});var tG,bye,vye,rG,nG,QZ,Sye,rO,eG,na,iG,wye,d_,oG,xye,$ye,nO,sG,kye,aG,f_,Eye,iO,Aye,Tye,cG,hn,p_,oO,lG,uG,Ho,hr=y(()=>{ta();Ji();Vr();tG=(t,e)=>na(t)?"asyncGenerator":iG(t)?"generator":d_(t)?"fileUrl":xye(t)?"filePath":Eye(t)?"webStream":Bn(t,{checkOpen:!1})?"native":Ft(t)?"uint8Array":Aye(t)?"asyncIterable":Tye(t)?"iterable":iO(t)?rG({transform:t},e):wye(t)?bye(t,e):"native",bye=(t,e)=>KT(t.transform,{checkOpen:!1})?vye(t,e):iO(t.transform)?rG(t,e):Sye(t,e),vye=(t,e)=>(nG(t,e,"Duplex stream"),"duplex"),rG=(t,e)=>(nG(t,e,"web TransformStream"),"webTransform"),nG=({final:t,binary:e,objectMode:r},n,i)=>{QZ(t,`${n}.final`,i),QZ(e,`${n}.binary`,i),rO(r,`${n}.objectMode`)},QZ=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Sye=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!eG(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(KT(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(iO(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!eG(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return rO(r,`${i}.binary`),rO(n,`${i}.objectMode`),na(t)||na(e)?"asyncGenerator":"generator"},rO=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},eG=t=>na(t)||iG(t),na=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",iG=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",wye=t=>Et(t)&&(t.transform!==void 0||t.final!==void 0),d_=t=>Object.prototype.toString.call(t)==="[object URL]",oG=t=>d_(t)&&t.protocol!=="file:",xye=t=>Et(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>$ye.has(e))&&nO(t.file),$ye=new Set(["file","append"]),nO=t=>typeof t=="string",sG=(t,e)=>t==="native"&&typeof e=="string"&&!kye.has(e),kye=new Set(["ipc","ignore","inherit","overlapped","pipe"]),aG=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",f_=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Eye=t=>aG(t)||f_(t),iO=t=>aG(t?.readable)&&f_(t?.writable),Aye=t=>cG(t)&&typeof t[Symbol.asyncIterator]=="function",Tye=t=>cG(t)&&typeof t[Symbol.iterator]=="function",cG=t=>typeof t=="object"&&t!==null,hn=new Set(["generator","asyncGenerator","duplex","webTransform"]),p_=new Set(["fileUrl","filePath","fileNumber"]),oO=new Set(["fileUrl","filePath"]),lG=new Set([...oO,"webStream","nodeStream"]),uG=new Set(["webTransform","duplex"]),Ho={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var sO,Oye,Iye,dG,aO=y(()=>{hr();sO=(t,e,r,n)=>n==="output"?Oye(t,e,r):Iye(t,e,r),Oye=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Iye=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},dG=(t,e)=>{let r=t.findLast(({type:n})=>hn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var fG,Pye,Rye,Cye,Dye,Nye,jye,pG=y(()=>{Ji();Qs();hr();aO();fG=(t,e,r,n)=>[...t.filter(({type:i})=>!hn.has(i)),...Pye(t,e,r,n)],Pye=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>hn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Rye({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return jye(o,r)},Rye=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Cye({stdioItem:t,optionName:i}):e==="webTransform"?Dye({stdioItem:t,index:r,newTransforms:n,direction:o}):Nye({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Cye=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},Dye=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Et(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=sO(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Nye=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Et(e)?e:{transform:e},d=c||Wr.has(o),{writableObjectMode:f,readableObjectMode:p}=sO(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},jye=(t,e)=>e==="input"?t.reverse():t});import cO from"node:process";var mG,Mye,Fye,Mc,lO,hG,zye,Lye,gG=y(()=>{ta();hr();mG=(t,e,r)=>{let n=t.map(i=>Mye(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??Lye},Mye=({type:t,value:e},r)=>Fye[r]??hG[t](e),Fye=["input","output","output"],Mc=()=>{},lO=()=>"input",hG={generator:Mc,asyncGenerator:Mc,fileUrl:Mc,filePath:Mc,iterable:lO,asyncIterable:lO,uint8Array:lO,webStream:t=>f_(t)?"output":"input",nodeStream(t){return ea(t,{checkOpen:!1})?WT(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Mc,duplex:Mc,native(t){let e=zye(t);if(e!==void 0)return e;if(Bn(t,{checkOpen:!1}))return hG.nodeStream(t)}},zye=t=>{if([0,cO.stdin].includes(t))return"input";if([1,2,cO.stdout,cO.stderr].includes(t))return"output"},Lye="output"});var yG,_G=y(()=>{yG=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var bG,Uye,qye,vG,Bye,Hye,SG=y(()=>{Xi();_G();Lo();bG=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Uye(t,n).map((a,c)=>vG(a,c));return o?Bye(s,r,i):yG(s,e)},Uye=(t,e)=>{if(t===void 0)return mn.map(n=>e[n]);if(qye(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${mn.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,mn.length);return Array.from({length:r},(n,i)=>t[i])},qye=t=>mn.some(e=>t[e]!==void 0),vG=(t,e)=>Array.isArray(t)?t.map(r=>vG(r,e)):t??(e>=mn.length?"ignore":"pipe"),Bye=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!$c(r,i)&&Hye(n)?"ignore":n),Hye=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Zye}from"node:fs";import Gye from"node:tty";var xG,Vye,Wye,Kye,Jye,wG,$G=y(()=>{ta();Xi();Vr();qo();xG=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Vye({stdioItem:t,fdNumber:n,direction:i}):Jye({stdioItem:t,fdNumber:n}),Vye=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Wye({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(Bn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Wye=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Kye(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Gye.isatty(i))throw new TypeError(`The \`${e}: ${Dy(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Yi(Zye(i)),optionName:e}}},Kye=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=py.indexOf(t);if(r!==-1)return r},Jye=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:wG(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:wG(e,e,r),optionName:r}:Bn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,wG=(t,e,r)=>{let n=py[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var kG,Yye,Xye,Qye,e_e,EG=y(()=>{ta();Vr();hr();kG=({input:t,inputFile:e},r)=>r===0?[...Yye(t),...Qye(e)]:[],Yye=t=>t===void 0?[]:[{type:Xye(t),value:t,optionName:"input"}],Xye=t=>{if(ea(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ft(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Qye=t=>t===void 0?[]:[{...e_e(t),optionName:"inputFile"}],e_e=t=>{if(d_(t))return{type:"fileUrl",value:t};if(nO(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var AG,TG,t_e,r_e,OG,n_e,i_e,IG,PG=y(()=>{hr();AG=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),TG=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=t_e(i,t);if(s.length!==0){if(o){r_e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(lG.has(t))return OG({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});uG.has(t)&&i_e({otherStdioItems:s,type:t,value:e,optionName:r})}},t_e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),r_e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{oO.has(e)&&OG({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},OG=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>n_e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return IG(s,n,e),i==="output"?o[0].stream:void 0},n_e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,i_e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);IG(i,n,e)},IG=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${Ho[r]} that is the same.`)}});var m_,o_e,s_e,a_e,c_e,l_e,u_e,d_e,f_e,p_e,m_e,h_e,uO,g_e,h_=y(()=>{Xi();pG();aO();hr();gG();SG();$G();EG();PG();m_=(t,e,r,n)=>{let o=bG(e,r,n).map((a,c)=>o_e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=p_e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>g_e(a)),s},o_e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=my(e),{stdioItems:o,isStdioArray:s}=s_e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=mG(o,e,i),c=o.map(d=>xG({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=fG(c,i,a,r),u=dG(l,a);return f_e(l,u),{direction:a,objectMode:u,stdioItems:l}},s_e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>a_e(c,n)),...kG(r,e)],s=AG(o),a=s.length>1;return c_e(s,a,n),u_e(s),{stdioItems:s,isStdioArray:a}},a_e=(t,e)=>({type:tG(t,e),value:t,optionName:e}),c_e=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(l_e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},l_e=new Set(["ignore","ipc"]),u_e=t=>{for(let e of t)d_e(e)},d_e=({type:t,value:e,optionName:r})=>{if(oG(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. +For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(sG(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},f_e=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>p_.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},p_e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(m_e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw uO(i),o}},m_e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>h_e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},h_e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=TG({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},uO=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Ln(r)&&r.destroy()},g_e=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as RG}from"node:fs";var DG,_i,y_e,NG,CG,__e,jG=y(()=>{Vr();h_();hr();DG=(t,e)=>m_(__e,t,e,!0),_i=({type:t,optionName:e})=>{NG(e,Ho[t])},y_e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&NG(t,`"${e}"`),{}),NG=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},CG={generator(){},asyncGenerator:_i,webStream:_i,nodeStream:_i,webTransform:_i,duplex:_i,asyncIterable:_i,native:y_e},__e={input:{...CG,fileUrl:({value:t})=>({contents:[Yi(RG(t))]}),filePath:({value:{file:t}})=>({contents:[Yi(RG(t))]}),fileNumber:_i,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...CG,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:_i,string:_i,uint8Array:_i}}});var ro,dO,Qd=y(()=>{VT();ro=(t,{stripFinalNewline:e},r)=>dO(e,r)&&t!==void 0&&!Array.isArray(t)?Cc(t):t,dO=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var g_,pO,MG,FG,b_e,v_e,S_e,zG,w_e,fO,x_e,$_e,k_e,y_=y(()=>{g_=(t,e,r,n)=>t||r?void 0:FG(e,n),pO=(t,e,r)=>r?t.flatMap(n=>MG(n,e)):MG(t,e),MG=(t,e)=>{let{transform:r,final:n}=FG(e,{});return[...r(t),...n()]},FG=(t,e)=>(e.previousChunks="",{transform:b_e.bind(void 0,e,t),final:S_e.bind(void 0,e)}),b_e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=fO(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=fO(n,r.slice(i+1))),t.previousChunks=n},v_e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),S_e=function*({previousChunks:t}){t.length>0&&(yield t)},zG=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:w_e.bind(void 0,n)},w_e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?x_e:k_e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},fO=(t,e)=>`${t}${e}`,x_e={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:cO},g_e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},y_e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:g_e}});import{Buffer as __e}from"node:buffer";var RG,v_e,CG,b_e,S_e,DG,NG=y(()=>{Br();RG=(t,e)=>t?void 0:v_e.bind(void 0,e),v_e=function*(t,e){if(typeof e!="string"&&!Mt(e)&&!__e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},CG=(t,e)=>t?b_e.bind(void 0,e):S_e.bind(void 0,e),b_e=function*(t,e){DG(t,e),yield e},S_e=function*(t,e){if(DG(t,e),typeof e!="string"&&!Mt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},DG=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:fO},$_e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},k_e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:$_e}});import{Buffer as E_e}from"node:buffer";var LG,A_e,UG,T_e,O_e,qG,BG=y(()=>{Vr();LG=(t,e)=>t?void 0:A_e.bind(void 0,e),A_e=function*(t,e){if(typeof e!="string"&&!Ft(e)&&!E_e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},UG=(t,e)=>t?T_e.bind(void 0,e):O_e.bind(void 0,e),T_e=function*(t,e){qG(t,e),yield e},O_e=function*(t,e){if(qG(t,e),typeof e!="string"&&!Ft(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},qG=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. Instead, \`yield\` should either be called with a value, or not be called at all. For example: - if (condition) { yield value; }`)}});import{Buffer as w_e}from"node:buffer";import{StringDecoder as x_e}from"node:string_decoder";var y_,$_e,k_e,E_e,uO=y(()=>{Br();y_=(t,e,r)=>{if(r)return;if(t)return{transform:$_e.bind(void 0,new TextEncoder)};let n=new x_e(e);return{transform:k_e.bind(void 0,n),final:E_e.bind(void 0,n)}},$_e=function*(t,e){w_e.isBuffer(e)?yield Vi(e):typeof e=="string"?yield t.encode(e):yield e},k_e=function*(t,e){yield Mt(e)?t.write(e):e},E_e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as jG}from"node:util";var dO,__,MG,A_e,FG,T_e,zG=y(()=>{dO=jG(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),__=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=T_e}=e[r];for await(let i of n(t))yield*__(i,e,r+1)},MG=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*A_e(r,Number(e),t)},A_e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*__(n,r,e+1)},FG=jG(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),T_e=function*(t){yield t}});var fO,LG,ea,Jd,O_e,I_e,pO=y(()=>{fO=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},LG=(t,e)=>[...e.flatMap(r=>[...ea(r,t,0)]),...Jd(t)],ea=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=I_e}=e[r];for(let i of n(t))yield*ea(i,e,r+1)},Jd=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*O_e(r,Number(e),t)},O_e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*ea(n,r,e+1)},I_e=function*(t){yield t}});import{Transform as P_e,getDefaultHighWaterMark as UG}from"node:stream";var mO,v_,qG,b_=y(()=>{dr();g_();NG();uO();zG();pO();mO=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=qG(t,s,o),l=Qs(e),u=Qs(r),d=l?dO.bind(void 0,__,a):fO.bind(void 0,ea),f=l||u?dO.bind(void 0,MG,a):fO.bind(void 0,Jd),p=l||u?FG.bind(void 0,a):void 0;return{stream:new P_e({writableObjectMode:n,writableHighWaterMark:UG(n),readableObjectMode:i,readableHighWaterMark:UG(i),transform(h,g,v){d([h,c,0],this,v)},flush(h){f([c],this,h)},destroy:p})}},v_=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=qG(s,r,a);t=LG(c,t)}return t},qG=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:RG(n,a)},y_(r,s,n),h_(r,o,n,c),{transform:t,final:e},{transform:CG(i,a)},PG({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var BG,R_e,C_e,D_e,N_e,HG=y(()=>{b_();Br();dr();BG=(t,e)=>{for(let r of R_e(t))C_e(t,r,e)},R_e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),C_e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Lo[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>D_e(a,n));r.input=Dd(s)},D_e=(t,e)=>{let r=v_(t,e,"utf8",!0);return N_e(r),Dd(r)},N_e=t=>{let e=t.find(r=>typeof r!="string"&&!Mt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var S_,j_e,M_e,ZG,GG,F_e,VG,hO=y(()=>{Ks();dr();Sc();jo();S_=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&bc(r,n)&&!Hr.has(e)&&j_e(n)&&(t.some(({type:i,value:o})=>i==="native"&&M_e.has(o))||t.every(({type:i})=>pn.has(i))),j_e=t=>t===1||t===2,M_e=new Set(["pipe","overlapped"]),ZG=async(t,e,r,n)=>{for await(let i of t)F_e(e)||VG(i,r,n)},GG=(t,e,r)=>{for(let n of t)VG(n,e,r)},F_e=t=>t._readableState.pipes.length>0,VG=(t,e,r)=>{let n=by(t);li({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as z_e,appendFileSync as L_e}from"node:fs";var WG,U_e,q_e,B_e,H_e,Z_e,KG=y(()=>{hO();b_();g_();Br();dr();Xs();WG=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>U_e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},U_e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=CZ(t,o,d),p=Vi(f),{stdioItems:m,objectMode:h}=e[r],g=q_e([p],m,c,n),{serializedResult:v,finalResult:_=v}=B_e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});H_e({serializedResult:v,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&Z_e(v,m,i),S}catch(w){return n.error=w,S}},q_e=(t,e,r,n)=>{try{return v_(t,e,r,!1)}catch(i){return n.error=i,t}},B_e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Dd(t)};let s=x6(t,r);return n[o]?{serializedResult:s,finalResult:lO(s,!i[o],e)}:{serializedResult:s}},H_e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!S_({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=lO(t,!1,s);try{GG(a,e,n)}catch(c){r.error??=c}},Z_e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>f_.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?L_e(n,t):(r.add(o),z_e(n,t))}}});var JG,YG=y(()=>{Br();Kd();JG=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Xi(e,r,"all")]:Array.isArray(e)?[Xi(t,r,"all"),...e]:Mt(t)&&Mt(e)?iT([t,e]):`${t}${e}`}});import{once as gO}from"node:events";var XG,G_e,QG,e9,V_e,yO,_O=y(()=>{Vs();XG=async(t,e)=>{let[r,n]=await G_e(t);return e.isForcefullyTerminated??=!1,[r,n]},G_e=async t=>{let[e,r]=await Promise.allSettled([gO(t,"spawn"),gO(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?QG(t):r.value},QG=async t=>{try{return await gO(t,"exit")}catch{return QG(t)}},e9=async t=>{let[e,r]=await t;if(!V_e(e,r)&&yO(e,r))throw new Mn;return[e,r]},V_e=(t,e)=>t===void 0&&e===void 0,yO=(t,e)=>t!==0||e!==null});var t9,W_e,r9=y(()=>{Vs();Xs();_O();t9=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=W_e(t,e,r),s=o?.code==="ETIMEDOUT",a=RZ(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},W_e=(t,e,r)=>t!==void 0?t:yO(e,r)?new Mn:void 0});import{spawnSync as K_e}from"node:child_process";var n9,J_e,Y_e,X_e,w_,Q_e,eve,tve,rve,i9=y(()=>{pT();UT();qT();Wd();l_();TG();Kd();HG();KG();Xs();YG();r9();n9=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=J_e(t,e,r),d=Q_e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Rc(d,c,l)},J_e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=xy(t,e,r),a=Y_e(r),{file:c,commandArguments:l,options:u}=Jy(t,e,a);X_e(u);let d=EG(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Y_e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,X_e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&w_("ipcInput"),t&&w_("ipc: true"),r&&w_("detached: true"),n&&w_("cancelSignal")},w_=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Q_e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=eve({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=t9(c,r),{output:m,error:h=l}=WG({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>Xi(_,r,S)),v=Xi(JG(m,r),r,"all");return rve({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:v,options:r,command:n,escapedCommand:i,startTime:a})},eve=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{BG(o,r);let a=tve(r);return K_e(...Yy(t,e,a))}catch(a){return Pc({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},tve=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:a_(e)}),rve=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?c_({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Vd({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as vO,on as nve}from"node:events";var o9,ive,ove,sve,ave,s9=y(()=>{Ec();qd();Ud();o9=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>($c({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:By(t)}),ive({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),ive=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{jy(e,i);let o=zo(t,e,r),s=new AbortController;try{return await Promise.race([ove(o,n,s),sve(o,r,s),ave(o,r,s)])}catch(a){throw kc(t),a}finally{s.abort(),My(e,i)}},ove=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await vO(t,"message",{signal:r});return n}for await(let[n]of nve(t,"message",{signal:r}))if(e(n))return n},sve=async(t,e,{signal:r})=>{await vO(t,"disconnect",{signal:r}),yH(e)},ave=async(t,e,{signal:r})=>{let[n]=await vO(t,"strict:error",{signal:r});throw Ry(n,e)}});import{once as c9,on as cve}from"node:events";var l9,bO,lve,uve,dve,a9,SO=y(()=>{Ec();qd();Ud();l9=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>bO({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),bO=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{$c({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:By(t)}),jy(e,o);let s=zo(t,e,r),a=new AbortController,c={};return lve(t,s,a),uve({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),dve({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},lve=async(t,e,r)=>{try{await c9(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},uve=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await c9(t,"strict:error",{signal:r.signal});n.error=Ry(i,e),r.abort()}catch{}},dve=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of cve(r,"message",{signal:o.signal}))a9(s),yield c}catch{a9(s)}finally{o.abort(),My(e,a),n||kc(t),i&&await t}},a9=({error:t})=>{if(t)throw t}});import u9 from"node:process";var d9,f9,p9,wO=y(()=>{Wy();s9();SO();Uy();d9=(t,{ipc:e})=>{Object.assign(t,p9(t,!1,e))},f9=()=>{let t=u9,e=!0,r=u9.channel!==void 0;return{...p9(t,e,r),getCancelSignal:ZH.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},p9=(t,e,r)=>({sendMessage:Vy.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:o9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:l9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as fve}from"node:child_process";import{PassThrough as pve,Readable as mve,Writable as hve,Duplex as gve}from"node:stream";var m9,yve,Yd,_ve,vve,bve,Sve,h9=y(()=>{m_();Wd();l_();m9=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{sO(n);let a=new fve;yve(a,n),Object.assign(a,{readable:_ve,writable:vve,duplex:bve});let c=Pc({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=Sve(c,s,i);return{subprocess:a,promise:l}},yve=(t,e)=>{let r=Yd(),n=Yd(),i=Yd(),o=Array.from({length:e.length-3},Yd),s=Yd(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Yd=()=>{let t=new pve;return t.end(),t},_ve=()=>new mve({read(){}}),vve=()=>new hve({write(){}}),bve=()=>new gve({read(){},write(){}}),Sve=async(t,e,r)=>Rc(t,e,r)});import{createReadStream as g9,createWriteStream as y9}from"node:fs";import{Buffer as wve}from"node:buffer";import{Readable as Xd,Writable as xve,Duplex as $ve}from"node:stream";var v9,Qd,_9,kve,b9=y(()=>{b_();m_();dr();v9=(t,e)=>p_(kve,t,e,!1),Qd=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Lo[t]}.`)},_9={fileNumber:Qd,generator:mO,asyncGenerator:mO,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:$ve.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},kve={input:{..._9,fileUrl:({value:t})=>({stream:g9(t)}),filePath:({value:{file:t}})=>({stream:g9(t)}),webStream:({value:t})=>({stream:Xd.fromWeb(t)}),iterable:({value:t})=>({stream:Xd.from(t)}),asyncIterable:({value:t})=>({stream:Xd.from(t)}),string:({value:t})=>({stream:Xd.from(t)}),uint8Array:({value:t})=>({stream:Xd.from(wve.from(t))})},output:{..._9,fileUrl:({value:t})=>({stream:y9(t)}),filePath:({value:{file:t,append:e}})=>({stream:y9(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:xve.fromWeb(t)}),iterable:Qd,asyncIterable:Qd,string:Qd,uint8Array:Qd}}});import{on as Eve,once as S9}from"node:events";import{PassThrough as Ave,getDefaultHighWaterMark as Tve}from"node:stream";import{finished as $9}from"node:stream/promises";function ta(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)$O(i);let e=t.some(({readableObjectMode:i})=>i),r=Ove(t,e),n=new xO({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Ove,xO,Ive,Pve,Rve,$O,Cve,Dve,Nve,jve,Mve,k9,E9,kO,A9,Fve,x_,w9,x9,$_=y(()=>{Ove=(t,e)=>{if(t.length===0)return Tve(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},xO=class extends Ave{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if($O(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Ive(this,this.#t,this.#o);let r=Cve({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if($O(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},Ive=async(t,e,r)=>{x_(t,w9);let n=new AbortController;try{await Promise.race([Pve(t,n),Rve(t,e,r,n)])}finally{n.abort(),x_(t,-w9)}},Pve=async(t,{signal:e})=>{try{await $9(t,{signal:e,cleanup:!0})}catch(r){throw k9(t,r),r}},Rve=async(t,e,r,{signal:n})=>{for await(let[i]of Eve(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},$O=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Cve=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{x_(t,x9);let a=new AbortController;try{await Promise.race([Dve(o,e,a),Nve({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),jve({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),x_(t,-x9)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?kO(t):Mve(t))},Dve=async(t,e,{signal:r})=>{try{await t,r.aborted||kO(e)}catch(n){r.aborted||k9(e,n)}},Nve=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await $9(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;E9(s)?i.add(e):A9(t,s)}},jve=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await S9(t,i,{signal:o}),!t.readable)return S9(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},Mve=t=>{t.writable&&t.end()},k9=(t,e)=>{E9(e)?kO(t):A9(t,e)},E9=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",kO=t=>{(t.readable||t.writable)&&t.destroy()},A9=(t,e)=>{t.destroyed||(t.once("error",Fve),t.destroy(e))},Fve=()=>{},x_=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},w9=2,x9=1});import{finished as T9}from"node:stream/promises";var Dc,zve,EO,Lve,AO,k_=y(()=>{Wi();Dc=(t,e)=>{t.pipe(e),zve(t,e),Lve(t,e)},zve=async(t,e)=>{if(!(jn(t)||jn(e))){try{await T9(t,{cleanup:!0,readable:!0,writable:!1})}catch{}EO(e)}},EO=t=>{t.writable&&t.end()},Lve=async(t,e)=>{if(!(jn(t)||jn(e))){try{await T9(e,{cleanup:!0,readable:!1,writable:!0})}catch{}AO(t)}},AO=t=>{t.readable&&t.destroy()}});var O9,Uve,qve,Bve,Hve,Zve,I9=y(()=>{$_();Wi();Ny();dr();k_();O9=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>pn.has(c)))Uve(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!pn.has(c)))Bve({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:ta(o);Dc(s,i)}},Uve=(t,e,r,n)=>{r==="output"?Dc(t.stdio[n],e):Dc(e,t.stdio[n]);let i=qve[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},qve=["stdin","stdout","stderr"],Bve=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Hve(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Hve=(t,{signal:e})=>{jn(t)&&Ws(t,Zve,e)},Zve=2});var ra,P9=y(()=>{ra=[];ra.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&ra.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ra.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var E_,TO,OO,Gve,IO,A_,Vve,PO,RO,CO,R9,ZXe,GXe,C9=y(()=>{P9();E_=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",TO=Symbol.for("signal-exit emitter"),OO=globalThis,Gve=Object.defineProperty.bind(Object),IO=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(OO[TO])return OO[TO];Gve(OO,TO,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},A_=class{},Vve=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),PO=class extends A_{onExit(){return()=>{}}load(){}unload(){}},RO=class extends A_{#t=CO.platform==="win32"?"SIGINT":"SIGHUP";#r=new IO;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of ra)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!E_(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of ra)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,ra.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return E_(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&E_(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},CO=globalThis.process,{onExit:R9,load:ZXe,unload:GXe}=Vve(E_(CO)?new RO(CO):new PO)});import{addAbortListener as Wve}from"node:events";var D9,N9=y(()=>{C9();D9=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=R9(()=>{t.kill()});Wve(n,()=>{i()})}});var M9,Kve,Jve,j9,Yve,F9=y(()=>{nT();wy();Fo();_c();M9=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=Sy(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=Kve(r,n,i),{sourceStream:d,sourceError:f}=Yve(t,l),{options:p,fileDescriptors:m}=di.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},Kve=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=Jve(t,e,...r),a=Dy(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},Jve=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(j9,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||tT(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=uy(r,...n);return{destination:e(j9)(i,o,s),pipeOptions:s}}if(di.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},j9=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),Yve=(t,e)=>{try{return{sourceStream:Tc(t,e)}}catch(r){return{sourceError:r}}}});var L9,Xve,DO,z9,NO=y(()=>{Wd();k_();L9=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=Xve({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw DO({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},Xve=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return AO(t),n;if(e!==void 0)return EO(r),e},DO=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Pc({error:t,command:z9,escapedCommand:z9,fileDescriptors:e,options:r,startTime:n,isSync:!1}),z9="source.pipe(destination)"});var U9,q9=y(()=>{U9=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as Qve}from"node:stream/promises";var B9,ebe,tbe,rbe,T_,nbe,ibe,H9=y(()=>{$_();Ny();k_();B9=(t,e,r)=>{let n=T_.has(e)?tbe(t,e):ebe(t,e);return Ws(t,nbe,r.signal),Ws(e,ibe,r.signal),rbe(e),n},ebe=(t,e)=>{let r=ta([t]);return Dc(r,e),T_.set(e,r),r},tbe=(t,e)=>{let r=T_.get(e);return r.add(t),r},rbe=async t=>{try{await Qve(t,{cleanup:!0,readable:!1,writable:!0})}catch{}T_.delete(t)},T_=new WeakMap,nbe=2,ibe=1});import{aborted as obe}from"node:util";var Z9,sbe,G9=y(()=>{NO();Z9=(t,e)=>t===void 0?[]:[sbe(t,e)],sbe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await obe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw DO({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var O_,abe,cbe,V9=y(()=>{Gi();F9();NO();q9();H9();G9();O_=(t,...e)=>{if(kt(e[0]))return O_.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=M9(t,...e),i=abe({...n,destination:r});return i.pipe=O_.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},abe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=cbe(t,i);L9({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=B9(e,o,d);return await Promise.race([U9(u),...Z9(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},cbe=(t,e)=>Promise.allSettled([t,e])});import{on as lbe}from"node:events";import{getDefaultHighWaterMark as ube}from"node:stream";var I_,dbe,jO,fbe,K9,MO,W9,pbe,mbe,P_=y(()=>{uO();g_();pO();I_=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return dbe(e,s),K9({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},dbe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},jO=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;fbe(e,s,t);let a=t.readableObjectMode&&!o;return K9({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},fbe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},K9=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=lbe(t,"data",{signal:e.signal,highWaterMark:W9,highWatermark:W9});return pbe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},MO=ube(!0),W9=MO,pbe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=mbe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*ea(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Jd(a)}},mbe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[y_(t,r,!e),h_(t,i,!n,{})].filter(Boolean)});import{setImmediate as hbe}from"node:timers/promises";var J9,gbe,ybe,_be,FO,Y9,zO=y(()=>{s_();Br();hO();P_();Xs();Kd();J9=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=gbe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([ybe(t),d]);return}let f=aO(c,r),p=jO({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([_be({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},gbe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!S_({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=jO({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await ZG(a,t,r,o)},ybe=async t=>{await hbe(),t.readableFlowing===null&&t.resume()},_be=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await r_(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await n_(r,{maxBuffer:o})):await o_(r,{maxBuffer:o})}catch(a){return Y9(OZ({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},FO=async t=>{try{return await t}catch(e){return Y9(e)}},Y9=({bufferedData:t})=>S6(t)?new Uint8Array(t):t});import{finished as vbe}from"node:stream/promises";var ef,bbe,Sbe,wbe,xbe,$be,LO,R_,X9,C_=y(()=>{ef=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=bbe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],vbe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||xbe(a,e,r,n)}finally{s.abort()}},bbe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Sbe(t,r,n),n},Sbe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{wbe(e,r),n.call(t,...i)}},wbe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},xbe=(t,e,r,n)=>{if(!$be(t,e,r,n))throw t},$be=(t,e,r,n=!0)=>r.propagating?X9(t)||R_(t):(r.propagating=!0,LO(r,e)===n?X9(t):R_(t)),LO=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",R_=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",X9=t=>t?.code==="EPIPE"});var Q9,UO,qO=y(()=>{zO();C_();Q9=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>UO({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),UO=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=ef(t,e,l);if(LO(l,e)){await u;return}let[d]=await Promise.all([J9({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var eV,tV,kbe,Ebe,BO=y(()=>{$_();qO();eV=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?ta([t,e].filter(Boolean)):void 0,tV=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>UO({...kbe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Ebe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),kbe=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},Ebe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var rV,nV,iV=y(()=>{Sc();jo();rV=t=>bc(t,"ipc"),nV=(t,e)=>{let r=by(t);li({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var oV,sV,aV=y(()=>{Xs();iV();Ji();SO();oV=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=rV(o),a=Ki(e,"ipc"),c=Ki(r,"ipc");for await(let l of bO({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(IZ(t,i,c),i.push(l)),s&&nV(l,o);return i},sV=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Abe}from"node:events";var cV,Tbe,Obe,Ibe,lV=y(()=>{Ys();jT();AT();NT();Wi();dr();zO();aV();FT();BO();qO();_O();C_();cV=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:v})=>{let _=XG(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},w=Q9({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),x=tV({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),I=[],T=oV({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:I,verboseInfo:p}),k=Tbe(h,t,S),C=Obe(m,S);try{return await Promise.race([Promise.all([{},e9(_),Promise.all(w),x,T,tZ(t,d),...k,...C]),g,Ibe(t,v),...JH(t,o,f,v),...gH({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:v}),...WH({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:v})])}catch(E){return f.terminationReason??="other",Promise.all([{error:E},_,Promise.all(w.map(Z=>FO(Z))),FO(x),sV(T,I),Promise.allSettled(k),Promise.allSettled(C)])}},Tbe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:ef(n,i,r)),Obe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>zn(o,{checkOpen:!1})&&!jn(o)).map(({type:i,value:o,stream:s=o})=>ef(s,n,e,{isSameDirection:pn.has(i),stopOnExit:i==="native"}))),Ibe=async(t,{signal:e})=>{let[r]=await Abe(t,"error",{signal:e});throw r}});var uV,tf,Nc,D_=y(()=>{Ac();uV=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),tf=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=ui();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Nc=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as dV}from"node:stream/promises";var HO,fV,ZO,GO,N_,j_,VO=y(()=>{C_();HO=async t=>{if(t!==void 0)try{await ZO(t)}catch{}},fV=async t=>{if(t!==void 0)try{await GO(t)}catch{}},ZO=async t=>{await dV(t,{cleanup:!0,readable:!1,writable:!0})},GO=async t=>{await dV(t,{cleanup:!0,readable:!0,writable:!1})},N_=async(t,e)=>{if(await t,e)throw e},j_=(t,e,r)=>{r&&!R_(r)?t.destroy(r):e&&t.destroy()}});import{Readable as Pbe}from"node:stream";import{callbackify as Rbe}from"node:util";var pV,WO,KO,JO,Cbe,YO,XO,mV,QO=y(()=>{Ks();Fo();P_();Ac();D_();VO();pV=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||Hr.has(r),{subprocessStdout:a,waitReadableDestroy:c}=WO(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=KO(a,s),{read:f,onStdoutDataDone:p}=JO({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Pbe({read:f,destroy:Rbe(XO.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return YO({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},WO=(t,e,r)=>{let n=Tc(t,e),i=tf(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},KO=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:MO},JO=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=ui(),s=I_({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Cbe(this,s,o)},onStdoutDataDone:o}},Cbe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},YO=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await GO(t),await n,await HO(i),await e,r.readable&&r.push(null)}catch(o){await HO(i),mV(r,o)}},XO=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Nc(r,e)&&(mV(t,n),await N_(e,n))},mV=(t,e)=>{j_(t,t.readable,e)}});import{Writable as Dbe}from"node:stream";import{callbackify as hV}from"node:util";var gV,eI,tI,Nbe,jbe,rI,nI,yV,iI=y(()=>{Fo();D_();VO();gV=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=eI(t,r,e),s=new Dbe({...tI(n,t,i),destroy:hV(nI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return rI(n,s),s},eI=(t,e,r)=>{let n=Dy(t,e),i=tf(r,n,"writableFinal"),o=tf(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},tI=(t,e,r)=>({write:Nbe.bind(void 0,t),final:hV(jbe.bind(void 0,t,e,r))}),Nbe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},jbe=async(t,e,r)=>{await Nc(r,e)&&(t.writable&&t.end(),await e)},rI=async(t,e,r)=>{try{await ZO(t),e.writable&&e.end()}catch(n){await fV(r),yV(e,n)}},nI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Nc(r,e),await Nc(n,e)&&(yV(t,i),await N_(e,i))},yV=(t,e)=>{j_(t,t.writable,e)}});import{Duplex as Mbe}from"node:stream";import{callbackify as Fbe}from"node:util";var _V,zbe,vV=y(()=>{Ks();QO();iI();_V=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||Hr.has(r),{subprocessStdout:c,waitReadableDestroy:l}=WO(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=eI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=KO(c,a),{read:g,onStdoutDataDone:v}=JO({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new Mbe({read:g,...tI(u,t,d),destroy:Fbe(zbe.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return YO({subprocessStdout:c,onStdoutDataDone:v,readable:_,subprocess:t,subprocessStdin:u}),rI(u,_,c),_},zbe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([XO({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),nI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var oI,Lbe,bV=y(()=>{Ks();Fo();P_();oI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||Hr.has(e),s=Tc(t,r),a=I_({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Lbe(a,s,t)},Lbe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var SV,wV=y(()=>{D_();QO();iI();vV();bV();SV=(t,{encoding:e})=>{let r=uV();t.readable=pV.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=gV.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=_V.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=oI.bind(void 0,t,e),t[Symbol.asyncIterator]=oI.bind(void 0,t,e,{})}});var xV,Ube,qbe,$V=y(()=>{xV=(t,e)=>{for(let[r,n]of qbe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Ube=(async()=>{})().constructor.prototype,qbe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Ube,t)])});import{setMaxListeners as Bbe}from"node:events";import{spawn as Hbe}from"node:child_process";var kV,Zbe,Gbe,Vbe,Wbe,Kbe,EV=y(()=>{s_();pT();UT();Fo();qT();wO();Wd();l_();h9();b9();Kd();I9();Iy();N9();V9();BO();lV();wV();Ac();$V();kV=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Zbe(t,e,r),{subprocess:f,promise:p}=Vbe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=O_.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),xV(f,p),di.set(f,{options:u,fileDescriptors:d}),f},Zbe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=xy(t,e,r),{file:a,commandArguments:c,options:l}=Jy(t,e,r),u=Gbe(l),d=v9(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Gbe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Vbe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Hbe(...Yy(t,e,r))}catch(m){return m9({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Bbe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];O9(c,a,l),D9(c,r,l);let d={},f=ui();c.kill=mH.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=eV(c,r),SV(c,r),d9(c,r);let p=Wbe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Wbe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await cV({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let v=m.map((w,x)=>Xi(w,e,x)),_=Xi(h,e,"all"),S=Kbe({errorInfo:d,exitCode:f,signal:p,stdio:v,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Rc(S,n,e)},Kbe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Vd({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof fi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):c_({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var M_,Jbe,Ybe,AV=y(()=>{Gi();Ji();M_=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Jbe(n,t[n],i)]));return{...t,...r}},Jbe=(t,e,r)=>Ybe.has(t)&&kt(e)&&kt(r)?{...e,...r}:r,Ybe=new Set(["env",...cT])});var Uo,Xbe,Qbe,TV=y(()=>{Gi();nT();O6();i9();EV();AV();Uo=(t,e,r,n)=>{let i=(s,a,c)=>Uo(s,a,r,c),o=(...s)=>Xbe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Xbe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(kt(o))return i(t,M_(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Qbe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?n9(a,c,l):kV(a,c,l,i)},Qbe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=A6(e)?T6(e,r):[e,...r],[s,a,c]=uy(...o),l=M_(M_(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var OV,IV,PV,eSe,tSe,RV=y(()=>{OV=({file:t,commandArguments:e})=>PV(t,e),IV=({file:t,commandArguments:e})=>({...PV(t,e),isSync:!0}),PV=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=eSe(t);return{file:r,commandArguments:n}},eSe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(tSe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},tSe=/ +/g});var CV,DV,rSe,NV,nSe,jV,MV=y(()=>{CV=(t,e,r)=>{t.sync=e(rSe,r),t.s=t.sync},DV=({options:t})=>NV(t),rSe=({options:t})=>({...NV(t),isSync:!0}),NV=t=>({options:{...nSe(t),...t}}),nSe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},jV={preferLocal:!0}});var Met,Qe,Fet,zet,Let,Uet,qet,Bet,Het,Zet,Ar=y(()=>{TV();RV();MT();MV();wO();Met=Uo(()=>({})),Qe=Uo(()=>({isSync:!0})),Fet=Uo(OV),zet=Uo(IV),Let=Uo(XH),Uet=Uo(DV,{},jV,CV),{sendMessage:qet,getOneMessage:Bet,getEachMessage:Het,getCancelSignal:Zet}=f9()});import{existsSync as F_,statSync as iSe}from"node:fs";import{dirname as sI,extname as oSe,isAbsolute as FV,join as aI,relative as cI,resolve as z_,sep as sSe}from"node:path";function L_(t){return t==="./gradlew"||t==="gradle"}function aSe(t){return(F_(aI(t,"build.gradle.kts"))||F_(aI(t,"build.gradle")))&&F_(aI(t,"gradle.properties"))}function cSe(t,e){let n=cI(t,e).split(sSe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function qo(t,e){return t===":"?`:${e}`:`${t}:${e}`}function lSe(t,e){let r=z_(t,e),n=r;F_(r)?iSe(r).isFile()&&(n=sI(r)):oSe(r)!==""&&(n=sI(r));let i=cI(t,n);if(i.startsWith("..")||FV(i))return null;let o=n;for(;;){if(aSe(o))return o;if(z_(o)===z_(t))return null;let s=sI(o);if(s===o)return null;let a=cI(t,s);if(a.startsWith("..")||FV(a))return null;o=s}}function U_(t,e){let r=z_(t),n=new Map,i=[];for(let o of e){let s=lSe(r,o);if(!s){i.push(o);continue}let a=cSe(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var q_=y(()=>{"use strict"});import{existsSync as uSe,readFileSync as dSe}from"node:fs";import{join as fSe}from"node:path";function jc(t="."){let e=fSe(t,".cladding","config.yaml");if(!uSe(e))return lI;try{let n=(0,zV.parse)(dSe(e,"utf8"))?.gate;if(!n)return lI;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of pSe){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return lI}}function LV(t,e){let r=[],n=!1;for(let i of t){let o=mSe.exec(i);if(o){n=!0;for(let s of e)r.push(qo(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var zV,pSe,lI,mSe,B_=y(()=>{"use strict";zV=$t(rr(),1);q_();pSe=["type","lint","test","coverage"],lI={scope:"feature"};mSe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as dI,readFileSync as UV,readdirSync as hSe,statSync as gSe}from"node:fs";import{join as H_}from"node:path";function mI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=H_(t,e);if(dI(r))try{if(qV.test(UV(r,"utf8")))return!0}catch{}}return!1}function BV(t){try{return dI(t)&&qV.test(UV(t,"utf8"))}catch{return!1}}function HV(t,e=0){if(e>4||!dI(t))return!1;let r;try{r=hSe(t)}catch{return!1}for(let n of r){let i=H_(t,n),o=!1;try{o=gSe(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(HV(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&BV(i))return!0}return!1}function vSe(t){if(mI(t))return!0;for(let e of ySe)if(BV(H_(t,e)))return!0;for(let e of _Se)if(HV(H_(t,e)))return!0;return!1}function ZV(t="."){let e=jc(t).coverage;return e||(vSe(t)?"kover":"jacoco")}function GV(t="."){return fI[ZV(t)]}function VV(t="."){return uI[ZV(t)]}var fI,uI,pI,qV,ySe,_Se,Z_=y(()=>{"use strict";B_();fI={kover:"koverXmlReport",jacoco:"jacocoTestReport"},uI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},pI=[uI.kover,uI.jacoco],qV=/kover/i;ySe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],_Se=["buildSrc","build-logic"]});import{existsSync as hI,readdirSync as WV}from"node:fs";import{join as G_}from"node:path";function gI(t){return hI(G_(t,"gradlew"))?"./gradlew":"gradle"}function bSe(t){let e=gI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[GV(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function wSe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function kSe(t,e){for(let r of e)if(hI(G_(t,r)))return r}function ESe(t,e){try{return WV(t).find(n=>n.endsWith(e))}catch{return}}function TSe(t,e){for(let r of ASe)if(r.configs.some(n=>hI(G_(t,n))))return r.gate;return e}function pt(t="."){for(let e of xSe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=ESe(t,o):r=kSe(t,[o]),r)break;if(!r||e.requiresSource&&!wSe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"&&n.lint?{...n,lint:TSe(t,n.lint)}:n;return{language:e.language,manifest:r,gates:i}}return $Se}var SSe,xSe,$Se,ASe,mn=y(()=>{"use strict";Z_();SSe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);xSe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","madge","--circular","--extensions","ts","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:bSe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}],$Se={language:"unknown",manifest:"",gates:{}};ASe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}]});import{existsSync as OSe,readFileSync as ISe}from"node:fs";import{join as PSe}from"node:path";function rf(t){return t.code==="ENOENT"}function V_(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return KV.test(o)||KV.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Ft(t,e,r){return rf(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function nr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Mc(t,e){let r=PSe(t,"package.json");if(!OSe(r))return!1;try{return!!JSON.parse(ISe(r,"utf8")).scripts?.[e]}catch{return!1}}var KV,hn=y(()=>{"use strict";KV=/config (is |file )?not found|no such file|ENOENT|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function RSe(t){let{cwd:e="."}=t,r=pt(e),n=r.gates.arch;if(!n)return[{detector:W_,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Qe(n.cmd,[...n.args],{cwd:e,reject:!1});return rf(i)?[{detector:W_,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:V_(i,W_,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var W_,K_,yI=y(()=>{"use strict";Ar();mn();hn();W_="ARCHITECTURE_VIOLATION";K_={name:W_,run:RSe}});import JV from"node:process";function na(t={}){let r=K_.run(t).filter(o=>o.severity==="error"),n=r.length===0,i={stage:CSe,pass:n,exitCode:n?0:1};return n?i:{...i,stderr:r.map(o=>o.message).join(` -`)}}var CSe,DSe,J_=y(()=>{"use strict";yI();CSe="stage_1.5";DSe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${JV.argv[1]}`;if(DSe){let t=na();console.log(JSON.stringify(t)),JV.exit(t.exitCode)}});import{existsSync as _I,readdirSync as YV}from"node:fs";import{join as Y_}from"node:path";function jSe(t,e){let r=Y_(t,e.path);if(!_I(r))return!0;if(e.isDirectory)try{return YV(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function MSe(t){let{cwd:e="."}=t,r=[];for(let i of NSe)jSe(e,i)&&r.push({detector:nf,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=Y_(e,"spec.yaml");if(_I(n)){let i=LSe(n),o=i?null:FSe(e);if(i)r.push({detector:nf,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:nf,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=zSe(e);s&&r.push({detector:nf,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function FSe(t){for(let e of["spec/features","spec/scenarios"]){let r=Y_(t,e);if(!_I(r))continue;let n;try{n=YV(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{si(Y_(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function zSe(t){try{return J(t),null}catch(e){return e.message}}function LSe(t){let e;try{e=si(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var nf,NSe,XV,QV=y(()=>{"use strict";lt();iy();nf="ABSENCE_OF_GOVERNANCE",NSe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];XV={name:nf,run:MSe}});function X_(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function vI(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=X_(r)==="while",o=qSe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${X_(r)}'`}let n=USe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:X_(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${X_(r)}'`:null}function BSe(t,e){let r=vI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function eW(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...BSe(r,n));return e}var USe,qSe,bI=y(()=>{"use strict";USe={event:"when",state:"while",optional:"where",unwanted:"if"},qSe=/\bwhen\b/i});function pe(t,e,r){let n;try{n=J(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var _t=y(()=>{"use strict";lt()});function HSe(t){let{cwd:e="."}=t;return pe(e,Q_,ZSe)}function ZSe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:Q_,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of eW(t.features))e.push({detector:Q_,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Q_,tW,rW=y(()=>{"use strict";bI();_t();Q_="AC_DRIFT";tW={name:Q_,run:HSe}});function mi(t=".",e){let n=(e??"").trim().toLowerCase()||pt(t).language;return KSe[n]??nW}var GSe,VSe,nW,WSe,KSe,Fc=y(()=>{"use strict";mn();GSe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,VSe=/^[ \t]*import\s+([\w.]+)/gm,nW={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:GSe,importStyle:"relative"},WSe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:VSe,importStyle:"dotted"},KSe={typescript:nW,kotlin:WSe}});import{existsSync as JSe,readFileSync as YSe,readdirSync as XSe,statSync as QSe}from"node:fs";import{join as oW,relative as iW}from"node:path";function ewe(t,e){if(!JSe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=XSe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=oW(i,s),c;try{c=QSe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function twe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function nwe(t){return rwe.test(t)}function iwe(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=mi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>ewe(oW(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=YSe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";lt();Fc();sW="AI_HINTS_FORBIDDEN_PATTERN";rwe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;aW={name:sW,run:iwe}});function owe(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:lW,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var lW,uW,dW=y(()=>{"use strict";lt();lW="AC_DUPLICATE_WITHIN_FEATURE";uW={name:lW,run:owe}});import{createRequire as swe}from"module";import{basename as awe,dirname as wI,normalize as cwe,relative as lwe,resolve as uwe,sep as mW}from"path";import*as dwe from"fs";function fwe(t){let e=cwe(t);return e.length>1&&e[e.length-1]===mW&&(e=e.substring(0,e.length-1)),e}function hW(t,e){return t.replace(pwe,e)}function hwe(t){return t==="/"||mwe.test(t)}function SI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=uwe(t)),(n||o)&&(t=fwe(t)),t===".")return"";let s=t[t.length-1]!==i;return hW(s?t+i:t,i)}function gW(t,e){return e+t}function gwe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:hW(lwe(t,n),e.pathSeparator)+e.pathSeparator+r}}function ywe(t){return t}function _we(t,e,r){return e+t+r}function vwe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?gwe(t,e):n?gW:ywe}function bwe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function Swe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function kwe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?Swe(t):bwe(t):n&&n.length?xwe:wwe:$we}function Pwe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?Iwe:r&&r.length?n?Ewe:Awe:n?Twe:Owe}function Dwe(t){return t.group?Cwe:Rwe}function Mwe(t){return t.group?Nwe:jwe}function Lwe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?zwe:Fwe}function yW(t,e,r){if(r.options.useRealPaths)return Uwe(e,r);let n=wI(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=wI(n)}return r.symlinks.set(t,e),i>1}function Uwe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function ev(t,e,r,n){e(t&&!n?t:null,r)}function Jwe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?qwe:Gwe:n?e?Bwe:Kwe:i?e?Zwe:Wwe:e?Hwe:Vwe}function Qwe(t){return t?Xwe:Ywe}function nxe(t,e){return new Promise((r,n)=>{bW(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function bW(t,e,r){new vW(t,e,r).start()}function ixe(t,e){return new vW(t,e).start()}var fW,pwe,mwe,wwe,xwe,$we,Ewe,Awe,Twe,Owe,Iwe,Rwe,Cwe,Nwe,jwe,Fwe,zwe,qwe,Bwe,Hwe,Zwe,Gwe,Vwe,Wwe,Kwe,_W,Ywe,Xwe,exe,txe,rxe,vW,pW,SW,wW,xW=y(()=>{fW=swe(import.meta.url);pwe=/[\\/]/g;mwe=/^[a-z]:[\\/]$/i;wwe=(t,e)=>{e.push(t||".")},xwe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},$we=()=>{};Ewe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},Awe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},Twe=(t,e,r,n)=>{r.files++},Owe=(t,e)=>{e.push(t)},Iwe=()=>{};Rwe=t=>t,Cwe=()=>[""].slice(0,0);Nwe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},jwe=()=>{};Fwe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&yW(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},zwe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&yW(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};qwe=t=>t.counts,Bwe=t=>t.groups,Hwe=t=>t.paths,Zwe=t=>t.paths.slice(0,t.options.maxFiles),Gwe=(t,e,r)=>(ev(e,r,t.counts,t.options.suppressErrors),null),Vwe=(t,e,r)=>(ev(e,r,t.paths,t.options.suppressErrors),null),Wwe=(t,e,r)=>(ev(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Kwe=(t,e,r)=>(ev(e,r,t.groups,t.options.suppressErrors),null);_W={withFileTypes:!0},Ywe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",_W,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},Xwe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",_W)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};exe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},txe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},rxe=class{aborted=!1;abort(){this.aborted=!0}},vW=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=Jwe(e,this.isSynchronous),this.root=SI(t,e),this.state={root:hwe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new txe,options:e,queue:new exe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new rxe,fs:e.fs||dwe},this.joinPath=vwe(this.root,e),this.pushDirectory=kwe(this.root,e),this.pushFile=Pwe(e),this.getArray=Dwe(e),this.groupFiles=Mwe(e),this.resolveSymlink=Lwe(e,this.isSynchronous),this.walkDirectory=Qwe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(v.isDirectory()){if(_=SI(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=awe(_),w=SI(wI(_),this.state.options);_=this.joinPath(S,w),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};pW=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return nxe(this.root,this.options)}withCallback(t){bW(this.root,this.options,t)}sync(){return ixe(this.root,this.options)}},SW=null;try{fW.resolve("picomatch"),SW=fW("picomatch")}catch{}wW=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:mW,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new pW(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new pW(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||SW;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var of=b((Vtt,TW)=>{"use strict";var $W="[^\\\\/]",oxe="(?=.)",kW="[^/]",xI="(?:\\/|$)",EW="(?:^|\\/)",$I=`\\.{1,2}${xI}`,sxe="(?!\\.)",axe=`(?!${EW}${$I})`,cxe=`(?!\\.{0,1}${xI})`,lxe=`(?!${$I})`,uxe="[^.\\/]",dxe=`${kW}*?`,fxe="/",AW={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:oxe,QMARK:kW,END_ANCHOR:xI,DOTS_SLASH:$I,NO_DOT:sxe,NO_DOTS:axe,NO_DOT_SLASH:cxe,NO_DOTS_SLASH:lxe,QMARK_NO_DOT:uxe,STAR:dxe,START_ANCHOR:EW,SEP:fxe},pxe={...AW,SLASH_LITERAL:"[\\\\/]",QMARK:$W,STAR:`${$W}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},mxe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};TW.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:mxe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?pxe:AW}}});var sf=b(Tr=>{"use strict";var{REGEX_BACKSLASH:hxe,REGEX_REMOVE_BACKSLASH:gxe,REGEX_SPECIAL_CHARS:yxe,REGEX_SPECIAL_CHARS_GLOBAL:_xe}=of();Tr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Tr.hasRegexChars=t=>yxe.test(t);Tr.isRegexChar=t=>t.length===1&&Tr.hasRegexChars(t);Tr.escapeRegex=t=>t.replace(_xe,"\\$1");Tr.toPosixSlashes=t=>t.replace(hxe,"/");Tr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Tr.removeBackslashes=t=>t.replace(gxe,e=>e==="\\"?"":e);Tr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Tr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Tr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Tr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Tr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var jW=b((Ktt,NW)=>{"use strict";var OW=sf(),{CHAR_ASTERISK:kI,CHAR_AT:vxe,CHAR_BACKWARD_SLASH:af,CHAR_COMMA:bxe,CHAR_DOT:EI,CHAR_EXCLAMATION_MARK:AI,CHAR_FORWARD_SLASH:DW,CHAR_LEFT_CURLY_BRACE:TI,CHAR_LEFT_PARENTHESES:OI,CHAR_LEFT_SQUARE_BRACKET:Sxe,CHAR_PLUS:wxe,CHAR_QUESTION_MARK:IW,CHAR_RIGHT_CURLY_BRACE:xxe,CHAR_RIGHT_PARENTHESES:PW,CHAR_RIGHT_SQUARE_BRACKET:$xe}=of(),RW=t=>t===DW||t===af,CW=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},kxe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,v=!1,_=!1,S=!1,w=!1,x=!1,I=0,T,k,C={value:"",depth:0,isGlob:!1},E=()=>l>=n,Z=()=>c.charCodeAt(l+1),ie=()=>(T=k,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),R=c.slice(d)):m===!0?(xe="",R=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&RW(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(R&&(R=OW.removeBackslashes(R)),xe&&_===!0&&(xe=OW.removeBackslashes(xe)));let cn={prefix:P,input:t,start:u,base:xe,glob:R,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:w};if(r.tokens===!0&&(cn.maxDepth=0,RW(k)||s.push(C),cn.tokens=s),r.parts===!0||r.tokens===!0){let Ge;for(let ft=0;ft{"use strict";var cf=of(),Zr=sf(),{MAX_LENGTH:tv,POSIX_REGEX_SOURCE:Exe,REGEX_NON_SPECIAL_CHARS:Axe,REGEX_SPECIAL_CHARS_BACKREF:Txe,REPLACEMENTS:MW}=cf,Oxe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Zr.escapeRegex(i)).join("..")}return r},zc=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,FW=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},Ixe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},zW=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(Ixe(e))return e.replace(/\\(.)/g,"$1")},Pxe=t=>{let e=t.map(zW).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},Rxe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=zW(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Zr.escapeRegex(r[0]):`[${r.map(i=>Zr.escapeRegex(i)).join("")}]`}*`},Cxe=t=>{let e=0,r=t.trim(),n=II(r);for(;n;)e++,r=n.body.trim(),n=II(r);return e},Dxe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:cf.DEFAULT_MAX_EXTGLOB_RECURSION,n=FW(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||Pxe(n)))return{risky:!0};for(let i of n){let o=Rxe(i);if(o)return{risky:!0,safeOutput:o};if(Cxe(i)>r)return{risky:!0}}return{risky:!1}},PI=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=MW[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(tv,r.maxLength):tv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=cf.globChars(r.windows),l=cf.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:v,QMARK:_,QMARK_NO_DOT:S,STAR:w,START_ANCHOR:x}=c,I=U=>`(${a}(?:(?!${x}${U.dot?m:u}).)*?)`,T=r.dot?"":h,k=r.dot?_:S,C=r.bash===!0?I(r):w;r.capture&&(C=`(${C})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let E={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=Zr.removePrefix(t,E),i=t.length;let Z=[],ie=[],xe=[],P=o,R,cn=()=>E.index===i-1,Ge=E.peek=(U=1)=>t[E.index+U],ft=E.advance=()=>t[++E.index]||"",zi=()=>t.slice(E.index+1),ln=(U="",ct=0)=>{E.consumed+=U,E.index+=ct},bo=U=>{E.output+=U.output!=null?U.output:U.value,ln(U.value)},xae=()=>{let U=1;for(;Ge()==="!"&&(Ge(2)!=="("||Ge(3)==="?");)ft(),E.start++,U++;return U%2===0?!1:(E.negated=!0,E.start++,!0)},Gh=U=>{E[U]++,xe.push(U)},So=U=>{E[U]--,xe.pop()},Ee=U=>{if(P.type==="globstar"){let ct=E.braces>0&&(U.type==="comma"||U.type==="brace"),L=U.extglob===!0||Z.length&&(U.type==="pipe"||U.type==="paren");U.type!=="slash"&&U.type!=="paren"&&!ct&&!L&&(E.output=E.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=C,E.output+=P.output)}if(Z.length&&U.type!=="paren"&&(Z[Z.length-1].inner+=U.value),(U.value||U.output)&&bo(U),P&&P.type==="text"&&U.type==="text"){P.output=(P.output||P.value)+U.value,P.value+=U.value;return}U.prev=P,s.push(U),P=U},Vh=(U,ct)=>{let L={...l[ct],conditions:1,inner:""};L.prev=P,L.parens=E.parens,L.output=E.output,L.startIndex=E.index,L.tokensIndex=s.length;let Ae=(r.capture?"(":"")+L.open;Gh("parens"),Ee({type:U,value:ct,output:E.output?"":p}),Ee({type:"paren",extglob:!0,value:ft(),output:Ae}),Z.push(L)},$ae=U=>{let ct=t.slice(U.startIndex,E.index+1),L=t.slice(U.startIndex+2,E.index),Ae=Dxe(L,r);if((U.type==="plus"||U.type==="star")&&Ae.risky){let it=Ae.safeOutput?(U.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,ri=s[U.tokensIndex];ri.type="text",ri.value=ct,ri.output=it||Zr.escapeRegex(ct);for(let ni=U.tokensIndex+1;ni1&&U.inner.includes("/")&&(it=I(r)),(it!==C||cn()||/^\)+$/.test(zi()))&&(ot=U.close=`)$))${it}`),U.inner.includes("*")&&(Nt=zi())&&/^\.[^\\/.]+$/.test(Nt)){let ri=PI(Nt,{...e,fastpaths:!1}).output;ot=U.close=`)${ri})${it})`}U.prev.type==="bos"&&(E.negatedExtglob=!0)}Ee({type:"paren",extglob:!0,value:R,output:ot}),So("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let U=!1,ct=t.replace(Txe,(L,Ae,ot,Nt,it,ri)=>Nt==="\\"?(U=!0,L):Nt==="?"?Ae?Ae+Nt+(it?_.repeat(it.length):""):ri===0?k+(it?_.repeat(it.length):""):_.repeat(ot.length):Nt==="."?u.repeat(ot.length):Nt==="*"?Ae?Ae+Nt+(it?C:""):C:Ae?L:`\\${L}`);return U===!0&&(r.unescape===!0?ct=ct.replace(/\\/g,""):ct=ct.replace(/\\+/g,L=>L.length%2===0?"\\\\":L?"\\":"")),ct===t&&r.contains===!0?(E.output=t,E):(E.output=Zr.wrapOutput(ct,E,e),E)}for(;!cn();){if(R=ft(),R==="\0")continue;if(R==="\\"){let L=Ge();if(L==="/"&&r.bash!==!0||L==="."||L===";")continue;if(!L){R+="\\",Ee({type:"text",value:R});continue}let Ae=/^\\+/.exec(zi()),ot=0;if(Ae&&Ae[0].length>2&&(ot=Ae[0].length,E.index+=ot,ot%2!==0&&(R+="\\")),r.unescape===!0?R=ft():R+=ft(),E.brackets===0){Ee({type:"text",value:R});continue}}if(E.brackets>0&&(R!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&R===":"){let L=P.value.slice(1);if(L.includes("[")&&(P.posix=!0,L.includes(":"))){let Ae=P.value.lastIndexOf("["),ot=P.value.slice(0,Ae),Nt=P.value.slice(Ae+2),it=Exe[Nt];if(it){P.value=ot+it,E.backtrack=!0,ft(),!o.output&&s.indexOf(P)===1&&(o.output=p);continue}}}(R==="["&&Ge()!==":"||R==="-"&&Ge()==="]")&&(R=`\\${R}`),R==="]"&&(P.value==="["||P.value==="[^")&&(R=`\\${R}`),r.posix===!0&&R==="!"&&P.value==="["&&(R="^"),P.value+=R,bo({value:R});continue}if(E.quotes===1&&R!=='"'){R=Zr.escapeRegex(R),P.value+=R,bo({value:R});continue}if(R==='"'){E.quotes=E.quotes===1?0:1,r.keepQuotes===!0&&Ee({type:"text",value:R});continue}if(R==="("){Gh("parens"),Ee({type:"paren",value:R});continue}if(R===")"){if(E.parens===0&&r.strictBrackets===!0)throw new SyntaxError(zc("opening","("));let L=Z[Z.length-1];if(L&&E.parens===L.parens+1){$ae(Z.pop());continue}Ee({type:"paren",value:R,output:E.parens?")":"\\)"}),So("parens");continue}if(R==="["){if(r.nobracket===!0||!zi().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(zc("closing","]"));R=`\\${R}`}else Gh("brackets");Ee({type:"bracket",value:R});continue}if(R==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){Ee({type:"text",value:R,output:`\\${R}`});continue}if(E.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(zc("opening","["));Ee({type:"text",value:R,output:`\\${R}`});continue}So("brackets");let L=P.value.slice(1);if(P.posix!==!0&&L[0]==="^"&&!L.includes("/")&&(R=`/${R}`),P.value+=R,bo({value:R}),r.literalBrackets===!1||Zr.hasRegexChars(L))continue;let Ae=Zr.escapeRegex(P.value);if(E.output=E.output.slice(0,-P.value.length),r.literalBrackets===!0){E.output+=Ae,P.value=Ae;continue}P.value=`(${a}${Ae}|${P.value})`,E.output+=P.value;continue}if(R==="{"&&r.nobrace!==!0){Gh("braces");let L={type:"brace",value:R,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};ie.push(L),Ee(L);continue}if(R==="}"){let L=ie[ie.length-1];if(r.nobrace===!0||!L){Ee({type:"text",value:R,output:R});continue}let Ae=")";if(L.dots===!0){let ot=s.slice(),Nt=[];for(let it=ot.length-1;it>=0&&(s.pop(),ot[it].type!=="brace");it--)ot[it].type!=="dots"&&Nt.unshift(ot[it].value);Ae=Oxe(Nt,r),E.backtrack=!0}if(L.comma!==!0&&L.dots!==!0){let ot=E.output.slice(0,L.outputIndex),Nt=E.tokens.slice(L.tokensIndex);L.value=L.output="\\{",R=Ae="\\}",E.output=ot;for(let it of Nt)E.output+=it.output||it.value}Ee({type:"brace",value:R,output:Ae}),So("braces"),ie.pop();continue}if(R==="|"){Z.length>0&&Z[Z.length-1].conditions++,Ee({type:"text",value:R});continue}if(R===","){let L=R,Ae=ie[ie.length-1];Ae&&xe[xe.length-1]==="braces"&&(Ae.comma=!0,L="|"),Ee({type:"comma",value:R,output:L});continue}if(R==="/"){if(P.type==="dot"&&E.index===E.start+1){E.start=E.index+1,E.consumed="",E.output="",s.pop(),P=o;continue}Ee({type:"slash",value:R,output:f});continue}if(R==="."){if(E.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let L=ie[ie.length-1];P.type="dots",P.output+=R,P.value+=R,L.dots=!0;continue}if(E.braces+E.parens===0&&P.type!=="bos"&&P.type!=="slash"){Ee({type:"text",value:R,output:u});continue}Ee({type:"dot",value:R,output:u});continue}if(R==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&Ge()==="("&&Ge(2)!=="?"){Vh("qmark",R);continue}if(P&&P.type==="paren"){let Ae=Ge(),ot=R;(P.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(zi()))&&(ot=`\\${R}`),Ee({type:"text",value:R,output:ot});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){Ee({type:"qmark",value:R,output:S});continue}Ee({type:"qmark",value:R,output:_});continue}if(R==="!"){if(r.noextglob!==!0&&Ge()==="("&&(Ge(2)!=="?"||!/[!=<:]/.test(Ge(3)))){Vh("negate",R);continue}if(r.nonegate!==!0&&E.index===0){xae();continue}}if(R==="+"){if(r.noextglob!==!0&&Ge()==="("&&Ge(2)!=="?"){Vh("plus",R);continue}if(P&&P.value==="("||r.regex===!1){Ee({type:"plus",value:R,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||E.parens>0){Ee({type:"plus",value:R});continue}Ee({type:"plus",value:d});continue}if(R==="@"){if(r.noextglob!==!0&&Ge()==="("&&Ge(2)!=="?"){Ee({type:"at",extglob:!0,value:R,output:""});continue}Ee({type:"text",value:R});continue}if(R!=="*"){(R==="$"||R==="^")&&(R=`\\${R}`);let L=Axe.exec(zi());L&&(R+=L[0],E.index+=L[0].length),Ee({type:"text",value:R});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=R,P.output=C,E.backtrack=!0,E.globstar=!0,ln(R);continue}let U=zi();if(r.noextglob!==!0&&/^\([^?]/.test(U)){Vh("star",R);continue}if(P.type==="star"){if(r.noglobstar===!0){ln(R);continue}let L=P.prev,Ae=L.prev,ot=L.type==="slash"||L.type==="bos",Nt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!ot||U[0]&&U[0]!=="/")){Ee({type:"star",value:R,output:""});continue}let it=E.braces>0&&(L.type==="comma"||L.type==="brace"),ri=Z.length&&(L.type==="pipe"||L.type==="paren");if(!ot&&L.type!=="paren"&&!it&&!ri){Ee({type:"star",value:R,output:""});continue}for(;U.slice(0,3)==="/**";){let ni=t[E.index+4];if(ni&&ni!=="/")break;U=U.slice(3),ln("/**",3)}if(L.type==="bos"&&cn()){P.type="globstar",P.value+=R,P.output=I(r),E.output=P.output,E.globstar=!0,ln(R);continue}if(L.type==="slash"&&L.prev.type!=="bos"&&!Nt&&cn()){E.output=E.output.slice(0,-(L.output+P.output).length),L.output=`(?:${L.output}`,P.type="globstar",P.output=I(r)+(r.strictSlashes?")":"|$)"),P.value+=R,E.globstar=!0,E.output+=L.output+P.output,ln(R);continue}if(L.type==="slash"&&L.prev.type!=="bos"&&U[0]==="/"){let ni=U[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(L.output+P.output).length),L.output=`(?:${L.output}`,P.type="globstar",P.output=`${I(r)}${f}|${f}${ni})`,P.value+=R,E.output+=L.output+P.output,E.globstar=!0,ln(R+ft()),Ee({type:"slash",value:"/",output:""});continue}if(L.type==="bos"&&U[0]==="/"){P.type="globstar",P.value+=R,P.output=`(?:^|${f}|${I(r)}${f})`,E.output=P.output,E.globstar=!0,ln(R+ft()),Ee({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-P.output.length),P.type="globstar",P.output=I(r),P.value+=R,E.output+=P.output,E.globstar=!0,ln(R);continue}let ct={type:"star",value:R,output:C};if(r.bash===!0){ct.output=".*?",(P.type==="bos"||P.type==="slash")&&(ct.output=T+ct.output),Ee(ct);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){ct.output=R,Ee(ct);continue}(E.index===E.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(E.output+=g,P.output+=g):r.dot===!0?(E.output+=v,P.output+=v):(E.output+=T,P.output+=T),Ge()!=="*"&&(E.output+=p,P.output+=p)),Ee(ct)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(zc("closing","]"));E.output=Zr.escapeLast(E.output,"["),So("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(zc("closing",")"));E.output=Zr.escapeLast(E.output,"("),So("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(zc("closing","}"));E.output=Zr.escapeLast(E.output,"{"),So("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&Ee({type:"maybe_slash",value:"",output:`${f}?`}),E.backtrack===!0){E.output="";for(let U of E.tokens)E.output+=U.output!=null?U.output:U.value,U.suffix&&(E.output+=U.suffix)}return E};PI.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(tv,r.maxLength):tv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=MW[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=cf.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",v={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,w=T=>{switch(T){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let k=/^(.*?)\.(\w+)$/.exec(T);if(!k)return;let C=w(k[1]);return C?C+o+k[2]:void 0}}},x=Zr.removePrefix(t,v),I=w(x);return I&&r.strictSlashes!==!0&&(I+=`${s}?`),I};LW.exports=PI});var HW=b((Ytt,BW)=>{"use strict";var Nxe=jW(),RI=UW(),qW=sf(),jxe=of(),Mxe=t=>t&&typeof t=="object"&&!Array.isArray(t),Et=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Et(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=Mxe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Et.compileRe(t,e):Et.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Et(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Et.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Et.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?qW.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Et.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Et.matchBase=(t,e,r)=>(e instanceof RegExp?e:Et.makeRe(e,r)).test(qW.basename(t));Et.isMatch=(t,e,r)=>Et(e,r)(t);Et.parse=(t,e)=>Array.isArray(t)?t.map(r=>Et.parse(r,e)):RI(t,{...e,fastpaths:!1});Et.scan=(t,e)=>Nxe(t,e);Et.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Et.toRegex(a,e);return n===!0&&(c.state=t),c};Et.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=RI.fastpaths(t,e)),i.output||(i=RI(t,e)),Et.compileRe(i,e,r,n)};Et.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Et.constants=jxe;BW.exports=Et});var WW=b((Xtt,VW)=>{"use strict";var ZW=HW(),Fxe=sf();function GW(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Fxe.isWindows()}),ZW(t,e,r)}Object.assign(GW,ZW);VW.exports=GW});import{readdir as zxe,readdirSync as Lxe,realpath as Uxe,realpathSync as qxe,stat as Bxe,statSync as Hxe}from"fs";import{isAbsolute as Zxe,posix as ia,resolve as Gxe}from"path";import{fileURLToPath as Vxe}from"url";function Jxe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&Kxe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>ia.relative(t,n)||".":n=>ia.relative(t,`${e}/${n}`)||"."}function Qxe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=ia.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function XW(t){var e;let r=Lc.default.scan(t,e$e);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function s$e(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Lc.default.scan(t);return r.isGlob||r.negated}function lf(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function QW(t){return typeof t=="string"?[t]:t??[]}function CI(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=o$e(o);s=Zxe(s.replace(c$e,""))?ia.relative(a,s):ia.normalize(s);let c=(i=a$e.exec(s))===null||i===void 0?void 0:i[0],l=XW(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?ia.join(o,...d):o}return s}function l$e(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(CI(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(CI(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(CI(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function u$e(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=l$e(t,e,n);t.debug&&lf("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(JW,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Lc.default)(i.match,f),m=(0,Lc.default)(i.ignore,f),h=Jxe(i.match,f),g=KW(r,d,o),v=o?g:KW(r,d,!0),_=(x,I)=>{let T=v(I,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let w=new wW({filters:[a?(x,I)=>{let T=g(x,I),k=p(T)&&!m(T);return k&&lf(`matched ${T}`),k}:(x,I)=>{let T=g(x,I);return p(T)&&!m(T)}],exclude:a?(x,I)=>{let T=_(x,I);return lf(`${T?"skipped":"crawling"} ${I}`),T}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&lf("internal properties:",{...n,root:d}),[w,r!==d&&!o&&Qxe(r,d)]}function d$e(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function p$e(t){let e={...f$e,...t};return e.cwd=(e.cwd instanceof URL?Vxe(e.cwd):Gxe(e.cwd)).replace(JW,"/"),e.ignore=QW(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||zxe,readdirSync:e.fs.readdirSync||Lxe,realpath:e.fs.realpath||Uxe,realpathSync:e.fs.realpathSync||qxe,stat:e.fs.stat||Bxe,statSync:e.fs.statSync||Hxe}),e.debug&&lf("globbing with options:",e),e}function m$e(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=Wxe(t)||typeof t=="string",i=QW((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=p$e(n?e:t);return i.length>0?u$e(o,i):[]}function Bo(t,e){let[r,n]=m$e(t,e);return r?d$e(r.sync(),n):[]}var Lc,Wxe,JW,YW,Kxe,Yxe,Xxe,e$e,t$e,r$e,n$e,i$e,o$e,a$e,c$e,f$e,uf=y(()=>{xW();Lc=$t(WW(),1),Wxe=Array.isArray,JW=/\\/g,YW=process.platform==="win32",Kxe=/^(\/?\.\.)+$/;Yxe=/^[A-Z]:\/$/i,Xxe=YW?t=>Yxe.test(t):t=>t==="/";e$e={parts:!0};t$e=/(?t.replace(t$e,"\\$&"),i$e=t=>t.replace(r$e,"\\$&"),o$e=YW?i$e:n$e;a$e=/^(\/?\.\.)+/,c$e=/\\(?=[()[\]{}!*+?@|])/g;f$e={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as rv,readFileSync as h$e,readdirSync as g$e,statSync as eK}from"node:fs";import{join as Uc}from"node:path";function y$e(t){let{cwd:e="."}=t,r,n;try{let c=J(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=mi(e,n),o=[],{layers:s,forbiddenImports:a}=DI(r);return s.size>0&&(_$e(e,i,s,o),v$e(e,i,s,o)),a.length>0&&b$e(e,i,a,o),o}function DI(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function _$e(t,e,r,n){let i=e.mainRoot,o=Uc(t,i);if(rv(o))for(let s of g$e(o)){let a=Uc(o,s);eK(a).isDirectory()&&(r.has(s)||n.push({detector:nv,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function v$e(t,e,r,n){let i=e.mainRoot,o=Uc(t,i);if(rv(o))for(let s of r){let a=Uc(o,s);rv(a)&&eK(a).isDirectory()||n.push({detector:nv,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function b$e(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Uc(t,i,s.from);if(!rv(a))continue;let c=Bo([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Uc(a,l),d;try{d=h$e(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];S$e(p,s.to,e.importStyle)&&n.push({detector:nv,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function S$e(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var nv,tK,NI=y(()=>{"use strict";uf();lt();Fc();nv="ARCHITECTURE_FROM_SPEC";tK={name:nv,run:y$e}});import{existsSync as w$e,readFileSync as x$e}from"node:fs";import{join as $$e}from"node:path";function k$e(t){let{cwd:e="."}=t,r=$$e(e,"spec/capabilities.yaml");if(!w$e(r))return[];let n;try{let c=x$e(r,"utf8"),l=rK.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=J(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:iv,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:iv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:iv,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var rK,iv,nK,iK=y(()=>{"use strict";rK=$t(rr(),1);lt();iv="CAPABILITIES_FEATURE_MAPPING";nK={name:iv,run:k$e}});import{existsSync as E$e,readFileSync as A$e}from"node:fs";import{join as T$e}from"node:path";function O$e(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function I$e(t){let{cwd:e="."}=t;return pe(e,jI,r=>P$e(r,e))}function P$e(t,e){let r=mi(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=T$e(e,o);if(!E$e(s))continue;let a=A$e(s,"utf8");O$e(a)||n.push({detector:jI,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var jI,oK,sK=y(()=>{"use strict";Fc();_t();jI="CONVENTION_DRIFT";oK={name:jI,run:I$e}});import{existsSync as MI,readFileSync as aK}from"node:fs";import{join as ov}from"node:path";function R$e(t){return JSON.parse(t).total?.lines?.pct??0}function cK(t){let e=/MI(ov(c.dir,d)));if(!l){s.push(c.path);continue}let u=cK(aK(ov(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:Qi,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=lK(n,i);return a0?[{detector:Qi,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function N$e(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let s=D$e(e,t.focusModules);if(s)return s}let r=mi(e),n=pt(e).language==="kotlin"?pI.find(s=>MI(ov(e,s)))??VV(e):r.coverageSummary,i=ov(e,n);if(!MI(i))return[{detector:Qi,severity:"info",message:`${n} not present \u2014 run stage_2.2 first`}];let o;try{let s=aK(i,"utf8");o=r.coverageFormat==="jacoco-xml"?C$e(s):R$e(s)}catch(s){return[{detector:Qi,severity:"warn",message:`${n} unparseable: ${s.message}`}]}return o===null?[{detector:Qi,severity:"warn",message:`${n} contained no line-coverage counter`}]:o>=sv?[]:[{detector:Qi,severity:"warn",message:`line coverage ${o.toFixed(1)}% < floor ${sv}%`}]}var Qi,sv,uK,dK=y(()=>{"use strict";Z_();Fc();q_();mn();Qi="COVERAGE_DROP",sv=70;uK={name:Qi,run:N$e}});import{existsSync as j$e}from"node:fs";import{join as M$e}from"node:path";function F$e(t){let{cwd:e="."}=t;return pe(e,av,r=>z$e(r,e))}function z$e(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?j$e(M$e(e,r.path))?[]:[{detector:av,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:av,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var av,fK,pK=y(()=>{"use strict";_t();av="DELIVERABLE_INTEGRITY";fK={name:av,run:F$e}});function L$e(t){let e=(t.features??[]).filter(i=>i.status==="done");return e.length===0?[]:!t.project?.deliverable?[]:(t.project?.smoke??[]).length>0?[]:[{detector:FI,severity:"warn",path:"spec.yaml",message:`${e.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function U$e(t){let{cwd:e="."}=t;return pe(e,FI,r=>L$e(r))}var FI,mK,hK=y(()=>{"use strict";_t();FI="SMOKE_PROBE_DEMAND";mK={name:FI,run:U$e}});function q$e(t){let{cwd:e="."}=t;return pe(e,cv,r=>B$e(r,e))}function B$e(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=gc(e);if(n===null)return[{detector:cv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=n.get(o.id),a=Rd(e,o.modules??[]);s!==a&&i.push({detector:cv,severity:"warn",path:"spec/attestation.yaml",message:s===void 0?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var cv,lv,zI=y(()=>{"use strict";Cd();_t();cv="STALE_ATTESTATION";lv={name:cv,run:q$e}});function H$e(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}return Z$e(r)}function Z$e(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:gK,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var gK,uv,LI=y(()=>{"use strict";lt();gK="DEPENDENCY_CYCLE";uv={name:gK,run:H$e}});import{appendFileSync as G$e,existsSync as yK,mkdirSync as V$e,readFileSync as W$e}from"node:fs";import{dirname as K$e,join as J$e}from"node:path";function _K(t){return J$e(t,Y$e,X$e)}function vK(t){return UI.add(t),()=>UI.delete(t)}function oa(t,e){let r=_K(t),n=K$e(r);yK(n)||V$e(n,{recursive:!0}),G$e(r,`${JSON.stringify(e)} -`,"utf8");for(let i of UI)try{i(t,e)}catch{}}function gn(t){let e=_K(t);if(!yK(e))return[];let r=W$e(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var Y$e,X$e,UI,Ln=y(()=>{"use strict";Y$e=".cladding",X$e="audit.log.jsonl";UI=new Set});import{existsSync as Q$e}from"node:fs";import{join as e0e}from"node:path";function t0e(t){let{cwd:e="."}=t,r=gn(e);if(r.length===0)return[{detector:qI,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(Q$e(e0e(e,i.artifact))||n.push({detector:qI,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var qI,bK,SK=y(()=>{"use strict";Ln();qI="EVIDENCE_MISMATCH";bK={name:qI,run:t0e}});import{existsSync as r0e,readFileSync as n0e}from"node:fs";import{join as i0e}from"node:path";function o0e(t){let e=i0e(t,kK);if(!r0e(e))return null;try{let n=((0,$K.parse)(n0e(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*xK(t,e){for(let r of t??[])r.startsWith(wK)&&(yield{ref:r,name:r.slice(wK.length),field:e})}function s0e(t){let{cwd:e="."}=t,r=o0e(e);if(r===null)return[];let n;try{n=J(e)}catch(o){return[{detector:BI,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...xK(s.evidence_refs,"evidence_refs"),...xK(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:BI,severity:"warn",path:kK,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var $K,BI,wK,kK,EK,AK=y(()=>{"use strict";$K=$t(rr(),1);lt();BI="FIXTURE_REFERENCE_INVALID",wK="fixture:",kK="conformance/fixtures.yaml";EK={name:BI,run:s0e}});function a0e(t){let{cwd:e="."}=t,r=pt(e),n=r.gates.secret;if(!n)return[{detector:dv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Qe(n.cmd,[...n.args],{cwd:e,reject:!1});return rf(i)?[{detector:dv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:V_(i,dv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var dv,fv,HI=y(()=>{"use strict";Ar();mn();hn();dv="HARDCODED_SECRET";fv={name:dv,run:a0e}});import{existsSync as qc,readFileSync as ZI}from"node:fs";import{join as sa}from"node:path";function c0e(t){return Bo(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec)\.ts$/.test(r)).length}function df(t){if(!qc(t))return null;try{return JSON.parse(ZI(t,"utf8"))}catch{return null}}function l0e(t,e){let r=sa(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(ZI(r,"utf8"))}catch(c){e.push({detector:eo,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:eo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=c0e(t);s!==a&&e.push({detector:eo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function u0e(t,e){for(let r of TK){let n=sa(t,r.path);if(!qc(n))continue;let i=df(n);if(!i){e.push({detector:eo,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:eo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function d0e(t,e){let r=df(sa(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of TK){let s=sa(t,o.path);if(!qc(s))continue;let a=df(s);a?.version&&a.version!==n&&e.push({detector:eo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=sa(t,".claude-plugin","marketplace.json");if(qc(i)){let o=df(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:eo,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function f0e(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function p0e(t,e){let r=sa(t,"src","cli","clad.ts"),n=sa(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!qc(r)||!qc(n))return;let i=f0e(ZI(r,"utf8"));if(i.length===0)return;let s=df(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:eo,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function m0e(t){let{cwd:e="."}=t,r=[];return l0e(e,r),p0e(e,r),u0e(e,r),d0e(e,r),r}var eo,TK,OK,IK=y(()=>{"use strict";uf();eo="HARNESS_INTEGRITY",TK=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];OK={name:eo,run:m0e}});import{existsSync as h0e,readFileSync as g0e}from"node:fs";import{join as y0e}from"node:path";function v0e(t){let{cwd:e="."}=t;return pe(e,pv,r=>w0e(r,e))}function b0e(){return _0e}function S0e(t){let e=y0e(t,"spec/capabilities.yaml");if(!h0e(e))return!1;try{let r=PK.default.parse(g0e(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function w0e(t,e){let r=t.features.length;if(r{"use strict";PK=$t(rr(),1);_t();pv="HOLLOW_GOVERNANCE",_0e=8;RK={name:pv,run:v0e}});function x0e(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=[];return DK(r.features.map(i=>i.id),"feature","spec/features/",n),DK((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function DK(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:NK,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var NK,jK,MK=y(()=>{"use strict";lt();NK="ID_COLLISION";jK={name:NK,run:x0e}});import{existsSync as ff,readFileSync as GI,readdirSync as VI,statSync as $0e,writeFileSync as zK}from"node:fs";import{join as to}from"node:path";function FK(t){if(!ff(t))return 0;try{return VI(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function k0e(t){if(!ff(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=VI(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=to(n,o),a;try{a=$0e(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function E0e(t){let e=to(t,"spec","capabilities.yaml");if(!ff(e))return 0;try{let r=mv.default.parse(GI(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function Ho(t="."){let e=FK(to(t,"spec","features")),r=FK(to(t,"spec","scenarios")),n=E0e(t),i=k0e(to(t,"tests")),o=new Date().toISOString().slice(0,10);return{features:e,scenarios:r,capabilities:n,test_files:i,last_synced:o}}function Bc(t,e){let r=to(t,"spec.yaml");if(!ff(r))return;let n=GI(r,"utf8"),i=A0e(n,e);i!==n&&zK(r,i)}function A0e(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as I_e}from"node:buffer";import{StringDecoder as P_e}from"node:string_decoder";var __,R_e,C_e,D_e,mO=y(()=>{Vr();__=(t,e,r)=>{if(r)return;if(t)return{transform:R_e.bind(void 0,new TextEncoder)};let n=new P_e(e);return{transform:C_e.bind(void 0,n),final:D_e.bind(void 0,n)}},R_e=function*(t,e){I_e.isBuffer(e)?yield Yi(e):typeof e=="string"?yield t.encode(e):yield e},C_e=function*(t,e){yield Ft(e)?t.write(e):e},D_e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as HG}from"node:util";var hO,b_,ZG,N_e,GG,j_e,VG=y(()=>{hO=HG(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),b_=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=j_e}=e[r];for await(let i of n(t))yield*b_(i,e,r+1)},ZG=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*N_e(r,Number(e),t)},N_e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*b_(n,r,e+1)},GG=HG(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),j_e=function*(t){yield t}});var gO,WG,ia,ef,M_e,F_e,yO=y(()=>{gO=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},WG=(t,e)=>[...e.flatMap(r=>[...ia(r,t,0)]),...ef(t)],ia=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=F_e}=e[r];for(let i of n(t))yield*ia(i,e,r+1)},ef=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*M_e(r,Number(e),t)},M_e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*ia(n,r,e+1)},F_e=function*(t){yield t}});import{Transform as z_e,getDefaultHighWaterMark as KG}from"node:stream";var _O,v_,JG,S_=y(()=>{hr();y_();BG();mO();VG();yO();_O=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=JG(t,s,o),l=na(e),u=na(r),d=l?hO.bind(void 0,b_,a):gO.bind(void 0,ia),f=l||u?hO.bind(void 0,ZG,a):gO.bind(void 0,ef),p=l||u?GG.bind(void 0,a):void 0;return{stream:new z_e({writableObjectMode:n,writableHighWaterMark:KG(n),readableObjectMode:i,readableHighWaterMark:KG(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},v_=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=JG(s,r,a);t=WG(c,t)}return t},JG=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:LG(n,a)},__(r,s,n),g_(r,o,n,c),{transform:t,final:e},{transform:UG(i,a)},zG({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var YG,L_e,U_e,q_e,B_e,XG=y(()=>{S_();Vr();hr();YG=(t,e)=>{for(let r of L_e(t))U_e(t,r,e)},L_e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),U_e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ho[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>q_e(a,n));r.input=Fd(s)},q_e=(t,e)=>{let r=v_(t,e,"utf8",!0);return B_e(r),Fd(r)},B_e=t=>{let e=t.find(r=>typeof r!="string"&&!Ft(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var w_,H_e,Z_e,QG,e9,G_e,t9,bO=y(()=>{Qs();hr();kc();Lo();w_=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&$c(r,n)&&!Wr.has(e)&&H_e(n)&&(t.some(({type:i,value:o})=>i==="native"&&Z_e.has(o))||t.every(({type:i})=>hn.has(i))),H_e=t=>t===1||t===2,Z_e=new Set(["pipe","overlapped"]),QG=async(t,e,r,n)=>{for await(let i of t)G_e(e)||t9(i,r,n)},e9=(t,e,r)=>{for(let n of t)t9(n,e,r)},G_e=t=>t._readableState.pipes.length>0,t9=(t,e,r)=>{let n=Sy(t);mi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as V_e,appendFileSync as W_e}from"node:fs";var r9,K_e,J_e,Y_e,X_e,Q_e,n9=y(()=>{bO();S_();y_();Vr();hr();ra();r9=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>K_e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},K_e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=UZ(t,o,d),p=Yi(f),{stdioItems:m,objectMode:h}=e[r],g=J_e([p],m,c,n),{serializedResult:b,finalResult:_=b}=Y_e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});X_e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&Q_e(b,m,i),S}catch(x){return n.error=x,S}},J_e=(t,e,r,n)=>{try{return v_(t,e,r,!1)}catch(i){return n.error=i,t}},Y_e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Fd(t)};let s=P6(t,r);return n[o]?{serializedResult:s,finalResult:pO(s,!i[o],e)}:{serializedResult:s}},X_e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!w_({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=pO(t,!1,s);try{e9(a,e,n)}catch(c){r.error??=c}},Q_e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>p_.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?W_e(n,t):(r.add(o),V_e(n,t))}}});var i9,o9=y(()=>{Vr();Qd();i9=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ro(e,r,"all")]:Array.isArray(e)?[ro(t,r,"all"),...e]:Ft(t)&&Ft(e)?cT([t,e]):`${t}${e}`}});import{once as vO}from"node:events";var s9,ebe,a9,c9,tbe,SO,wO=y(()=>{Ys();s9=async(t,e)=>{let[r,n]=await ebe(t);return e.isForcefullyTerminated??=!1,[r,n]},ebe=async t=>{let[e,r]=await Promise.allSettled([vO(t,"spawn"),vO(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?a9(t):r.value},a9=async t=>{try{return await vO(t,"exit")}catch{return a9(t)}},c9=async t=>{let[e,r]=await t;if(!tbe(e,r)&&SO(e,r))throw new Un;return[e,r]},tbe=(t,e)=>t===void 0&&e===void 0,SO=(t,e)=>t!==0||e!==null});var l9,rbe,u9=y(()=>{Ys();ra();wO();l9=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=rbe(t,e,r),s=o?.code==="ETIMEDOUT",a=LZ(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},rbe=(t,e,r)=>t!==void 0?t:SO(e,r)?new Un:void 0});import{spawnSync as nbe}from"node:child_process";var d9,ibe,obe,sbe,x_,abe,cbe,lbe,ube,f9=y(()=>{yT();ZT();GT();Xd();u_();jG();Qd();XG();n9();ra();o9();u9();d9=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=ibe(t,e,r),d=abe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return jc(d,c,l)},ibe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=$y(t,e,r),a=obe(r),{file:c,commandArguments:l,options:u}=Yy(t,e,a);sbe(u);let d=DG(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},obe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,sbe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&x_("ipcInput"),t&&x_("ipc: true"),r&&x_("detached: true"),n&&x_("cancelSignal")},x_=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},abe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=cbe({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=l9(c,r),{output:m,error:h=l}=r9({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ro(_,r,S)),b=ro(i9(m,r),r,"all");return ube({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},cbe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{YG(o,r);let a=lbe(r);return nbe(...Xy(t,e,a))}catch(a){return Nc({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},lbe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:c_(e)}),ube=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?l_({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Yd({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as xO,on as dbe}from"node:events";var p9,fbe,pbe,mbe,hbe,m9=y(()=>{Ic();Gd();Zd();p9=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Tc({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Hy(t)}),fbe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),fbe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{My(e,i);let o=Bo(t,e,r),s=new AbortController;try{return await Promise.race([pbe(o,n,s),mbe(o,r,s),hbe(o,r,s)])}catch(a){throw Oc(t),a}finally{s.abort(),Fy(e,i)}},pbe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await xO(t,"message",{signal:r});return n}for await(let[n]of dbe(t,"message",{signal:r}))if(e(n))return n},mbe=async(t,e,{signal:r})=>{await xO(t,"disconnect",{signal:r}),kH(e)},hbe=async(t,e,{signal:r})=>{let[n]=await xO(t,"strict:error",{signal:r});throw Cy(n,e)}});import{once as g9,on as gbe}from"node:events";var y9,$O,ybe,_be,bbe,h9,kO=y(()=>{Ic();Gd();Zd();y9=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>$O({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),$O=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Tc({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Hy(t)}),My(e,o);let s=Bo(t,e,r),a=new AbortController,c={};return ybe(t,s,a),_be({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),bbe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},ybe=async(t,e,r)=>{try{await g9(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},_be=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await g9(t,"strict:error",{signal:r.signal});n.error=Cy(i,e),r.abort()}catch{}},bbe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of gbe(r,"message",{signal:o.signal}))h9(s),yield c}catch{h9(s)}finally{o.abort(),Fy(e,a),n||Oc(t),i&&await t}},h9=({error:t})=>{if(t)throw t}});import _9 from"node:process";var b9,v9,S9,EO=y(()=>{Ky();m9();kO();qy();b9=(t,{ipc:e})=>{Object.assign(t,S9(t,!1,e))},v9=()=>{let t=_9,e=!0,r=_9.channel!==void 0;return{...S9(t,e,r),getCancelSignal:QH.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},S9=(t,e,r)=>({sendMessage:Wy.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:p9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:y9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as vbe}from"node:child_process";import{PassThrough as Sbe,Readable as wbe,Writable as xbe,Duplex as $be}from"node:stream";var w9,kbe,tf,Ebe,Abe,Tbe,Obe,x9=y(()=>{h_();Xd();u_();w9=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{uO(n);let a=new vbe;kbe(a,n),Object.assign(a,{readable:Ebe,writable:Abe,duplex:Tbe});let c=Nc({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=Obe(c,s,i);return{subprocess:a,promise:l}},kbe=(t,e)=>{let r=tf(),n=tf(),i=tf(),o=Array.from({length:e.length-3},tf),s=tf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},tf=()=>{let t=new Sbe;return t.end(),t},Ebe=()=>new wbe({read(){}}),Abe=()=>new xbe({write(){}}),Tbe=()=>new $be({read(){},write(){}}),Obe=async(t,e,r)=>jc(t,e,r)});import{createReadStream as $9,createWriteStream as k9}from"node:fs";import{Buffer as Ibe}from"node:buffer";import{Readable as rf,Writable as Pbe,Duplex as Rbe}from"node:stream";var A9,nf,E9,Cbe,T9=y(()=>{S_();h_();hr();A9=(t,e)=>m_(Cbe,t,e,!1),nf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ho[t]}.`)},E9={fileNumber:nf,generator:_O,asyncGenerator:_O,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Rbe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Cbe={input:{...E9,fileUrl:({value:t})=>({stream:$9(t)}),filePath:({value:{file:t}})=>({stream:$9(t)}),webStream:({value:t})=>({stream:rf.fromWeb(t)}),iterable:({value:t})=>({stream:rf.from(t)}),asyncIterable:({value:t})=>({stream:rf.from(t)}),string:({value:t})=>({stream:rf.from(t)}),uint8Array:({value:t})=>({stream:rf.from(Ibe.from(t))})},output:{...E9,fileUrl:({value:t})=>({stream:k9(t)}),filePath:({value:{file:t,append:e}})=>({stream:k9(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Pbe.fromWeb(t)}),iterable:nf,asyncIterable:nf,string:nf,uint8Array:nf}}});import{on as Dbe,once as O9}from"node:events";import{PassThrough as Nbe,getDefaultHighWaterMark as jbe}from"node:stream";import{finished as R9}from"node:stream/promises";function oa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)TO(i);let e=t.some(({readableObjectMode:i})=>i),r=Mbe(t,e),n=new AO({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Mbe,AO,Fbe,zbe,Lbe,TO,Ube,qbe,Bbe,Hbe,Zbe,C9,D9,OO,N9,Gbe,$_,I9,P9,k_=y(()=>{Mbe=(t,e)=>{if(t.length===0)return jbe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},AO=class extends Nbe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(TO(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Fbe(this,this.#t,this.#o);let r=Ube({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(TO(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},Fbe=async(t,e,r)=>{$_(t,I9);let n=new AbortController;try{await Promise.race([zbe(t,n),Lbe(t,e,r,n)])}finally{n.abort(),$_(t,-I9)}},zbe=async(t,{signal:e})=>{try{await R9(t,{signal:e,cleanup:!0})}catch(r){throw C9(t,r),r}},Lbe=async(t,e,r,{signal:n})=>{for await(let[i]of Dbe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},TO=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Ube=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{$_(t,P9);let a=new AbortController;try{await Promise.race([qbe(o,e,a),Bbe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Hbe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),$_(t,-P9)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?OO(t):Zbe(t))},qbe=async(t,e,{signal:r})=>{try{await t,r.aborted||OO(e)}catch(n){r.aborted||C9(e,n)}},Bbe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await R9(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;D9(s)?i.add(e):N9(t,s)}},Hbe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await O9(t,i,{signal:o}),!t.readable)return O9(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},Zbe=t=>{t.writable&&t.end()},C9=(t,e)=>{D9(e)?OO(t):N9(t,e)},D9=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",OO=t=>{(t.readable||t.writable)&&t.destroy()},N9=(t,e)=>{t.destroyed||(t.once("error",Gbe),t.destroy(e))},Gbe=()=>{},$_=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},I9=2,P9=1});import{finished as j9}from"node:stream/promises";var Fc,Vbe,IO,Wbe,PO,E_=y(()=>{Xi();Fc=(t,e)=>{t.pipe(e),Vbe(t,e),Wbe(t,e)},Vbe=async(t,e)=>{if(!(Ln(t)||Ln(e))){try{await j9(t,{cleanup:!0,readable:!0,writable:!1})}catch{}IO(e)}},IO=t=>{t.writable&&t.end()},Wbe=async(t,e)=>{if(!(Ln(t)||Ln(e))){try{await j9(e,{cleanup:!0,readable:!1,writable:!0})}catch{}PO(t)}},PO=t=>{t.readable&&t.destroy()}});var M9,Kbe,Jbe,Ybe,Xbe,Qbe,F9=y(()=>{k_();Xi();jy();hr();E_();M9=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>hn.has(c)))Kbe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!hn.has(c)))Ybe({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:oa(o);Fc(s,i)}},Kbe=(t,e,r,n)=>{r==="output"?Fc(t.stdio[n],e):Fc(e,t.stdio[n]);let i=Jbe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Jbe=["stdin","stdout","stderr"],Ybe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Xbe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Xbe=(t,{signal:e})=>{Ln(t)&&Xs(t,Qbe,e)},Qbe=2});var sa,z9=y(()=>{sa=[];sa.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&sa.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&sa.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var A_,RO,CO,eve,DO,T_,tve,NO,jO,MO,L9,r7e,n7e,U9=y(()=>{z9();A_=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",RO=Symbol.for("signal-exit emitter"),CO=globalThis,eve=Object.defineProperty.bind(Object),DO=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(CO[RO])return CO[RO];eve(CO,RO,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},T_=class{},tve=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),NO=class extends T_{onExit(){return()=>{}}load(){}unload(){}},jO=class extends T_{#t=MO.platform==="win32"?"SIGINT":"SIGHUP";#r=new DO;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of sa)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!A_(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of sa)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,sa.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return A_(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&A_(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},MO=globalThis.process,{onExit:L9,load:r7e,unload:n7e}=tve(A_(MO)?new jO(MO):new NO)});import{addAbortListener as rve}from"node:events";var q9,B9=y(()=>{U9();q9=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=L9(()=>{t.kill()});rve(n,()=>{i()})}});var Z9,nve,ive,H9,ove,G9=y(()=>{aT();xy();qo();wc();Z9=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=wy(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=nve(r,n,i),{sourceStream:d,sourceError:f}=ove(t,l),{options:p,fileDescriptors:m}=gi.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},nve=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=ive(t,e,...r),a=Ny(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},ive=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(H9,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||oT(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=dy(r,...n);return{destination:e(H9)(i,o,s),pipeOptions:s}}if(gi.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},H9=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),ove=(t,e)=>{try{return{sourceStream:Rc(t,e)}}catch(r){return{sourceError:r}}}});var W9,sve,FO,V9,zO=y(()=>{Xd();E_();W9=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=sve({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw FO({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},sve=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return PO(t),n;if(e!==void 0)return IO(r),e},FO=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Nc({error:t,command:V9,escapedCommand:V9,fileDescriptors:e,options:r,startTime:n,isSync:!1}),V9="source.pipe(destination)"});var K9,J9=y(()=>{K9=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as ave}from"node:stream/promises";var Y9,cve,lve,uve,O_,dve,fve,X9=y(()=>{k_();jy();E_();Y9=(t,e,r)=>{let n=O_.has(e)?lve(t,e):cve(t,e);return Xs(t,dve,r.signal),Xs(e,fve,r.signal),uve(e),n},cve=(t,e)=>{let r=oa([t]);return Fc(r,e),O_.set(e,r),r},lve=(t,e)=>{let r=O_.get(e);return r.add(t),r},uve=async t=>{try{await ave(t,{cleanup:!0,readable:!1,writable:!0})}catch{}O_.delete(t)},O_=new WeakMap,dve=2,fve=1});import{aborted as pve}from"node:util";var Q9,mve,eV=y(()=>{zO();Q9=(t,e)=>t===void 0?[]:[mve(t,e)],mve=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await pve(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw FO({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var I_,hve,gve,tV=y(()=>{Ji();G9();zO();J9();X9();eV();I_=(t,...e)=>{if(Et(e[0]))return I_.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Z9(t,...e),i=hve({...n,destination:r});return i.pipe=I_.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},hve=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=gve(t,i);W9({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Y9(e,o,d);return await Promise.race([K9(u),...Q9(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},gve=(t,e)=>Promise.allSettled([t,e])});import{on as yve}from"node:events";import{getDefaultHighWaterMark as _ve}from"node:stream";var P_,bve,LO,vve,nV,UO,rV,Sve,wve,R_=y(()=>{mO();y_();yO();P_=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return bve(e,s),nV({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},bve=async(t,e)=>{try{await t}catch{}finally{e.abort()}},LO=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;vve(e,s,t);let a=t.readableObjectMode&&!o;return nV({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},vve=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},nV=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=yve(t,"data",{signal:e.signal,highWaterMark:rV,highWatermark:rV});return Sve({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},UO=_ve(!0),rV=UO,Sve=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=wve({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*ia(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*ef(a)}},wve=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[__(t,r,!e),g_(t,i,!n,{})].filter(Boolean)});import{setImmediate as xve}from"node:timers/promises";var iV,$ve,kve,Eve,qO,oV,BO=y(()=>{a_();Vr();bO();R_();ra();Qd();iV=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=$ve({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([kve(t),d]);return}let f=dO(c,r),p=LO({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Eve({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},$ve=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!w_({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=LO({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await QG(a,t,r,o)},kve=async t=>{await xve(),t.readableFlowing===null&&t.resume()},Eve=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await n_(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await i_(r,{maxBuffer:o})):await s_(r,{maxBuffer:o})}catch(a){return oV(MZ({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},qO=async t=>{try{return await t}catch(e){return oV(e)}},oV=({bufferedData:t})=>O6(t)?new Uint8Array(t):t});import{finished as Ave}from"node:stream/promises";var of,Tve,Ove,Ive,Pve,Rve,HO,C_,sV,D_=y(()=>{of=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Tve(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Ave(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Pve(a,e,r,n)}finally{s.abort()}},Tve=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Ove(t,r,n),n},Ove=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Ive(e,r),n.call(t,...i)}},Ive=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Pve=(t,e,r,n)=>{if(!Rve(t,e,r,n))throw t},Rve=(t,e,r,n=!0)=>r.propagating?sV(t)||C_(t):(r.propagating=!0,HO(r,e)===n?sV(t):C_(t)),HO=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",C_=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",sV=t=>t?.code==="EPIPE"});var aV,ZO,GO=y(()=>{BO();D_();aV=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>ZO({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),ZO=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=of(t,e,l);if(HO(l,e)){await u;return}let[d]=await Promise.all([iV({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var cV,lV,Cve,Dve,VO=y(()=>{k_();GO();cV=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?oa([t,e].filter(Boolean)):void 0,lV=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>ZO({...Cve(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Dve(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Cve=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},Dve=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var uV,dV,fV=y(()=>{kc();Lo();uV=t=>$c(t,"ipc"),dV=(t,e)=>{let r=Sy(t);mi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var pV,mV,hV=y(()=>{ra();fV();eo();kO();pV=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=uV(o),a=Qi(e,"ipc"),c=Qi(r,"ipc");for await(let l of $O({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(FZ(t,i,c),i.push(l)),s&&dV(l,o);return i},mV=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Nve}from"node:events";var gV,jve,Mve,Fve,yV=y(()=>{ta();LT();PT();zT();Xi();hr();BO();hV();qT();VO();GO();wO();D_();gV=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=s9(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=aV({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=lV({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=pV({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),E=jve(h,t,S),C=Mve(m,S);try{return await Promise.race([Promise.all([{},c9(_),Promise.all(x),w,A,lZ(t,d),...E,...C]),g,Fve(t,b),...iZ(t,o,f,b),...$H({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...rZ({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all(x.map(L=>qO(L))),qO(w),mV(A,R),Promise.allSettled(E),Promise.allSettled(C)])}},jve=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:of(n,i,r)),Mve=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Bn(o,{checkOpen:!1})&&!Ln(o)).map(({type:i,value:o,stream:s=o})=>of(s,n,e,{isSameDirection:hn.has(i),stopOnExit:i==="native"}))),Fve=async(t,{signal:e})=>{let[r]=await Nve(t,"error",{signal:e});throw r}});var _V,sf,zc,N_=y(()=>{Pc();_V=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),sf=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=hi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},zc=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as bV}from"node:stream/promises";var WO,vV,KO,JO,j_,M_,YO=y(()=>{D_();WO=async t=>{if(t!==void 0)try{await KO(t)}catch{}},vV=async t=>{if(t!==void 0)try{await JO(t)}catch{}},KO=async t=>{await bV(t,{cleanup:!0,readable:!1,writable:!0})},JO=async t=>{await bV(t,{cleanup:!0,readable:!0,writable:!1})},j_=async(t,e)=>{if(await t,e)throw e},M_=(t,e,r)=>{r&&!C_(r)?t.destroy(r):e&&t.destroy()}});import{Readable as zve}from"node:stream";import{callbackify as Lve}from"node:util";var SV,XO,QO,eI,Uve,tI,rI,wV,nI=y(()=>{Qs();qo();R_();Pc();N_();YO();SV=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||Wr.has(r),{subprocessStdout:a,waitReadableDestroy:c}=XO(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=QO(a,s),{read:f,onStdoutDataDone:p}=eI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new zve({read:f,destroy:Lve(rI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return tI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},XO=(t,e,r)=>{let n=Rc(t,e),i=sf(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},QO=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:UO},eI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=hi(),s=P_({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Uve(this,s,o)},onStdoutDataDone:o}},Uve=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},tI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await JO(t),await n,await WO(i),await e,r.readable&&r.push(null)}catch(o){await WO(i),wV(r,o)}},rI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await zc(r,e)&&(wV(t,n),await j_(e,n))},wV=(t,e)=>{M_(t,t.readable,e)}});import{Writable as qve}from"node:stream";import{callbackify as xV}from"node:util";var $V,iI,oI,Bve,Hve,sI,aI,kV,cI=y(()=>{qo();N_();YO();$V=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=iI(t,r,e),s=new qve({...oI(n,t,i),destroy:xV(aI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return sI(n,s),s},iI=(t,e,r)=>{let n=Ny(t,e),i=sf(r,n,"writableFinal"),o=sf(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},oI=(t,e,r)=>({write:Bve.bind(void 0,t),final:xV(Hve.bind(void 0,t,e,r))}),Bve=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Hve=async(t,e,r)=>{await zc(r,e)&&(t.writable&&t.end(),await e)},sI=async(t,e,r)=>{try{await KO(t),e.writable&&e.end()}catch(n){await vV(r),kV(e,n)}},aI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await zc(r,e),await zc(n,e)&&(kV(t,i),await j_(e,i))},kV=(t,e)=>{M_(t,t.writable,e)}});import{Duplex as Zve}from"node:stream";import{callbackify as Gve}from"node:util";var EV,Vve,AV=y(()=>{Qs();nI();cI();EV=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||Wr.has(r),{subprocessStdout:c,waitReadableDestroy:l}=XO(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=iI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=QO(c,a),{read:g,onStdoutDataDone:b}=eI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new Zve({read:g,...oI(u,t,d),destroy:Gve(Vve.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return tI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),sI(u,_,c),_},Vve=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([rI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),aI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var lI,Wve,TV=y(()=>{Qs();qo();R_();lI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||Wr.has(e),s=Rc(t,r),a=P_({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Wve(a,s,t)},Wve=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var OV,IV=y(()=>{N_();nI();cI();AV();TV();OV=(t,{encoding:e})=>{let r=_V();t.readable=SV.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=$V.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=EV.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=lI.bind(void 0,t,e),t[Symbol.asyncIterator]=lI.bind(void 0,t,e,{})}});var PV,Kve,Jve,RV=y(()=>{PV=(t,e)=>{for(let[r,n]of Jve){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Kve=(async()=>{})().constructor.prototype,Jve=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Kve,t)])});import{setMaxListeners as Yve}from"node:events";import{spawn as Xve}from"node:child_process";var CV,Qve,eSe,tSe,rSe,nSe,DV=y(()=>{a_();yT();ZT();qo();GT();EO();Xd();u_();x9();T9();Qd();F9();Py();B9();tV();VO();yV();IV();Pc();RV();CV=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Qve(t,e,r),{subprocess:f,promise:p}=tSe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=I_.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),PV(f,p),gi.set(f,{options:u,fileDescriptors:d}),f},Qve=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=$y(t,e,r),{file:a,commandArguments:c,options:l}=Yy(t,e,r),u=eSe(l),d=A9(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},eSe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},tSe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Xve(...Xy(t,e,r))}catch(m){return w9({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Yve(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];M9(c,a,l),q9(c,r,l);let d={},f=hi();c.kill=wH.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=cV(c,r),OV(c,r),b9(c,r);let p=rSe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},rSe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await gV({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>ro(x,e,w)),_=ro(h,e,"all"),S=nSe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return jc(S,n,e)},nSe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Yd({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof yi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):l_({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var F_,iSe,oSe,NV=y(()=>{Ji();eo();F_=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,iSe(n,t[n],i)]));return{...t,...r}},iSe=(t,e,r)=>oSe.has(t)&&Et(e)&&Et(r)?{...e,...r}:r,oSe=new Set(["env",...fT])});var Zo,sSe,aSe,jV=y(()=>{Ji();aT();M6();f9();DV();NV();Zo=(t,e,r,n)=>{let i=(s,a,c)=>Zo(s,a,r,c),o=(...s)=>sSe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},sSe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Et(o))return i(t,F_(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=aSe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?d9(a,c,l):CV(a,c,l,i)},aSe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=N6(e)?j6(e,r):[e,...r],[s,a,c]=dy(...o),l=F_(F_(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var MV,FV,zV,cSe,lSe,LV=y(()=>{MV=({file:t,commandArguments:e})=>zV(t,e),FV=({file:t,commandArguments:e})=>({...zV(t,e),isSync:!0}),zV=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=cSe(t);return{file:r,commandArguments:n}},cSe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(lSe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},lSe=/ +/g});var UV,qV,uSe,BV,dSe,HV,ZV=y(()=>{UV=(t,e,r)=>{t.sync=e(uSe,r),t.s=t.sync},qV=({options:t})=>BV(t),uSe=({options:t})=>({...BV(t),isSync:!0}),BV=t=>({options:{...dSe(t),...t}}),dSe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},HV={preferLocal:!0}});var Wet,et,Ket,Jet,Yet,Xet,Qet,ett,ttt,rtt,Ir=y(()=>{jV();LV();UT();ZV();EO();Wet=Zo(()=>({})),et=Zo(()=>({isSync:!0})),Ket=Zo(MV),Jet=Zo(FV),Yet=Zo(sZ),Xet=Zo(qV,{},HV,UV),{sendMessage:Qet,getOneMessage:ett,getEachMessage:ttt,getCancelSignal:rtt}=v9()});import{existsSync as z_,statSync as fSe}from"node:fs";import{dirname as uI,extname as pSe,isAbsolute as GV,join as dI,relative as fI,resolve as L_,sep as mSe}from"node:path";function U_(t){return t==="./gradlew"||t==="gradle"}function hSe(t){return(z_(dI(t,"build.gradle.kts"))||z_(dI(t,"build.gradle")))&&z_(dI(t,"gradle.properties"))}function gSe(t,e){let n=fI(t,e).split(mSe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function Go(t,e){return t===":"?`:${e}`:`${t}:${e}`}function ySe(t,e){let r=L_(t,e),n=r;z_(r)?fSe(r).isFile()&&(n=uI(r)):pSe(r)!==""&&(n=uI(r));let i=fI(t,n);if(i.startsWith("..")||GV(i))return null;let o=n;for(;;){if(hSe(o))return o;if(L_(o)===L_(t))return null;let s=uI(o);if(s===o)return null;let a=fI(t,s);if(a.startsWith("..")||GV(a))return null;o=s}}function q_(t,e){let r=L_(t),n=new Map,i=[];for(let o of e){let s=ySe(r,o);if(!s){i.push(o);continue}let a=gSe(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var B_=y(()=>{"use strict"});import{existsSync as _Se,readFileSync as bSe}from"node:fs";import{join as vSe}from"node:path";function Lc(t="."){let e=vSe(t,".cladding","config.yaml");if(!_Se(e))return pI;try{let n=(0,VV.parse)(bSe(e,"utf8"))?.gate;if(!n)return pI;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of SSe){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return pI}}function WV(t,e){let r=[],n=!1;for(let i of t){let o=wSe.exec(i);if(o){n=!0;for(let s of e)r.push(Go(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var VV,SSe,pI,wSe,H_=y(()=>{"use strict";VV=kt(or(),1);B_();SSe=["type","lint","test","coverage"],pI={scope:"feature"};wSe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as hI,readFileSync as KV,readdirSync as xSe,statSync as $Se}from"node:fs";import{join as Z_}from"node:path";function _I(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Z_(t,e);if(hI(r))try{if(JV.test(KV(r,"utf8")))return!0}catch{}}return!1}function YV(t){try{return hI(t)&&JV.test(KV(t,"utf8"))}catch{return!1}}function XV(t,e=0){if(e>4||!hI(t))return!1;let r;try{r=xSe(t)}catch{return!1}for(let n of r){let i=Z_(t,n),o=!1;try{o=$Se(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(XV(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&YV(i))return!0}return!1}function ASe(t){if(_I(t))return!0;for(let e of kSe)if(YV(Z_(t,e)))return!0;for(let e of ESe)if(XV(Z_(t,e)))return!0;return!1}function QV(t="."){let e=Lc(t).coverage;return e||(ASe(t)?"kover":"jacoco")}function eW(t="."){return gI[QV(t)]}function tW(t="."){return mI[QV(t)]}var gI,mI,yI,JV,kSe,ESe,G_=y(()=>{"use strict";H_();gI={kover:"koverXmlReport",jacoco:"jacocoTestReport"},mI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},yI=[mI.kover,mI.jacoco],JV=/kover/i;kSe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],ESe=["buildSrc","build-logic"]});import{existsSync as bI,readdirSync as rW}from"node:fs";import{join as V_}from"node:path";function vI(t){return bI(V_(t,"gradlew"))?"./gradlew":"gradle"}function TSe(t){let e=vI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[eW(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function ISe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function CSe(t,e){for(let r of e)if(bI(V_(t,r)))return r}function DSe(t,e){try{return rW(t).find(n=>n.endsWith(e))}catch{return}}function jSe(t,e){for(let r of NSe)if(r.configs.some(n=>bI(V_(t,n))))return r.gate;return e}function pt(t="."){for(let e of PSe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=DSe(t,o):r=CSe(t,[o]),r)break;if(!r||e.requiresSource&&!ISe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"&&n.lint?{...n,lint:jSe(t,n.lint)}:n;return{language:e.language,manifest:r,gates:i}}return RSe}var OSe,PSe,RSe,NSe,gn=y(()=>{"use strict";G_();OSe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);PSe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","madge","--circular","--extensions","ts","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:TSe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}],RSe={language:"unknown",manifest:"",gates:{}};NSe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}]});import{existsSync as MSe,readFileSync as FSe}from"node:fs";import{join as zSe}from"node:path";function af(t){return t.code==="ENOENT"}function W_(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return nW.test(o)||nW.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function zt(t,e,r){return af(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function sr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Uc(t,e){let r=zSe(t,"package.json");if(!MSe(r))return!1;try{return!!JSON.parse(FSe(r,"utf8")).scripts?.[e]}catch{return!1}}var nW,yn=y(()=>{"use strict";nW=/config (is |file )?not found|no such file|ENOENT|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function LSe(t){let{cwd:e="."}=t,r=pt(e),n=r.gates.arch;if(!n)return[{detector:K_,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=et(n.cmd,[...n.args],{cwd:e,reject:!1});return af(i)?[{detector:K_,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:W_(i,K_,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var K_,J_,SI=y(()=>{"use strict";Ir();gn();yn();K_="ARCHITECTURE_VIOLATION";J_={name:K_,run:LSe}});import iW from"node:process";function aa(t={}){let r=J_.run(t).filter(o=>o.severity==="error"),n=r.length===0,i={stage:USe,pass:n,exitCode:n?0:1};return n?i:{...i,stderr:r.map(o=>o.message).join(` +`)}}var USe,qSe,Y_=y(()=>{"use strict";SI();USe="stage_1.5";qSe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${iW.argv[1]}`;if(qSe){let t=aa();console.log(JSON.stringify(t)),iW.exit(t.exitCode)}});import{existsSync as wI,readdirSync as oW}from"node:fs";import{join as X_}from"node:path";function HSe(t,e){let r=X_(t,e.path);if(!wI(r))return!0;if(e.isDirectory)try{return oW(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function ZSe(t){let{cwd:e="."}=t,r=[];for(let i of BSe)HSe(e,i)&&r.push({detector:cf,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=X_(e,"spec.yaml");if(wI(n)){let i=WSe(n),o=i?null:GSe(e);if(i)r.push({detector:cf,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:cf,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=VSe(e);s&&r.push({detector:cf,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function GSe(t){for(let e of["spec/features","spec/scenarios"]){let r=X_(t,e);if(!wI(r))continue;let n;try{n=oW(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{di(X_(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function VSe(t){try{return J(t),null}catch(e){return e.message}}function WSe(t){let e;try{e=di(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var cf,BSe,sW,aW=y(()=>{"use strict";at();sy();cf="ABSENCE_OF_GOVERNANCE",BSe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];sW={name:cf,run:ZSe}});function Q_(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function xI(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Q_(r)==="while",o=JSe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Q_(r)}'`}let n=KSe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Q_(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Q_(r)}'`:null}function YSe(t,e){let r=xI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function cW(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...YSe(r,n));return e}var KSe,JSe,$I=y(()=>{"use strict";KSe={event:"when",state:"while",optional:"where",unwanted:"if"},JSe=/\bwhen\b/i});function pe(t,e,r){let n;try{n=J(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var _t=y(()=>{"use strict";at()});function XSe(t){let{cwd:e="."}=t;return pe(e,eb,QSe)}function QSe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:eb,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of cW(t.features))e.push({detector:eb,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var eb,lW,uW=y(()=>{"use strict";$I();_t();eb="AC_DRIFT";lW={name:eb,run:XSe}});function bi(t=".",e){let n=(e??"").trim().toLowerCase()||pt(t).language;return nwe[n]??dW}var ewe,twe,dW,rwe,nwe,qc=y(()=>{"use strict";gn();ewe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,twe=/^[ \t]*import\s+([\w.]+)/gm,dW={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:ewe,importStyle:"relative"},rwe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:twe,importStyle:"dotted"},nwe={typescript:dW,kotlin:rwe}});import{existsSync as iwe,readFileSync as owe,readdirSync as swe,statSync as awe}from"node:fs";import{join as pW,relative as fW}from"node:path";function cwe(t,e){if(!iwe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=swe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=pW(i,s),c;try{c=awe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function lwe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function dwe(t){return uwe.test(t)}function fwe(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=bi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>cwe(pW(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=owe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";at();qc();mW="AI_HINTS_FORBIDDEN_PATTERN";uwe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;hW={name:mW,run:fwe}});function pwe(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:yW,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var yW,_W,bW=y(()=>{"use strict";at();yW="AC_DUPLICATE_WITHIN_FEATURE";_W={name:yW,run:pwe}});import{createRequire as mwe}from"module";import{basename as hwe,dirname as EI,normalize as gwe,relative as ywe,resolve as _we,sep as wW}from"path";import*as bwe from"fs";function vwe(t){let e=gwe(t);return e.length>1&&e[e.length-1]===wW&&(e=e.substring(0,e.length-1)),e}function xW(t,e){return t.replace(Swe,e)}function xwe(t){return t==="/"||wwe.test(t)}function kI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=_we(t)),(n||o)&&(t=vwe(t)),t===".")return"";let s=t[t.length-1]!==i;return xW(s?t+i:t,i)}function $W(t,e){return e+t}function $we(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:xW(ywe(t,n),e.pathSeparator)+e.pathSeparator+r}}function kwe(t){return t}function Ewe(t,e,r){return e+t+r}function Awe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?$we(t,e):n?$W:kwe}function Twe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function Owe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function Cwe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?Owe(t):Twe(t):n&&n.length?Pwe:Iwe:Rwe}function zwe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?Fwe:r&&r.length?n?Dwe:Nwe:n?jwe:Mwe}function qwe(t){return t.group?Uwe:Lwe}function Zwe(t){return t.group?Bwe:Hwe}function Wwe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Vwe:Gwe}function kW(t,e,r){if(r.options.useRealPaths)return Kwe(e,r);let n=EI(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=EI(n)}return r.symlinks.set(t,e),i>1}function Kwe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function tb(t,e,r,n){e(t&&!n?t:null,r)}function ixe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?Jwe:exe:n?e?Ywe:nxe:i?e?Qwe:rxe:e?Xwe:txe}function axe(t){return t?sxe:oxe}function dxe(t,e){return new Promise((r,n)=>{TW(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function TW(t,e,r){new AW(t,e,r).start()}function fxe(t,e){return new AW(t,e).start()}var vW,Swe,wwe,Iwe,Pwe,Rwe,Dwe,Nwe,jwe,Mwe,Fwe,Lwe,Uwe,Bwe,Hwe,Gwe,Vwe,Jwe,Ywe,Xwe,Qwe,exe,txe,rxe,nxe,EW,oxe,sxe,cxe,lxe,uxe,AW,SW,OW,IW,PW=y(()=>{vW=mwe(import.meta.url);Swe=/[\\/]/g;wwe=/^[a-z]:[\\/]$/i;Iwe=(t,e)=>{e.push(t||".")},Pwe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},Rwe=()=>{};Dwe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},Nwe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},jwe=(t,e,r,n)=>{r.files++},Mwe=(t,e)=>{e.push(t)},Fwe=()=>{};Lwe=t=>t,Uwe=()=>[""].slice(0,0);Bwe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},Hwe=()=>{};Gwe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&kW(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},Vwe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&kW(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};Jwe=t=>t.counts,Ywe=t=>t.groups,Xwe=t=>t.paths,Qwe=t=>t.paths.slice(0,t.options.maxFiles),exe=(t,e,r)=>(tb(e,r,t.counts,t.options.suppressErrors),null),txe=(t,e,r)=>(tb(e,r,t.paths,t.options.suppressErrors),null),rxe=(t,e,r)=>(tb(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),nxe=(t,e,r)=>(tb(e,r,t.groups,t.options.suppressErrors),null);EW={withFileTypes:!0},oxe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",EW,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},sxe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",EW)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};cxe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},lxe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},uxe=class{aborted=!1;abort(){this.aborted=!0}},AW=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=ixe(e,this.isSynchronous),this.root=kI(t,e),this.state={root:xwe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new lxe,options:e,queue:new cxe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new uxe,fs:e.fs||bwe},this.joinPath=Awe(this.root,e),this.pushDirectory=Cwe(this.root,e),this.pushFile=zwe(e),this.getArray=qwe(e),this.groupFiles=Zwe(e),this.resolveSymlink=Wwe(e,this.isSynchronous),this.walkDirectory=axe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=kI(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=hwe(_),x=kI(EI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};SW=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return dxe(this.root,this.options)}withCallback(t){TW(this.root,this.options,t)}sync(){return fxe(this.root,this.options)}},OW=null;try{vW.resolve("picomatch"),OW=vW("picomatch")}catch{}IW=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:wW,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new SW(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new SW(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||OW;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var lf=v((irt,jW)=>{"use strict";var RW="[^\\\\/]",pxe="(?=.)",CW="[^/]",AI="(?:\\/|$)",DW="(?:^|\\/)",TI=`\\.{1,2}${AI}`,mxe="(?!\\.)",hxe=`(?!${DW}${TI})`,gxe=`(?!\\.{0,1}${AI})`,yxe=`(?!${TI})`,_xe="[^.\\/]",bxe=`${CW}*?`,vxe="/",NW={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:pxe,QMARK:CW,END_ANCHOR:AI,DOTS_SLASH:TI,NO_DOT:mxe,NO_DOTS:hxe,NO_DOT_SLASH:gxe,NO_DOTS_SLASH:yxe,QMARK_NO_DOT:_xe,STAR:bxe,START_ANCHOR:DW,SEP:vxe},Sxe={...NW,SLASH_LITERAL:"[\\\\/]",QMARK:RW,STAR:`${RW}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},wxe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};jW.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:wxe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Sxe:NW}}});var uf=v(Pr=>{"use strict";var{REGEX_BACKSLASH:xxe,REGEX_REMOVE_BACKSLASH:$xe,REGEX_SPECIAL_CHARS:kxe,REGEX_SPECIAL_CHARS_GLOBAL:Exe}=lf();Pr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Pr.hasRegexChars=t=>kxe.test(t);Pr.isRegexChar=t=>t.length===1&&Pr.hasRegexChars(t);Pr.escapeRegex=t=>t.replace(Exe,"\\$1");Pr.toPosixSlashes=t=>t.replace(xxe,"/");Pr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Pr.removeBackslashes=t=>t.replace($xe,e=>e==="\\"?"":e);Pr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Pr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Pr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Pr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Pr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var HW=v((srt,BW)=>{"use strict";var MW=uf(),{CHAR_ASTERISK:OI,CHAR_AT:Axe,CHAR_BACKWARD_SLASH:df,CHAR_COMMA:Txe,CHAR_DOT:II,CHAR_EXCLAMATION_MARK:PI,CHAR_FORWARD_SLASH:qW,CHAR_LEFT_CURLY_BRACE:RI,CHAR_LEFT_PARENTHESES:CI,CHAR_LEFT_SQUARE_BRACKET:Oxe,CHAR_PLUS:Ixe,CHAR_QUESTION_MARK:FW,CHAR_RIGHT_CURLY_BRACE:Pxe,CHAR_RIGHT_PARENTHESES:zW,CHAR_RIGHT_SQUARE_BRACKET:Rxe}=lf(),LW=t=>t===qW||t===df,UW=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Cxe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,R=0,A,E,C={value:"",depth:0,isGlob:!1},k=()=>l>=n,L=()=>c.charCodeAt(l+1),te=()=>(A=E,c.charCodeAt(++l));for(;l0&&(O=c.slice(0,u),c=c.slice(u),d-=u),be&&m===!0&&d>0?(be=c.slice(0,d),P=c.slice(d)):m===!0?(be="",P=c):be=c,be&&be!==""&&be!=="/"&&be!==c&&LW(be.charCodeAt(be.length-1))&&(be=be.slice(0,-1)),r.unescape===!0&&(P&&(P=MW.removeBackslashes(P)),be&&_===!0&&(be=MW.removeBackslashes(be)));let $t={prefix:O,input:t,start:u,base:be,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&($t.maxDepth=0,LW(E)||s.push(C),$t.tokens=s),r.parts===!0||r.tokens===!0){let je;for(let Me=0;Me{"use strict";var ff=lf(),Kr=uf(),{MAX_LENGTH:rb,POSIX_REGEX_SOURCE:Dxe,REGEX_NON_SPECIAL_CHARS:Nxe,REGEX_SPECIAL_CHARS_BACKREF:jxe,REPLACEMENTS:ZW}=ff,Mxe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Kr.escapeRegex(i)).join("..")}return r},Bc=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,GW=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},Fxe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},VW=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(Fxe(e))return e.replace(/\\(.)/g,"$1")},zxe=t=>{let e=t.map(VW).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},Lxe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=VW(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Kr.escapeRegex(r[0]):`[${r.map(i=>Kr.escapeRegex(i)).join("")}]`}*`},Uxe=t=>{let e=0,r=t.trim(),n=DI(r);for(;n;)e++,r=n.body.trim(),n=DI(r);return e},qxe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:ff.DEFAULT_MAX_EXTGLOB_RECURSION,n=GW(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||zxe(n)))return{risky:!0};for(let i of n){let o=Lxe(i);if(o)return{risky:!0,safeOutput:o};if(Uxe(i)>r)return{risky:!0}}return{risky:!1}},NI=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=ZW[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(rb,r.maxLength):rb,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=ff.globChars(r.windows),l=ff.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,R=q=>`(${a}(?:(?!${w}${q.dot?m:u}).)*?)`,A=r.dot?"":h,E=r.dot?_:S,C=r.bash===!0?R(r):x;r.capture&&(C=`(${C})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=Kr.removePrefix(t,k),i=t.length;let L=[],te=[],be=[],O=o,P,$t=()=>k.index===i-1,je=k.peek=(q=1)=>t[k.index+q],Me=k.advance=()=>t[++k.index]||"",Kt=()=>t.slice(k.index+1),Gt=(q="",ut=0)=>{k.consumed+=q,k.index+=ut},Br=q=>{k.output+=q.output!=null?q.output:q.value,Gt(q.value)},jn=()=>{let q=1;for(;je()==="!"&&(je(2)!=="("||je(3)==="?");)Me(),k.start++,q++;return q%2===0?!1:(k.negated=!0,k.start++,!0)},Bi=q=>{k[q]++,be.push(q)},ko=q=>{k[q]--,be.pop()},Ee=q=>{if(O.type==="globstar"){let ut=k.braces>0&&(q.type==="comma"||q.type==="brace"),U=q.extglob===!0||L.length&&(q.type==="pipe"||q.type==="paren");q.type!=="slash"&&q.type!=="paren"&&!ut&&!U&&(k.output=k.output.slice(0,-O.output.length),O.type="star",O.value="*",O.output=C,k.output+=O.output)}if(L.length&&q.type!=="paren"&&(L[L.length-1].inner+=q.value),(q.value||q.output)&&Br(q),O&&O.type==="text"&&q.type==="text"){O.output=(O.output||O.value)+q.value,O.value+=q.value;return}q.prev=O,s.push(q),O=q},Kh=(q,ut)=>{let U={...l[ut],conditions:1,inner:""};U.prev=O,U.parens=k.parens,U.output=k.output,U.startIndex=k.index,U.tokensIndex=s.length;let Ae=(r.capture?"(":"")+U.open;Bi("parens"),Ee({type:q,value:ut,output:k.output?"":p}),Ee({type:"paren",extglob:!0,value:Me(),output:Ae}),L.push(U)},Rae=q=>{let ut=t.slice(q.startIndex,k.index+1),U=t.slice(q.startIndex+2,k.index),Ae=qxe(U,r);if((q.type==="plus"||q.type==="star")&&Ae.risky){let ot=Ae.safeOutput?(q.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,ai=s[q.tokensIndex];ai.type="text",ai.value=ut,ai.output=ot||Kr.escapeRegex(ut);for(let ci=q.tokensIndex+1;ci1&&q.inner.includes("/")&&(ot=R(r)),(ot!==C||$t()||/^\)+$/.test(Kt()))&&(st=q.close=`)$))${ot}`),q.inner.includes("*")&&(jt=Kt())&&/^\.[^\\/.]+$/.test(jt)){let ai=NI(jt,{...e,fastpaths:!1}).output;st=q.close=`)${ai})${ot})`}q.prev.type==="bos"&&(k.negatedExtglob=!0)}Ee({type:"paren",extglob:!0,value:P,output:st}),ko("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let q=!1,ut=t.replace(jxe,(U,Ae,st,jt,ot,ai)=>jt==="\\"?(q=!0,U):jt==="?"?Ae?Ae+jt+(ot?_.repeat(ot.length):""):ai===0?E+(ot?_.repeat(ot.length):""):_.repeat(st.length):jt==="."?u.repeat(st.length):jt==="*"?Ae?Ae+jt+(ot?C:""):C:Ae?U:`\\${U}`);return q===!0&&(r.unescape===!0?ut=ut.replace(/\\/g,""):ut=ut.replace(/\\+/g,U=>U.length%2===0?"\\\\":U?"\\":"")),ut===t&&r.contains===!0?(k.output=t,k):(k.output=Kr.wrapOutput(ut,k,e),k)}for(;!$t();){if(P=Me(),P==="\0")continue;if(P==="\\"){let U=je();if(U==="/"&&r.bash!==!0||U==="."||U===";")continue;if(!U){P+="\\",Ee({type:"text",value:P});continue}let Ae=/^\\+/.exec(Kt()),st=0;if(Ae&&Ae[0].length>2&&(st=Ae[0].length,k.index+=st,st%2!==0&&(P+="\\")),r.unescape===!0?P=Me():P+=Me(),k.brackets===0){Ee({type:"text",value:P});continue}}if(k.brackets>0&&(P!=="]"||O.value==="["||O.value==="[^")){if(r.posix!==!1&&P===":"){let U=O.value.slice(1);if(U.includes("[")&&(O.posix=!0,U.includes(":"))){let Ae=O.value.lastIndexOf("["),st=O.value.slice(0,Ae),jt=O.value.slice(Ae+2),ot=Dxe[jt];if(ot){O.value=st+ot,k.backtrack=!0,Me(),!o.output&&s.indexOf(O)===1&&(o.output=p);continue}}}(P==="["&&je()!==":"||P==="-"&&je()==="]")&&(P=`\\${P}`),P==="]"&&(O.value==="["||O.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&O.value==="["&&(P="^"),O.value+=P,Br({value:P});continue}if(k.quotes===1&&P!=='"'){P=Kr.escapeRegex(P),O.value+=P,Br({value:P});continue}if(P==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&Ee({type:"text",value:P});continue}if(P==="("){Bi("parens"),Ee({type:"paren",value:P});continue}if(P===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Bc("opening","("));let U=L[L.length-1];if(U&&k.parens===U.parens+1){Rae(L.pop());continue}Ee({type:"paren",value:P,output:k.parens?")":"\\)"}),ko("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Bc("closing","]"));P=`\\${P}`}else Bi("brackets");Ee({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||O&&O.type==="bracket"&&O.value.length===1){Ee({type:"text",value:P,output:`\\${P}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Bc("opening","["));Ee({type:"text",value:P,output:`\\${P}`});continue}ko("brackets");let U=O.value.slice(1);if(O.posix!==!0&&U[0]==="^"&&!U.includes("/")&&(P=`/${P}`),O.value+=P,Br({value:P}),r.literalBrackets===!1||Kr.hasRegexChars(U))continue;let Ae=Kr.escapeRegex(O.value);if(k.output=k.output.slice(0,-O.value.length),r.literalBrackets===!0){k.output+=Ae,O.value=Ae;continue}O.value=`(${a}${Ae}|${O.value})`,k.output+=O.value;continue}if(P==="{"&&r.nobrace!==!0){Bi("braces");let U={type:"brace",value:P,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};te.push(U),Ee(U);continue}if(P==="}"){let U=te[te.length-1];if(r.nobrace===!0||!U){Ee({type:"text",value:P,output:P});continue}let Ae=")";if(U.dots===!0){let st=s.slice(),jt=[];for(let ot=st.length-1;ot>=0&&(s.pop(),st[ot].type!=="brace");ot--)st[ot].type!=="dots"&&jt.unshift(st[ot].value);Ae=Mxe(jt,r),k.backtrack=!0}if(U.comma!==!0&&U.dots!==!0){let st=k.output.slice(0,U.outputIndex),jt=k.tokens.slice(U.tokensIndex);U.value=U.output="\\{",P=Ae="\\}",k.output=st;for(let ot of jt)k.output+=ot.output||ot.value}Ee({type:"brace",value:P,output:Ae}),ko("braces"),te.pop();continue}if(P==="|"){L.length>0&&L[L.length-1].conditions++,Ee({type:"text",value:P});continue}if(P===","){let U=P,Ae=te[te.length-1];Ae&&be[be.length-1]==="braces"&&(Ae.comma=!0,U="|"),Ee({type:"comma",value:P,output:U});continue}if(P==="/"){if(O.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),O=o;continue}Ee({type:"slash",value:P,output:f});continue}if(P==="."){if(k.braces>0&&O.type==="dot"){O.value==="."&&(O.output=u);let U=te[te.length-1];O.type="dots",O.output+=P,O.value+=P,U.dots=!0;continue}if(k.braces+k.parens===0&&O.type!=="bos"&&O.type!=="slash"){Ee({type:"text",value:P,output:u});continue}Ee({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(O&&O.value==="(")&&r.noextglob!==!0&&je()==="("&&je(2)!=="?"){Kh("qmark",P);continue}if(O&&O.type==="paren"){let Ae=je(),st=P;(O.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(st=`\\${P}`),Ee({type:"text",value:P,output:st});continue}if(r.dot!==!0&&(O.type==="slash"||O.type==="bos")){Ee({type:"qmark",value:P,output:S});continue}Ee({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&je()==="("&&(je(2)!=="?"||!/[!=<:]/.test(je(3)))){Kh("negate",P);continue}if(r.nonegate!==!0&&k.index===0){jn();continue}}if(P==="+"){if(r.noextglob!==!0&&je()==="("&&je(2)!=="?"){Kh("plus",P);continue}if(O&&O.value==="("||r.regex===!1){Ee({type:"plus",value:P,output:d});continue}if(O&&(O.type==="bracket"||O.type==="paren"||O.type==="brace")||k.parens>0){Ee({type:"plus",value:P});continue}Ee({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&je()==="("&&je(2)!=="?"){Ee({type:"at",extglob:!0,value:P,output:""});continue}Ee({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let U=Nxe.exec(Kt());U&&(P+=U[0],k.index+=U[0].length),Ee({type:"text",value:P});continue}if(O&&(O.type==="globstar"||O.star===!0)){O.type="star",O.star=!0,O.value+=P,O.output=C,k.backtrack=!0,k.globstar=!0,Gt(P);continue}let q=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(q)){Kh("star",P);continue}if(O.type==="star"){if(r.noglobstar===!0){Gt(P);continue}let U=O.prev,Ae=U.prev,st=U.type==="slash"||U.type==="bos",jt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!st||q[0]&&q[0]!=="/")){Ee({type:"star",value:P,output:""});continue}let ot=k.braces>0&&(U.type==="comma"||U.type==="brace"),ai=L.length&&(U.type==="pipe"||U.type==="paren");if(!st&&U.type!=="paren"&&!ot&&!ai){Ee({type:"star",value:P,output:""});continue}for(;q.slice(0,3)==="/**";){let ci=t[k.index+4];if(ci&&ci!=="/")break;q=q.slice(3),Gt("/**",3)}if(U.type==="bos"&&$t()){O.type="globstar",O.value+=P,O.output=R(r),k.output=O.output,k.globstar=!0,Gt(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&!jt&&$t()){k.output=k.output.slice(0,-(U.output+O.output).length),U.output=`(?:${U.output}`,O.type="globstar",O.output=R(r)+(r.strictSlashes?")":"|$)"),O.value+=P,k.globstar=!0,k.output+=U.output+O.output,Gt(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&q[0]==="/"){let ci=q[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(U.output+O.output).length),U.output=`(?:${U.output}`,O.type="globstar",O.output=`${R(r)}${f}|${f}${ci})`,O.value+=P,k.output+=U.output+O.output,k.globstar=!0,Gt(P+Me()),Ee({type:"slash",value:"/",output:""});continue}if(U.type==="bos"&&q[0]==="/"){O.type="globstar",O.value+=P,O.output=`(?:^|${f}|${R(r)}${f})`,k.output=O.output,k.globstar=!0,Gt(P+Me()),Ee({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-O.output.length),O.type="globstar",O.output=R(r),O.value+=P,k.output+=O.output,k.globstar=!0,Gt(P);continue}let ut={type:"star",value:P,output:C};if(r.bash===!0){ut.output=".*?",(O.type==="bos"||O.type==="slash")&&(ut.output=A+ut.output),Ee(ut);continue}if(O&&(O.type==="bracket"||O.type==="paren")&&r.regex===!0){ut.output=P,Ee(ut);continue}(k.index===k.start||O.type==="slash"||O.type==="dot")&&(O.type==="dot"?(k.output+=g,O.output+=g):r.dot===!0?(k.output+=b,O.output+=b):(k.output+=A,O.output+=A),je()!=="*"&&(k.output+=p,O.output+=p)),Ee(ut)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Bc("closing","]"));k.output=Kr.escapeLast(k.output,"["),ko("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Bc("closing",")"));k.output=Kr.escapeLast(k.output,"("),ko("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Bc("closing","}"));k.output=Kr.escapeLast(k.output,"{"),ko("braces")}if(r.strictSlashes!==!0&&(O.type==="star"||O.type==="bracket")&&Ee({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let q of k.tokens)k.output+=q.output!=null?q.output:q.value,q.suffix&&(k.output+=q.suffix)}return k};NI.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(rb,r.maxLength):rb,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=ZW[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=ff.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=A=>A.noglobstar===!0?_:`(${g}(?:(?!${p}${A.dot?c:o}).)*?)`,x=A=>{switch(A){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let E=/^(.*?)\.(\w+)$/.exec(A);if(!E)return;let C=x(E[1]);return C?C+o+E[2]:void 0}}},w=Kr.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};WW.exports=NI});var XW=v((crt,YW)=>{"use strict";var Bxe=HW(),jI=KW(),JW=uf(),Hxe=lf(),Zxe=t=>t&&typeof t=="object"&&!Array.isArray(t),At=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>At(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=Zxe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?At.compileRe(t,e):At.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=At(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=At.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};At.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?JW.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=At.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};At.matchBase=(t,e,r)=>(e instanceof RegExp?e:At.makeRe(e,r)).test(JW.basename(t));At.isMatch=(t,e,r)=>At(e,r)(t);At.parse=(t,e)=>Array.isArray(t)?t.map(r=>At.parse(r,e)):jI(t,{...e,fastpaths:!1});At.scan=(t,e)=>Bxe(t,e);At.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=At.toRegex(a,e);return n===!0&&(c.state=t),c};At.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=jI.fastpaths(t,e)),i.output||(i=jI(t,e)),At.compileRe(i,e,r,n)};At.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};At.constants=Hxe;YW.exports=At});var rK=v((lrt,tK)=>{"use strict";var QW=XW(),Gxe=uf();function eK(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Gxe.isWindows()}),QW(t,e,r)}Object.assign(eK,QW);tK.exports=eK});import{readdir as Vxe,readdirSync as Wxe,realpath as Kxe,realpathSync as Jxe,stat as Yxe,statSync as Xxe}from"fs";import{isAbsolute as Qxe,posix as ca,resolve as e0e}from"path";import{fileURLToPath as t0e}from"url";function i0e(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&n0e.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>ca.relative(t,n)||".":n=>ca.relative(t,`${e}/${n}`)||"."}function a0e(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=ca.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function sK(t){var e;let r=Hc.default.scan(t,c0e);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function m0e(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Hc.default.scan(t);return r.isGlob||r.negated}function pf(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function aK(t){return typeof t=="string"?[t]:t??[]}function MI(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=p0e(o);s=Qxe(s.replace(g0e,""))?ca.relative(a,s):ca.normalize(s);let c=(i=h0e.exec(s))===null||i===void 0?void 0:i[0],l=sK(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?ca.join(o,...d):o}return s}function y0e(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(MI(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(MI(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(MI(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function _0e(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=y0e(t,e,n);t.debug&&pf("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(iK,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Hc.default)(i.match,f),m=(0,Hc.default)(i.ignore,f),h=i0e(i.match,f),g=nK(r,d,o),b=o?g:nK(r,d,!0),_=(w,R)=>{let A=b(R,!0);return A!=="."&&!h(A)||m(A)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new IW({filters:[a?(w,R)=>{let A=g(w,R),E=p(A)&&!m(A);return E&&pf(`matched ${A}`),E}:(w,R)=>{let A=g(w,R);return p(A)&&!m(A)}],exclude:a?(w,R)=>{let A=_(w,R);return pf(`${A?"skipped":"crawling"} ${R}`),A}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&pf("internal properties:",{...n,root:d}),[x,r!==d&&!o&&a0e(r,d)]}function b0e(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function S0e(t){let e={...v0e,...t};return e.cwd=(e.cwd instanceof URL?t0e(e.cwd):e0e(e.cwd)).replace(iK,"/"),e.ignore=aK(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||Vxe,readdirSync:e.fs.readdirSync||Wxe,realpath:e.fs.realpath||Kxe,realpathSync:e.fs.realpathSync||Jxe,stat:e.fs.stat||Yxe,statSync:e.fs.statSync||Xxe}),e.debug&&pf("globbing with options:",e),e}function w0e(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=r0e(t)||typeof t=="string",i=aK((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=S0e(n?e:t);return i.length>0?_0e(o,i):[]}function Vo(t,e){let[r,n]=w0e(t,e);return r?b0e(r.sync(),n):[]}var Hc,r0e,iK,oK,n0e,o0e,s0e,c0e,l0e,u0e,d0e,f0e,p0e,h0e,g0e,v0e,mf=y(()=>{PW();Hc=kt(rK(),1),r0e=Array.isArray,iK=/\\/g,oK=process.platform==="win32",n0e=/^(\/?\.\.)+$/;o0e=/^[A-Z]:\/$/i,s0e=oK?t=>o0e.test(t):t=>t==="/";c0e={parts:!0};l0e=/(?t.replace(l0e,"\\$&"),f0e=t=>t.replace(u0e,"\\$&"),p0e=oK?f0e:d0e;h0e=/^(\/?\.\.)+/,g0e=/\\(?=[()[\]{}!*+?@|])/g;v0e={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as nb,readFileSync as x0e,readdirSync as $0e,statSync as cK}from"node:fs";import{join as Zc}from"node:path";function k0e(t){let{cwd:e="."}=t,r,n;try{let c=J(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=bi(e,n),o=[],{layers:s,forbiddenImports:a}=FI(r);return s.size>0&&(E0e(e,i,s,o),A0e(e,i,s,o)),a.length>0&&T0e(e,i,a,o),o}function FI(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function E0e(t,e,r,n){let i=e.mainRoot,o=Zc(t,i);if(nb(o))for(let s of $0e(o)){let a=Zc(o,s);cK(a).isDirectory()&&(r.has(s)||n.push({detector:ib,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function A0e(t,e,r,n){let i=e.mainRoot,o=Zc(t,i);if(nb(o))for(let s of r){let a=Zc(o,s);nb(a)&&cK(a).isDirectory()||n.push({detector:ib,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function T0e(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Zc(t,i,s.from);if(!nb(a))continue;let c=Vo([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Zc(a,l),d;try{d=x0e(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];O0e(p,s.to,e.importStyle)&&n.push({detector:ib,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function O0e(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var ib,lK,zI=y(()=>{"use strict";mf();at();qc();ib="ARCHITECTURE_FROM_SPEC";lK={name:ib,run:k0e}});import{existsSync as I0e,readFileSync as P0e}from"node:fs";import{join as R0e}from"node:path";function C0e(t){let{cwd:e="."}=t,r=R0e(e,"spec/capabilities.yaml");if(!I0e(r))return[];let n;try{let c=P0e(r,"utf8"),l=uK.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=J(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:ob,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:ob,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:ob,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var uK,ob,dK,fK=y(()=>{"use strict";uK=kt(or(),1);at();ob="CAPABILITIES_FEATURE_MAPPING";dK={name:ob,run:C0e}});import{existsSync as D0e,readFileSync as N0e}from"node:fs";import{join as j0e}from"node:path";function M0e(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function F0e(t){let{cwd:e="."}=t;return pe(e,LI,r=>z0e(r,e))}function z0e(t,e){let r=bi(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=j0e(e,o);if(!D0e(s))continue;let a=N0e(s,"utf8");M0e(a)||n.push({detector:LI,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var LI,pK,mK=y(()=>{"use strict";qc();_t();LI="CONVENTION_DRIFT";pK={name:LI,run:F0e}});import{existsSync as UI,readFileSync as hK}from"node:fs";import{join as sb}from"node:path";function L0e(t){return JSON.parse(t).total?.lines?.pct??0}function gK(t){let e=/UI(sb(c.dir,d)));if(!l){s.push(c.path);continue}let u=gK(hK(sb(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:no,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=yK(n,i);return a0?[{detector:no,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function B0e(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let s=q0e(e,t.focusModules);if(s)return s}let r=bi(e),n=pt(e).language==="kotlin"?yI.find(s=>UI(sb(e,s)))??tW(e):r.coverageSummary,i=sb(e,n);if(!UI(i))return[{detector:no,severity:"info",message:`${n} not present \u2014 run stage_2.2 first`}];let o;try{let s=hK(i,"utf8");o=r.coverageFormat==="jacoco-xml"?U0e(s):L0e(s)}catch(s){return[{detector:no,severity:"warn",message:`${n} unparseable: ${s.message}`}]}return o===null?[{detector:no,severity:"warn",message:`${n} contained no line-coverage counter`}]:o>=ab?[]:[{detector:no,severity:"warn",message:`line coverage ${o.toFixed(1)}% < floor ${ab}%`}]}var no,ab,_K,bK=y(()=>{"use strict";G_();qc();B_();gn();no="COVERAGE_DROP",ab=70;_K={name:no,run:B0e}});import{existsSync as H0e}from"node:fs";import{join as Z0e}from"node:path";function G0e(t){let{cwd:e="."}=t;return pe(e,cb,r=>V0e(r,e))}function V0e(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?H0e(Z0e(e,r.path))?[]:[{detector:cb,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:cb,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var cb,vK,SK=y(()=>{"use strict";_t();cb="DELIVERABLE_INTEGRITY";vK={name:cb,run:G0e}});function W0e(t){let e=(t.features??[]).filter(i=>i.status==="done");return e.length===0?[]:!t.project?.deliverable?[]:(t.project?.smoke??[]).length>0?[]:[{detector:qI,severity:"warn",path:"spec.yaml",message:`${e.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function K0e(t){let{cwd:e="."}=t;return pe(e,qI,r=>W0e(r))}var qI,wK,xK=y(()=>{"use strict";_t();qI="SMOKE_PROBE_DEMAND";wK={name:qI,run:K0e}});function J0e(t){let{cwd:e="."}=t;return pe(e,lb,r=>Y0e(r,e))}function Y0e(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=vc(e);if(n===null)return[{detector:lb,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=n.get(o.id),a=jd(e,o.modules??[]);s!==a&&i.push({detector:lb,severity:"warn",path:"spec/attestation.yaml",message:s===void 0?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var lb,ub,BI=y(()=>{"use strict";Md();_t();lb="STALE_ATTESTATION";ub={name:lb,run:J0e}});function X0e(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}return Q0e(r)}function Q0e(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:$K,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var $K,db,HI=y(()=>{"use strict";at();$K="DEPENDENCY_CYCLE";db={name:$K,run:X0e}});import{appendFileSync as e$e,existsSync as kK,mkdirSync as t$e,readFileSync as r$e}from"node:fs";import{dirname as n$e,join as i$e}from"node:path";function EK(t){return i$e(t,o$e,s$e)}function AK(t){return ZI.add(t),()=>ZI.delete(t)}function la(t,e){let r=EK(t),n=n$e(r);kK(n)||t$e(n,{recursive:!0}),e$e(r,`${JSON.stringify(e)} +`,"utf8");for(let i of ZI)try{i(t,e)}catch{}}function _n(t){let e=EK(t);if(!kK(e))return[];let r=r$e(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var o$e,s$e,ZI,Hn=y(()=>{"use strict";o$e=".cladding",s$e="audit.log.jsonl";ZI=new Set});import{existsSync as a$e}from"node:fs";import{join as c$e}from"node:path";function l$e(t){let{cwd:e="."}=t,r=_n(e);if(r.length===0)return[{detector:GI,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(a$e(c$e(e,i.artifact))||n.push({detector:GI,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var GI,TK,OK=y(()=>{"use strict";Hn();GI="EVIDENCE_MISMATCH";TK={name:GI,run:l$e}});import{existsSync as u$e,readFileSync as d$e}from"node:fs";import{join as f$e}from"node:path";function p$e(t){let e=f$e(t,CK);if(!u$e(e))return null;try{let n=((0,RK.parse)(d$e(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*PK(t,e){for(let r of t??[])r.startsWith(IK)&&(yield{ref:r,name:r.slice(IK.length),field:e})}function m$e(t){let{cwd:e="."}=t,r=p$e(e);if(r===null)return[];let n;try{n=J(e)}catch(o){return[{detector:VI,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...PK(s.evidence_refs,"evidence_refs"),...PK(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:VI,severity:"warn",path:CK,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var RK,VI,IK,CK,DK,NK=y(()=>{"use strict";RK=kt(or(),1);at();VI="FIXTURE_REFERENCE_INVALID",IK="fixture:",CK="conformance/fixtures.yaml";DK={name:VI,run:m$e}});function h$e(t){let{cwd:e="."}=t,r=pt(e),n=r.gates.secret;if(!n)return[{detector:fb,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=et(n.cmd,[...n.args],{cwd:e,reject:!1});return af(i)?[{detector:fb,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:W_(i,fb,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var fb,pb,WI=y(()=>{"use strict";Ir();gn();yn();fb="HARDCODED_SECRET";pb={name:fb,run:h$e}});import{existsSync as Gc,readFileSync as KI}from"node:fs";import{join as ua}from"node:path";function g$e(t){return Vo(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec)\.ts$/.test(r)).length}function hf(t){if(!Gc(t))return null;try{return JSON.parse(KI(t,"utf8"))}catch{return null}}function y$e(t,e){let r=ua(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(KI(r,"utf8"))}catch(c){e.push({detector:io,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:io,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=g$e(t);s!==a&&e.push({detector:io,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function _$e(t,e){for(let r of jK){let n=ua(t,r.path);if(!Gc(n))continue;let i=hf(n);if(!i){e.push({detector:io,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:io,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function b$e(t,e){let r=hf(ua(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of jK){let s=ua(t,o.path);if(!Gc(s))continue;let a=hf(s);a?.version&&a.version!==n&&e.push({detector:io,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=ua(t,".claude-plugin","marketplace.json");if(Gc(i)){let o=hf(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:io,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function v$e(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function S$e(t,e){let r=ua(t,"src","cli","clad.ts"),n=ua(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Gc(r)||!Gc(n))return;let i=v$e(KI(r,"utf8"));if(i.length===0)return;let s=hf(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:io,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function w$e(t){let{cwd:e="."}=t,r=[];return y$e(e,r),S$e(e,r),_$e(e,r),b$e(e,r),r}var io,jK,MK,FK=y(()=>{"use strict";mf();io="HARNESS_INTEGRITY",jK=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];MK={name:io,run:w$e}});import{existsSync as x$e,readFileSync as $$e}from"node:fs";import{join as k$e}from"node:path";function A$e(t){let{cwd:e="."}=t;return pe(e,mb,r=>I$e(r,e))}function T$e(){return E$e}function O$e(t){let e=k$e(t,"spec/capabilities.yaml");if(!x$e(e))return!1;try{let r=zK.default.parse($$e(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function I$e(t,e){let r=t.features.length;if(r{"use strict";zK=kt(or(),1);_t();mb="HOLLOW_GOVERNANCE",E$e=8;LK={name:mb,run:A$e}});function P$e(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=[];return qK(r.features.map(i=>i.id),"feature","spec/features/",n),qK((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function qK(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:BK,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var BK,HK,ZK=y(()=>{"use strict";at();BK="ID_COLLISION";HK={name:BK,run:P$e}});import{existsSync as gf,readFileSync as JI,readdirSync as YI,statSync as R$e,writeFileSync as VK}from"node:fs";import{join as oo}from"node:path";function GK(t){if(!gf(t))return 0;try{return YI(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function C$e(t){if(!gf(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=YI(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=oo(n,o),a;try{a=R$e(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function D$e(t){let e=oo(t,"spec","capabilities.yaml");if(!gf(e))return 0;try{let r=hb.default.parse(JI(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function Wo(t="."){let e=GK(oo(t,"spec","features")),r=GK(oo(t,"spec","scenarios")),n=D$e(t),i=C$e(oo(t,"tests")),o=new Date().toISOString().slice(0,10);return{features:e,scenarios:r,capabilities:n,test_files:i,last_synced:o}}function Vc(t,e){let r=oo(t,"spec.yaml");if(!gf(r))return;let n=JI(r,"utf8"),i=N$e(n,e);i!==n&&VK(r,i)}function N$e(t,e){let r=t.includes(`\r `)?`\r `:` `,n=t.split(/\r?\n/),i=n.findIndex(d=>/^inventory:\s*$/.test(d)),o=["# Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand.","inventory:",` features: ${e.features??0}`,` scenarios: ${e.scenarios??0}`,` capabilities: ${e.capabilities??0}`,` test_files: ${e.test_files??0}`,` last_synced: ${JSON.stringify(e.last_synced??"")}`],s=d=>r===`\r @@ -249,20 +249,20 @@ ${o.join(` `)}let a=i;a>0&&/Auto-maintained by `clad sync`/.test(n[a-1])&&(a-=1);let c=i+1;for(;ci+1);)c++;let l=n.slice(0,a),u=n.slice(c);for(;l.length>0&&l[l.length-1].trim()==="";)l.pop();return l.push(""),s([...l,...o,"",...u.filter((d,f)=>!(f===0&&d.trim()===""))].join(` `).replace(/\n{3,}/g,` -`))}function aa(t="."){let e=to(t,"spec","features");if(!ff(e))return!1;let r=[];for(let i of VI(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,mv.parse)(GI(to(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` +`))}function da(t="."){let e=oo(t,"spec","features");if(!gf(e))return!1;let r=[];for(let i of YI(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,hb.parse)(JI(oo(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` `)+` -`;return zK(to(t,"spec","index.yaml"),n,"utf8"),!0}var mv,pf=y(()=>{"use strict";mv=$t(rr(),1)});import{existsSync as LK,readFileSync as UK,readdirSync as T0e}from"node:fs";import{join as WI}from"node:path";function O0e(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=Ho(e),i=r.inventory;if(!i){let s=qK.filter(([c])=>(n[c]??0)>0);if(s.length===0)return KI(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...KI(e),{detector:mf,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of qK){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:mf,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...KI(e)),o}function KI(t){let e=WI(t,"spec","index.yaml"),r=WI(t,"spec","features");if(!LK(e)||!LK(r))return[];let n=new Map;try{for(let l of UK(e,"utf8").split(` -`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of T0e(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=UK(WI(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:mf,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:mf,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var mf,qK,BK,HK=y(()=>{"use strict";pf();lt();mf="INVENTORY_DRIFT",qK=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];BK={name:mf,run:O0e}});import{existsSync as I0e,readFileSync as P0e}from"node:fs";import{join as R0e}from"node:path";function D0e(t){let{cwd:e="."}=t,r=R0e(e,"src","spec","schema.json"),n=[];if(I0e(r)){let i;try{i=JSON.parse(P0e(r,"utf8"))}catch(o){n.push({detector:hf,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of C0e)i.required?.includes(o)||n.push({detector:hf,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:hf,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=J(e);i.schema!==ZK&&n.push({detector:hf,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${ZK}'`})}catch{}return n}var hf,C0e,ZK,GK,VK=y(()=>{"use strict";lt();hf="META_INTEGRITY",C0e=["schema","project","features"],ZK="0.1";GK={name:hf,run:D0e}});function N0e(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=[];return WK(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),WK((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function WK(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:KK,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var KK,JK,YK=y(()=>{"use strict";lt();KK="SLUG_CONFLICT";JK={name:KK,run:N0e}});import{existsSync as j0e}from"node:fs";import{join as M0e}from"node:path";function F0e(t){let{cwd:e="."}=t;return pe(e,JI,r=>z0e(r,e))}function z0e(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=M0e(e,i);j0e(o)||r.push({detector:JI,severity:"error",path:i,message:`feature ${n.id} declares module '${i}' but the file does not exist`})}return r}var JI,hv,YI=y(()=>{"use strict";_t();JI="MISSING_IMPLEMENTATION";hv={name:JI,run:F0e}});function L0e(t){let{cwd:e="."}=t;return pe(e,XI,U0e)}function U0e(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:XI,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var XI,gv,QI=y(()=>{"use strict";_t();XI="MISSING_TESTS";gv={name:XI,run:L0e}});import{existsSync as q0e,readFileSync as B0e}from"node:fs";import{join as XK}from"node:path";function QK(t){if(q0e(t))try{return JSON.parse(B0e(t,"utf8"))}catch{return}}function V0e(t){let{cwd:e="."}=t,r=QK(XK(e,H0e)),n=QK(XK(e,Z0e));if(!r||!n)return[{detector:eP,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>G0e&&i.push({detector:eP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var eP,H0e,Z0e,G0e,e3,t3=y(()=>{"use strict";eP="PERFORMANCE_DRIFT",H0e="perf/baseline.json",Z0e="perf/current.json",G0e=10;e3={name:eP,run:V0e}});import{existsSync as W0e}from"node:fs";import{join as K0e}from"node:path";function Y0e(t){let{cwd:e="."}=t;return pe(e,tP,r=>eke(r,e))}function X0e(){return J0e}function Q0e(t,e){return(t.modules??[]).some(r=>W0e(K0e(e,r)))}function eke(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||Q0e(s,e)||r.push(s.id);let n=X0e();if(r.length<=n)return[];let i=r.slice(0,r3).join(", "),o=r.length>r3?", \u2026":"";return[{detector:tP,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var tP,J0e,r3,n3,i3=y(()=>{"use strict";_t();tP="PLANNED_BACKLOG",J0e=5,r3=8;n3={name:tP,run:Y0e}});import{existsSync as tke,readFileSync as rke}from"node:fs";import{join as nke}from"node:path";function ske(t){let{cwd:e="."}=t;return pe(e,rP,r=>cke(r,e))}function ake(){return ike}function cke(t,e){if(t.features.lengthn.includes(i))?[{detector:rP,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Refine it with \`clad refine\` or by hand.`}]:[]}var rP,ike,oke,o3,s3=y(()=>{"use strict";_t();rP="PROJECT_CONTEXT_DRIFT",ike=8,oke=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];o3={name:rP,run:ske}});function a3(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:yv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function lke(t){let{cwd:e="."}=t;return pe(e,yv,uke)}function uke(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...a3(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:yv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...a3(e,n.features,`scenario ${n.id}.features`));return r}var yv,_v,nP=y(()=>{"use strict";_t();yv="REFERENCE_INTEGRITY";_v={name:yv,run:lke}});import{existsSync as dke,readdirSync as fke,readFileSync as pke,statSync as mke,writeFileSync as hke}from"node:fs";import{dirname as gke,join as gf,normalize as yke,relative as _ke}from"node:path";function xke(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function c3(t){return t.split("\\").join("/")}function $ke(t){return vke.some(e=>t===e||t.startsWith(`${e}/`))}function kke(t){let e=gf(t,"docs");if(!dke(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=fke(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=gf(i,s),c;try{c=mke(a)}catch{continue}let l=c3(_ke(t,a));$ke(l)||(c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l))}}return r.sort()}function Eke(t,e){if(/^[a-z]+:/i.test(e))return null;let r=yke(gf(gke(t),e));return c3(r)}function yf(t="."){let e=[];for(let r of kke(t)){let n;try{n=pke(gf(t,r),"utf8")}catch{continue}let i=n.includes(bke),o=xke(n),s=i?[]:[...new Set(o.match(Ske)??[])].sort(),a=new Set;for(let c of o.matchAll(wke)){let l=Eke(r,c[1]);l&&a.add(l)}e.push({doc:r,features:s,doc_links:[...a].sort()})}return{docs:e}}function l3(t="."){let e=yf(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return hke(gf(t,"spec","_doc-links.yaml"),`${r.join(` +`;return VK(oo(t,"spec","index.yaml"),n,"utf8"),!0}var hb,yf=y(()=>{"use strict";hb=kt(or(),1)});import{existsSync as WK,readFileSync as KK,readdirSync as j$e}from"node:fs";import{join as XI}from"node:path";function M$e(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=Wo(e),i=r.inventory;if(!i){let s=JK.filter(([c])=>(n[c]??0)>0);if(s.length===0)return QI(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...QI(e),{detector:_f,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of JK){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:_f,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...QI(e)),o}function QI(t){let e=XI(t,"spec","index.yaml"),r=XI(t,"spec","features");if(!WK(e)||!WK(r))return[];let n=new Map;try{for(let l of KK(e,"utf8").split(` +`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of j$e(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=KK(XI(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:_f,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:_f,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var _f,JK,YK,XK=y(()=>{"use strict";yf();at();_f="INVENTORY_DRIFT",JK=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];YK={name:_f,run:M$e}});import{existsSync as F$e,readFileSync as z$e}from"node:fs";import{join as L$e}from"node:path";function q$e(t){let{cwd:e="."}=t,r=L$e(e,"src","spec","schema.json"),n=[];if(F$e(r)){let i;try{i=JSON.parse(z$e(r,"utf8"))}catch(o){n.push({detector:bf,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of U$e)i.required?.includes(o)||n.push({detector:bf,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:bf,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=J(e);i.schema!==QK&&n.push({detector:bf,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${QK}'`})}catch{}return n}var bf,U$e,QK,e3,t3=y(()=>{"use strict";at();bf="META_INTEGRITY",U$e=["schema","project","features"],QK="0.1";e3={name:bf,run:q$e}});function B$e(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=[];return r3(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),r3((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function r3(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:n3,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var n3,i3,o3=y(()=>{"use strict";at();n3="SLUG_CONFLICT";i3={name:n3,run:B$e}});import{existsSync as H$e}from"node:fs";import{join as Z$e}from"node:path";function G$e(t){let{cwd:e="."}=t;return pe(e,eP,r=>V$e(r,e))}function V$e(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=Z$e(e,i);H$e(o)||r.push({detector:eP,severity:"error",path:i,message:`feature ${n.id} declares module '${i}' but the file does not exist`})}return r}var eP,gb,tP=y(()=>{"use strict";_t();eP="MISSING_IMPLEMENTATION";gb={name:eP,run:G$e}});function W$e(t){let{cwd:e="."}=t;return pe(e,rP,K$e)}function K$e(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:rP,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var rP,yb,nP=y(()=>{"use strict";_t();rP="MISSING_TESTS";yb={name:rP,run:W$e}});import{existsSync as J$e,readFileSync as Y$e}from"node:fs";import{join as s3}from"node:path";function a3(t){if(J$e(t))try{return JSON.parse(Y$e(t,"utf8"))}catch{return}}function tke(t){let{cwd:e="."}=t,r=a3(s3(e,X$e)),n=a3(s3(e,Q$e));if(!r||!n)return[{detector:iP,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>eke&&i.push({detector:iP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var iP,X$e,Q$e,eke,c3,l3=y(()=>{"use strict";iP="PERFORMANCE_DRIFT",X$e="perf/baseline.json",Q$e="perf/current.json",eke=10;c3={name:iP,run:tke}});import{existsSync as rke}from"node:fs";import{join as nke}from"node:path";function oke(t){let{cwd:e="."}=t;return pe(e,oP,r=>cke(r,e))}function ske(){return ike}function ake(t,e){return(t.modules??[]).some(r=>rke(nke(e,r)))}function cke(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||ake(s,e)||r.push(s.id);let n=ske();if(r.length<=n)return[];let i=r.slice(0,u3).join(", "),o=r.length>u3?", \u2026":"";return[{detector:oP,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var oP,ike,u3,d3,f3=y(()=>{"use strict";_t();oP="PLANNED_BACKLOG",ike=5,u3=8;d3={name:oP,run:oke}});import{existsSync as lke,readFileSync as uke}from"node:fs";import{join as dke}from"node:path";function mke(t){let{cwd:e="."}=t;return pe(e,sP,r=>gke(r,e))}function hke(){return fke}function gke(t,e){if(t.features.lengthn.includes(i))?[{detector:sP,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Refine it with \`clad refine\` or by hand.`}]:[]}var sP,fke,pke,p3,m3=y(()=>{"use strict";_t();sP="PROJECT_CONTEXT_DRIFT",fke=8,pke=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];p3={name:sP,run:mke}});function h3(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:_b,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function yke(t){let{cwd:e="."}=t;return pe(e,_b,_ke)}function _ke(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...h3(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:_b,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...h3(e,n.features,`scenario ${n.id}.features`));return r}var _b,bb,aP=y(()=>{"use strict";_t();_b="REFERENCE_INTEGRITY";bb={name:_b,run:yke}});function vb(t=""){return new RegExp(bke,t)}var bke,cP=y(()=>{"use strict";bke=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as vke,readdirSync as Ske,readFileSync as wke,statSync as xke,writeFileSync as $ke}from"node:fs";import{dirname as kke,join as vf,normalize as Eke,relative as Ake}from"node:path";function Pke(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function g3(t){return t.split("\\").join("/")}function Rke(t){return Tke.some(e=>t===e||t.startsWith(`${e}/`))}function Cke(t){let e=vf(t,"docs");if(!vke(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=Ske(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=vf(i,s),c;try{c=xke(a)}catch{continue}let l=g3(Ake(t,a));Rke(l)||(c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l))}}return r.sort()}function Dke(t,e){if(/^[a-z]+:/i.test(e))return null;let r=Eke(vf(kke(t),e));return g3(r)}function Sf(t="."){let e=[];for(let r of Cke(t)){let n;try{n=wke(vf(t,r),"utf8")}catch{continue}let i=n.includes(Oke),o=Pke(n),s=i?[]:[...new Set(o.match(vb("g"))??[])].sort(),a=new Set;for(let c of o.matchAll(Ike)){let l=Dke(r,c[1]);l&&a.add(l)}e.push({doc:r,features:s,doc_links:[...a].sort()})}return{docs:e}}function y3(t="."){let e=Sf(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return $ke(vf(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var vke,bke,Ske,wke,vv=y(()=>{"use strict";vke=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],bke="clad-doc-links: ignore",Ske=/\bF-[0-9a-f]{6,8}\b/g,wke=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g});import{existsSync as Ake}from"node:fs";import{join as Tke}from"node:path";function Oke(t){let{cwd:e="."}=t;return pe(e,bv,r=>Ike(r,e))}function Ike(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of yf(e).docs){for(let o of i.doc_links)Ake(Tke(e,o))||n.push({detector:bv,severity:"error",path:i.doc,message:`doc '${i.doc}' links to missing file '${o}'`});for(let o of i.features)r.has(o)||n.push({detector:bv,severity:"warn",path:i.doc,message:`doc '${i.doc}' references unknown feature '${o}' \u2014 archived/renamed? If it is an illustrative example, add a \`clad-doc-links: ignore\` marker to the doc.`})}return n}var bv,Sv,iP=y(()=>{"use strict";vv();_t();bv="DOC_LINK_INTEGRITY";Sv={name:bv,run:Oke}});function Rke(t){let{cwd:e="."}=t;return pe(e,_f,r=>Dke(r))}function Cke(){return Pke}function Dke(t){let e=[],r=t.features.length,n=t.scenarios??[];r>=Cke()&&n.length===0&&e.push({detector:_f,severity:"warn",path:"spec/scenarios/",message:`${r} features but no scenarios declared \u2014 cross-feature user-journey flows are not captured. Author at least one with \`clad_create_scenario\`.`});for(let o of n)(o.features??[]).length===0&&e.push({detector:_f,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let i=new Map(t.features.filter(o=>typeof o.slug=="string"&&o.slug.length>0).map(o=>[o.slug,o.id]));for(let o of n){if(!o.flow)continue;let s=new Set(o.features??[]),a=new Map;for(let c of o.flow.matchAll(/\(([^)]+)\)/g))for(let l of c[1].split(/[,/·]/)){let u=l.trim(),d=i.get(u);d&&!s.has(d)&&a.set(u,d)}if(a.size>0){let c=[...a].map(([l,u])=>`${l} (${u})`).join(", ");e.push({detector:_f,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} flow references ${c} but features[] does not bind ${a.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var _f,Pke,u3,d3=y(()=>{"use strict";_t();_f="SCENARIO_COVERAGE",Pke=8;u3={name:_f,run:Rke}});import{createHash as Nke}from"node:crypto";function jke(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function vf(t,e=0){if(t.oracle_policy){let r=t.oracle_policy;return{mandateActive:!0,reportOnly:!1,exhaustive:!1,alwaysEars:new Set(r.always_ears??f3),sample:jke(r.sample??0)}}return t.require_oracles===!0?{mandateActive:!0,reportOnly:!1,exhaustive:!0,alwaysEars:new Set,sample:1}:t.require_oracles===void 0&&e>=8?{mandateActive:!0,reportOnly:!0,exhaustive:!1,alwaysEars:new Set(f3),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function bf(t){return(t.features??[]).filter(e=>e.status==="done").length}function Mke(t,e){return e<=0?!1:e>=1?!0:parseInt(Nke("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var f3,wv=y(()=>{"use strict";f3=["unwanted"]});import{existsSync as Fke,readdirSync as zke}from"node:fs";import{join as m3}from"node:path";import h3 from"node:process";function Lke(t){let e=!1,r=n=>{for(let i of zke(n,{withFileTypes:!0})){if(e)return;let o=m3(n,i.name);i.isDirectory()?r(o):(/\.(test|spec)\.[cm]?[jt]sx?$/.test(i.name)||/_test\.py$/.test(i.name))&&(e=!0)}};try{r(t)}catch{}return e}function oP(t={}){let{cwd:e="."}=t,r=m3(e,Zo);if(!Fke(r)||!Lke(r))return{stage:xv,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${Zo}/ \u2014 skipped`};let n=pt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:xv,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=Qe(i.cmd,[...i.args,Zo],{cwd:e,reject:!1}),s=Ft(xv,i.cmd,o);return s||nr(xv,o)}var xv,Zo,Uke,sP=y(()=>{"use strict";Ar();mn();hn();xv="stage_2.3",Zo="tests/oracle";Uke=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${h3.argv[1]}`;if(Uke){let t=oP();console.log(JSON.stringify(t)),h3.exit(t.exitCode)}});import{existsSync as qke}from"node:fs";import{join as Bke}from"node:path";function Hke(t){let{cwd:e="."}=t;return pe(e,Un,r=>Zke(r,e))}function Zke(t,e){let r=[],n=vf(t.project,bf(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?gn(e):[],s=o.filter(l=>l.kind==="oracle"),a=new Set(["agent:developer","agent:specialists"]),c=l=>o.find(u=>u.featureId===l&&a.has(u.stage))?.identity.name;for(let l of t.features)if(l.status==="done")for(let u of l.acceptance_criteria??[]){let d=u.oracle_refs??[];if(Sf(n,l.id,u)&&d.length===0){let f=n.exhaustive?"project.require_oracles is set":u.ears&&n.alwaysEars.has(u.ears)?`oracle_policy.always_ears includes '${u.ears}'`:"selected by oracle_policy.sample";r.push({detector:Un,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${Zo}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!qke(Bke(e,f))){r.push({detector:Un,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${Zo}/`)||r.push({detector:Un,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${Zo}/ \u2014 stage_2.3 only runs ${Zo}/, so this oracle will not execute`}),!n.mandateActive)continue;let p=s.find(g=>g.featureId===l.id&&g.acId===u.id&&g.artifact===f);if(!p){r.push({detector:Un,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' has no authoring-provenance record \u2014 author it via 'clad oracle' (or clad_author_oracle) so impl-blindness can be verified`});continue}let m=c(l.id);m&&p.identity.name===m?r.push({detector:Un,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:Un,severity:"info",message:`${l.id}.${u.id} oracle author\u2260implementer not verified \u2014 no implementer identity recorded (no clad drive history to compare)`});let h=(p.readManifest??[]).filter(g=>(l.modules??[]).includes(g));h.length>0&&r.push({detector:Un,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: author read implementation file(s) the feature owns (${h.join(", ")})`}),p.blind===!1&&r.push({detector:Un,severity:"info",message:`${l.id}.${u.id} oracle '${f}' provenance is self-reported (host-protocol), not cladding-controlled \u2014 manifest checked, blindness unproven`})}}if(n.mandateActive&&!n.exhaustive){let l=t.features.filter(u=>u.status==="done").flatMap(u=>u.acceptance_criteria??[]).filter(u=>!u.ears).length;l>0&&r.push({detector:Un,severity:"info",message:`${l} done AC(s) carry no EARS tag and are invisible to the risk-weighted oracle mandate \u2014 tag them (ubiquitous/event/state/optional/unwanted/complex) for the mandate to mean anything.`})}return r}var Un,g3,y3=y(()=>{"use strict";Ln();wv();sP();_t();Un="SPEC_CONFORMANCE";g3={name:Un,run:Hke}});function Gke(t){let{cwd:e="."}=t,r=gn(e);if(r.length===0)return[{detector:aP,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=Date.now(),i=[];for(let o of r){let s=Date.parse(o.identity.timestamp);if(Number.isNaN(s))continue;let a=(n-s)/(1e3*60*60*24);a>_3&&i.push({detector:aP,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${_3})`})}return i}var aP,_3,v3,b3=y(()=>{"use strict";Ln();aP="STALE_EVIDENCE",_3=90;v3={name:aP,run:Gke}});import{existsSync as S3}from"node:fs";import{join as w3}from"node:path";function Vke(t){let{cwd:e="."}=t;return pe(e,Hc,r=>Wke(r,e))}function Wke(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Hc,severity:"warn",message:`feature ${n.id} has archived_at but status='${n.status}' (expected 'archived')`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`archived_at already set but status is '${n.status}'`}}}),n.superseded_by&&!n.archived_at&&r.push({detector:Hc,severity:"warn",message:`feature ${n.id} has superseded_by but no archived_at`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`superseded by ${n.superseded_by} but missing archived_at`}}}),n.status==="archived"){let i=(n.modules??[]).filter(o=>S3(w3(e,o)));i.length>0&&r.push({detector:Hc,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}(n.status==="planned"||n.status==="in_progress")&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>S3(w3(e,i)))&&r.push({detector:Hc,severity:"warn",message:`feature ${n.id} (status='${n.status}') declares ${n.modules?.length??0} module(s) but none exist on disk \u2014 consider archiving`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:"all declared modules vanished from disk"}}})}return r}var Hc,$v,cP=y(()=>{"use strict";_t();Hc="STALE_SPECIFICATION";$v={name:Hc,run:Vke}});import{existsSync as x3,statSync as $3}from"node:fs";import{join as k3}from"node:path";function Jke(t,e){let r=0;for(let n of e){let i=k3(t,n);if(!x3(i))continue;let o=$3(i).mtimeMs;o>r&&(r=o)}return r}function Yke(t){let{cwd:e="."}=t;return pe(e,lP,r=>Xke(r,e))}function Xke(t,e){let r=mi(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=Jke(e,n);if(i===0)return[];let o=Bo([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=k3(e,a);if(!x3(c))continue;let l=$3(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>Kke&&s.push({detector:lP,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var lP,Kke,kv,uP=y(()=>{"use strict";uf();Fc();_t();lP="STALE_TESTS",Kke=30;kv={name:lP,run:Yke}});import{existsSync as Qke}from"node:fs";import{join as eEe}from"node:path";function tEe(t){let{cwd:e="."}=t;return pe(e,wf,r=>rEe(r,e))}function rEe(t,e){let r=[];for(let n of t.features){let i=n.modules??[],o=n.acceptance_criteria??[];if(n.status==="done"&&i.length===0&&o.length===0){r.push({detector:wf,severity:"error",message:`feature ${n.id} status='done' but declares no modules and no acceptance_criteria \u2014 nothing to verify (hollow completion)`});continue}if(i.length===0)continue;let s=i.filter(a=>!Qke(eEe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:wf,severity:"error",message:`feature ${n.id} status='done' but ${s.length}/${i.length} module(s) missing: ${s.join(", ")}`}):n.status==="in_progress"&&s.length===i.length&&r.push({detector:wf,severity:"warn",message:`feature ${n.id} status='in_progress' but every declared module is missing \u2014 likely a stale start`}))}return r}var wf,Ev,dP=y(()=>{"use strict";_t();wf="STATUS_DRIFT";Ev={name:wf,run:tEe}});function nEe(t){let{cwd:e="."}=t;return pe(e,Av,r=>iEe(r,e))}function iEe(t,e){let r=pt(e).language;return r==="unknown"?[{detector:Av,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:Av,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var Av,E3,A3=y(()=>{"use strict";mn();_t();Av="TECH_STACK_MISMATCH";E3={name:Av,run:nEe}});function cEe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function lEe(t){let{cwd:e="."}=t;return pe(e,fP,r=>uEe(r,e))}function uEe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=Bo([...cEe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:fP,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var fP,T3,oEe,sEe,aEe,Tv,pP=y(()=>{"use strict";uf();NI();_t();fP="UNMAPPED_ARTIFACT",T3=["src/stages/**/*.ts","src/spec/**/*.ts"],oEe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},sEe={kotlin:"src/main/kotlin"},aEe=8;Tv={name:fP,run:lEe}});import{existsSync as O3}from"node:fs";import{join as I3}from"node:path";function fEe(t){return dEe.some(e=>t.startsWith(e))}function pEe(t){let{cwd:e="."}=t;return pe(e,mP,r=>mEe(r,e))}function mEe(t,e){let r=[];for(let n of t.features)if(n.status==="done")for(let i of n.acceptance_criteria??[])for(let o of i.test_refs??[]){if(fEe(o))continue;let s=o.split("#",1)[0];O3(I3(e,o))||s&&O3(I3(e,s))||r.push({detector:mP,severity:"error",path:o,message:`${n.id}.${i.id} test_ref '${o}' resolves to nothing on disk \u2014 a test_ref must be a real file path (e.g. 'tests/x.test.ts', optionally with a '#' anchor) or a 'self-dogfood: +`}function JS(t){return`${JSON.stringify(t,null,2)} +`}function fX(t){let e=new Map(t.nodes.map(s=>[s.id,s])),r=new Map,n=new Map;for(let s of t.edges)(r.get(s.from)??r.set(s.from,[]).get(s.from)).push({other:s.to,kind:s.kind}),(n.get(s.to)??n.set(s.to,[]).get(s.to)).push({other:s.from,kind:s.kind});let i=s=>{let a=e.get(s);return a?`[[${cX(a)}|${a.label.replace(/[[\]|]/g," ")}]]`:`[[${s.replace(/[[\]|]/g," ")}]]`},o=new Map;for(let s of t.nodes){let a=["---",`kind: ${s.kind}`,...s.tier?[`tier: ${s.tier}`]:[],...s.status?[`status: ${s.status}`]:[],`id: ${JSON.stringify(s.id)}`,"---",`# ${s.label}`,""],c=(r.get(s.id)??[]).slice().sort(lX);if(c.length>0){a.push("## Links");for(let u of c)a.push(`- ${u.kind} \u2192 ${i(u.other)}`);a.push("")}let l=(n.get(s.id)??[]).slice().sort(lX);if(l.length>0){a.push("## Backlinks");for(let u of l)a.push(`- ${i(u.other)} \u2192 ${u.kind}`);a.push("")}o.set(`${s.kind}/${cX(s)}.md`,`${a.join(` +`)}`)}return o}function lX(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as $Ne}from"node:fs";import{dirname as kNe,join as oD}from"node:path";import{fileURLToPath as ENe}from"node:url";var sD=kNe(ENe(import.meta.url));function pX(t){for(let e of[oD(sD,"viewer",t),oD(sD,"..","graph","viewer",t),oD(sD,"..","..","dist","viewer",t)])try{return $Ne(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function mX(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -699,21 +701,19 @@ ${r} ${o} -`}LI();iP();YI();QI();nP();zI();uP();dP();pP();hP();Cp();var gNe=[gv,Ov,hv,Tv,_v,Sv,uv,Ev,kv,lv],yNe=/\bF-(?:\d{3,}|[a-f0-9]{6,8})\b/;function _Ne(t,e){if(t.path){let n=t.path.split("#")[0].trim();for(let i of[Fe.module(n),Fe.test(n),Fe.doc(n)])if(e.has(i))return i}let r=yNe.exec(t.message??"");return r&&e.has(Fe.feature(r[0]))?Fe.feature(r[0]):null}function KS(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};for(let o of gNe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s){if(a.severity!=="error"&&a.severity!=="warn")continue;let c=_Ne(a,r);if(!c)continue;let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}function oX(t,e=10){let r={};for(let s of t.nodes)r[s.kind]=(r[s.kind]??0)+1;let n={},i=new Map;for(let s of t.edges)n[s.kind]=(n[s.kind]??0)+1,i.set(s.from,(i.get(s.from)??0)+1),i.set(s.to,(i.get(s.to)??0)+1);let o=t.nodes.map(s=>({id:s.id,kind:s.kind,label:s.label,degree:i.get(s.id)??0})).sort((s,a)=>a.degree-s.degree||s.id.localeCompare(a.id)).slice(0,e);return{nodeCount:t.nodes.length,edgeCount:t.edges.length,nodesByKind:r,edgesByKind:n,hubs:o}}function sX(t){let e=n=>Object.keys(n).sort().map(i=>`${i}=${n[i]}`).join(" ");return`${[`nodes: ${t.nodeCount} (${e(t.nodesByKind)})`,`edges: ${t.edgeCount} (${e(t.edgesByKind)})`,"hubs (top by degree):",...t.hubs.map((n,i)=>` ${String(i+1).padStart(2)}. [${n.kind}] ${n.label} \u2014 degree ${n.degree}`)].join(` -`)} -`}lt();No();function aX(t={}){try{let e=t.format??"mermaid",r=J(),n=Ea(r,".");if(t.focus){let o=HS(r,n,t.focus);if(!o){H("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let s=t.depth!==void 0?Number(t.depth):1/0;n=BS(n,o,s)}if(e==="obsidian"){let o=t.out??".cladding/graph",s=rX(n);for(let[a,c]of s){let l=vNe(o,a);eD(rD(l),{recursive:!0}),tD(l,c,"utf8")}H("pass","graph",`wrote ${s.size} note(s) to ${o} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(e==="html"){if(!t.out){H("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let o=WS(n,KS(n,"."));eD(rD(t.out),{recursive:!0}),tD(t.out,o,"utf8"),H("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let i=e==="dot"?tX(n):e==="json"?VS(n):eX(n);t.out?(eD(rD(t.out),{recursive:!0}),tD(t.out,i,"utf8"),H("pass","graph",`wrote ${e} graph to ${t.out}`),process.exit(0)):process.stdout.write(i,()=>process.exit(0))}catch(e){H("fail","graph",e.message),process.exit(1)}}function cX(){try{let t=Ea(J(),".");process.stdout.write(sX(oX(t)),()=>process.exit(0))}catch(t){H("fail","graph",t.message),process.exit(1)}}Cp();import{createServer as bNe}from"node:http";import{existsSync as SNe,watch as wNe}from"node:fs";import{join as xNe}from"node:path";lt();No();function $Ne(t={}){let e=t.cwd??".",r=new Set,n=()=>Ea(J(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}HI();lP();tP();nP();aP();BI();hP();gP();_P();vP();jp();cP();at();var ANe=[yb,Pb,gb,Ib,bb,xb,db,Tb,Ab,ub];function TNe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[Le.module(n),Le.test(n),Le.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=vb().exec(t.message??"");return r&&e.has(Le.feature(r[0]))?[Le.feature(r[0])]:[]}function XS(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ws(e,J(e))}catch{}try{for(let o of ANe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of TNe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ws(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}aD();at();zo();var INe=new Set(["mermaid","dot","json","obsidian","html"]);function gX(t={}){try{let e=t.format??"mermaid";if(!INe.has(e)){B("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=J(),i=Ia(n,".");if(t.focus){let s=GS(n,i,t.focus);if(s.length===0){B("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){B("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=ZS(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=fX(i);for(let[c,l]of a){let u=ONe(s,c);cD(uD(u),{recursive:!0}),lD(u,l,"utf8")}B("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){B("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=YS(i,XS(i,"."));cD(uD(t.out),{recursive:!0}),lD(t.out,s,"utf8"),B("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?dX(i):r==="json"?JS(i):uX(i);t.out?(cD(uD(t.out),{recursive:!0}),lD(t.out,o,"utf8"),B("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){B("fail","graph",e.message),process.exit(1)}}function yX(){try{let t=Ia(J(),".");process.stdout.write(hX(QS(t)),()=>process.exit(0))}catch(t){B("fail","graph",t.message),process.exit(1)}}jp();import{createServer as PNe}from"node:http";import{existsSync as RNe,watch as CNe}from"node:fs";import{join as DNe}from"node:path";at();zo();function NNe(t={}){let e=t.cwd??".",r=new Set,n=()=>Ia(J(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=bNe((u,d)=>{let f=(u.url??"/").split("?")[0];try{if(f==="/graph.json"){d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(VS(n()));return}if(f==="/health.json"){d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(JSON.stringify(KS(n(),e)));return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected +`)}catch{r.delete(u)}},o=PNe((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=JS(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(XS(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected -`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(WS(n()));return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(p){d.headersSent||d.writeHead(500,{"Content-Type":"text/plain"});try{d.end(p.message)}catch{}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=xNe(e,u);if(SNe(d))try{c.push(wNe(d,{recursive:!0},a))}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive +`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=YS(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=DNe(e,u);if(RNe(d))try{let f=CNe(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive -`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise(u=>{o.listen(t.port??0,"127.0.0.1",()=>{let d=o.address(),f=typeof d=="object"&&d?d.port:t.port??0;u({port:f,broadcast:i,close:()=>new Promise(p=>{s&&clearTimeout(s),clearInterval(l);for(let m of c)try{m.close()}catch{}for(let m of r)try{m.end()}catch{}r.clear(),o.close(()=>p()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function lX(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await $Ne({port:e,cwd:t.cwd??"."});H("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){H("fail","graph",r.message),process.exit(1)}}var kNe=["stage_1.1","stage_2.1","stage_2.3"];function ENe(t){return(t.features??[]).filter(e=>e.status==="done")}function ANe(t,e){let r=ENe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function uX(t,e){let r=[];for(let n of kNe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=ANe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}J_();import dX from"node:process";function TNe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function JS(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=TNe(n,t);i.pass||r.push(i)}return r}Ln();var nD="stage_4.1";function iD(t={}){let{cwd:e="."}=t,r=gn(e);if(r.length===0)return{stage:nD,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=JS(r);if(n.length===0)return{stage:nD,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:nD,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var ONe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dX.argv[1]}`;if(ONe){let t=iD();console.log(JSON.stringify(t)),dX.exit(t.exitCode)}Ar();import fX from"node:process";var YS="stage_1.4";function oD(t={}){let{cwd:e="."}=t,r;try{r=Qe("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:YS,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:YS,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:YS,pass:!0,exitCode:0}:{stage:YS,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var INe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${fX.argv[1]}`;if(INe){let t=oD();console.log(JSON.stringify(t)),fX.exit(t.exitCode)}Ar();Dp();hn();import pX from"node:process";var XS="stage_2.2";function sD(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=ns("coverage",t))}catch(a){return{stage:XS,pass:!1,exitCode:1,stderr:a.message}}if(!r||!n)return{stage:XS,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Qe(r,[...n],{cwd:e,reject:!1}),s=Ft(XS,r,o);return s||nr(XS,o)}var CNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${pX.argv[1]}`;if(CNe){let t=sD();console.log(JSON.stringify(t)),pX.exit(t.exitCode)}Pv();aD();Ar();mn();hn();import hX from"node:process";var ew="stage_3.2";function cD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:ew,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Mc(e,o[o.length-1]))return{stage:ew,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Qe(i,[...o],{cwd:e,reject:!1}),a=Ft(ew,i,s);return a||nr(ew,s)}var NNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hX.argv[1]}`;if(NNe){let t=cD();console.log(JSON.stringify(t)),hX.exit(t.exitCode)}Ar();lt();hn();import{existsSync as jNe}from"node:fs";import{resolve as gX}from"node:path";import yX from"node:process";var Gt="stage_2.4",_X=5e3;function lD(t={}){let{cwd:e="."}=t,r,n=[],i=!1;try{let f=J(e);r=f.project.deliverable,n=f.project.smoke??[],i=f.features.some(p=>p.status==="done")}catch{return{stage:Gt,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return MNe(e,n[0],i);if(!r)return{stage:Gt,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:Gt,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:Gt,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let o=gX(e,r.path);if(!jNe(o))return{stage:Gt,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let s=r.timeout_ms??_X,a;try{a=Qe(o,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:s})}catch(f){a=f}let c=Ft(Gt,r.path,a);if(c)return c;if(a.timedOut)return{stage:Gt,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${s}ms (hung or too slow)`};let l=r.expect_exit??0,u=a.exitCode??1;if(u===l)return{stage:Gt,pass:!0,exitCode:0,disposition:"liveness"};let d=String(a.stderr??"").trim()||String(a.stdout??"").trim();return{stage:Gt,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${u}, expected ${l}${d?` \u2014 ${d.slice(0,200)}`:""}`}}function MNe(t,e,r){if(e.kind==="none")return{stage:Gt,pass:!0,exitCode:0,disposition:"na"};if(!r)return{stage:Gt,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 smoke probe skipped"};let n=e.run??[];if(n.length===0)return{stage:Gt,pass:!1,exitCode:2,stderr:"cli smoke probe has no run argv \u2014 skipped"};let[i,...o]=n,s=i.startsWith(".")||i.startsWith("/")?gX(t,i):i,a=_X,c;try{c=Qe(s,[...o],{cwd:t,reject:!1,timeout:a})}catch(p){c=p}let l=Ft(Gt,i,c);if(l)return l;if(c.timedOut)return{stage:Gt,pass:!1,exitCode:1,stderr:`smoke probe '${n.join(" ")}' timed out after ${a}ms`};let u=e.expect?.exit??0,d=c.exitCode??1;if(d!==u){let p=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:Gt,pass:!1,exitCode:1,disposition:"fail",stderr:`smoke probe exited ${d}, expected ${u}${p?` \u2014 ${p.slice(0,200)}`:""}`}}let f=e.expect?.token;return f?String(c.stdout??"").includes(f)?{stage:Gt,pass:!0,exitCode:0,disposition:"pass"}:{stage:Gt,pass:!1,exitCode:1,disposition:"fail",stderr:`smoke probe ran (exit ${d}) but stdout did not contain the AC token ${JSON.stringify(f)}`}:{stage:Gt,pass:!0,exitCode:0,disposition:"liveness"}}var FNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${yX.argv[1]}`;if(FNe){let t=lD();console.log(JSON.stringify(t)),yX.exit(t.exitCode)}Ar();mn();hn();import vX from"node:process";var tw="stage_3.1";function uD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:tw,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Mc(e,o[o.length-1]))return{stage:tw,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Qe(i,[...o],{cwd:e,reject:!1}),a=Ft(tw,i,s);return a||nr(tw,s)}var zNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vX.argv[1]}`;if(zNe){let t=uD();console.log(JSON.stringify(t)),vX.exit(t.exitCode)}sP();dD();fD();Ar();Dp();hn();import wX from"node:process";var iw="stage_2.1";function pD(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=ns("test",t))}catch(a){return{stage:iw,pass:!1,exitCode:1,stderr:a.message}}if(!r||!n)return{stage:iw,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${i}'`};let o=Qe(r,[...n],{cwd:e,reject:!1}),s=Ft(iw,r,o);return s||nr(iw,o)}var qNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wX.argv[1]}`;if(qNe){let t=pD();console.log(JSON.stringify(t)),wX.exit(t.exitCode)}Ar();mn();hn();import xX from"node:process";var ow="stage_3.3";function mD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:ow,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Mc(e,o[o.length-1]))return{stage:ow,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Qe(i,[...o],{cwd:e,reject:!1}),a=Ft(ow,i,s);return a||nr(ow,s)}var BNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xX.argv[1]}`;if(BNe){let t=mD();console.log(JSON.stringify(t)),xX.exit(t.exitCode)}var HNe=new Set(["fail","pending_env","advisory"]);function Aa(t){return HNe.has(t)}function $X(t){return t.disposition??(t.pass?"pass":t.exitCode===2?"skip":"fail")}function kX(t,e){return Aa(e)?t.disposition?1:t.exitCode:0}cP();gD();_D();pf();vv();var DX=$t(rr(),1);import{existsSync as vD,readFileSync as aje,readdirSync as CX,statSync as cje,writeFileSync as lje}from"node:fs";import{basename as Fp,join as zp,relative as RX}from"node:path";var uje=["self-dogfood:","fixture:","derived:"],NX=/\.(test|spec)\.[jt]sx?$/;function jX(t,e=t,r=[]){let n;try{n=CX(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=zp(e,i);try{cje(o).isDirectory()?jX(t,o,r):NX.test(i)&&r.push(o)}catch{continue}}return r}function MX(t="."){let e=zp(t,"spec","features"),r=zp(t,"tests"),n=[],i=[];if(!vD(e)||!vD(r))return{repaired:n,suggested:i};let o=jX(r),s=new Map;for(let a of o){let c=RX(t,a).split("\\").join("/"),l=s.get(Fp(a))??[];l.push(c),s.set(Fp(a),l)}for(let a of CX(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=zp(e,a),l,u;try{l=aje(c,"utf8"),u=(0,DX.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(uje.some(w=>g.startsWith(w)))continue;let v=g.split("#",1)[0];if(vD(zp(t,v)))continue;let _=s.get(Fp(v))??[];if(_.length!==1)continue;let S=g.replace(v,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>Fp(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>RX(t,h).split("\\").join("/")).find(h=>{let g=Fp(h).replace(NX,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),v=l.match(g);if(!v)continue;let _=v[2]+" ";l=l.replace(g,`$1 +`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function _X(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await NNe({port:e,cwd:t.cwd??"."});B("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){B("fail","graph",r.message),process.exit(1)}}var jNe=["stage_1.1","stage_2.1","stage_2.3"];function MNe(t){return(t.features??[]).filter(e=>e.status==="done")}function FNe(t,e){let r=MNe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function bX(t,e){let r=[];for(let n of jNe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=FNe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}Y_();import vX from"node:process";function zNe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function ew(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=zNe(n,t);i.pass||r.push(i)}return r}Hn();var dD="stage_4.1";function fD(t={}){let{cwd:e="."}=t,r=_n(e);if(r.length===0)return{stage:dD,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=ew(r);if(n.length===0)return{stage:dD,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:dD,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var LNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vX.argv[1]}`;if(LNe){let t=fD();console.log(JSON.stringify(t)),vX.exit(t.exitCode)}Ir();import SX from"node:process";var tw="stage_1.4";function pD(t={}){let{cwd:e="."}=t,r;try{r=et("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:tw,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:tw,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:tw,pass:!0,exitCode:0}:{stage:tw,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var UNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${SX.argv[1]}`;if(UNe){let t=pD();console.log(JSON.stringify(t)),SX.exit(t.exitCode)}Ir();Mp();yn();import wX from"node:process";var rw="stage_2.2";function mD(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=ss("coverage",t))}catch(a){return{stage:rw,pass:!1,exitCode:1,stderr:a.message}}if(!r||!n)return{stage:rw,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=et(r,[...n],{cwd:e,reject:!1}),s=zt(rw,r,o);return s||sr(rw,o)}var HNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wX.argv[1]}`;if(HNe){let t=mD();console.log(JSON.stringify(t)),wX.exit(t.exitCode)}Cb();hD();Ir();gn();yn();import $X from"node:process";var iw="stage_3.2";function gD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:iw,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Uc(e,o[o.length-1]))return{stage:iw,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=et(i,[...o],{cwd:e,reject:!1}),a=zt(iw,i,s);return a||sr(iw,s)}var GNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${$X.argv[1]}`;if(GNe){let t=gD();console.log(JSON.stringify(t)),$X.exit(t.exitCode)}Ir();at();yn();import{existsSync as VNe}from"node:fs";import{resolve as kX}from"node:path";import EX from"node:process";var Wt="stage_2.4",AX=5e3;function yD(t={}){let{cwd:e="."}=t,r,n=[],i=!1;try{let f=J(e);r=f.project.deliverable,n=f.project.smoke??[],i=f.features.some(p=>p.status==="done")}catch{return{stage:Wt,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return WNe(e,n[0],i);if(!r)return{stage:Wt,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:Wt,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:Wt,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let o=kX(e,r.path);if(!VNe(o))return{stage:Wt,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let s=r.timeout_ms??AX,a;try{a=et(o,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:s})}catch(f){a=f}let c=zt(Wt,r.path,a);if(c)return c;if(a.timedOut)return{stage:Wt,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${s}ms (hung or too slow)`};let l=r.expect_exit??0,u=a.exitCode??1;if(u===l)return{stage:Wt,pass:!0,exitCode:0,disposition:"liveness"};let d=String(a.stderr??"").trim()||String(a.stdout??"").trim();return{stage:Wt,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${u}, expected ${l}${d?` \u2014 ${d.slice(0,200)}`:""}`}}function WNe(t,e,r){if(e.kind==="none")return{stage:Wt,pass:!0,exitCode:0,disposition:"na"};if(!r)return{stage:Wt,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 smoke probe skipped"};let n=e.run??[];if(n.length===0)return{stage:Wt,pass:!1,exitCode:2,stderr:"cli smoke probe has no run argv \u2014 skipped"};let[i,...o]=n,s=i.startsWith(".")||i.startsWith("/")?kX(t,i):i,a=AX,c;try{c=et(s,[...o],{cwd:t,reject:!1,timeout:a})}catch(p){c=p}let l=zt(Wt,i,c);if(l)return l;if(c.timedOut)return{stage:Wt,pass:!1,exitCode:1,stderr:`smoke probe '${n.join(" ")}' timed out after ${a}ms`};let u=e.expect?.exit??0,d=c.exitCode??1;if(d!==u){let p=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:Wt,pass:!1,exitCode:1,disposition:"fail",stderr:`smoke probe exited ${d}, expected ${u}${p?` \u2014 ${p.slice(0,200)}`:""}`}}let f=e.expect?.token;return f?String(c.stdout??"").includes(f)?{stage:Wt,pass:!0,exitCode:0,disposition:"pass"}:{stage:Wt,pass:!1,exitCode:1,disposition:"fail",stderr:`smoke probe ran (exit ${d}) but stdout did not contain the AC token ${JSON.stringify(f)}`}:{stage:Wt,pass:!0,exitCode:0,disposition:"liveness"}}var KNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${EX.argv[1]}`;if(KNe){let t=yD();console.log(JSON.stringify(t)),EX.exit(t.exitCode)}Ir();gn();yn();import TX from"node:process";var ow="stage_3.1";function _D(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:ow,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Uc(e,o[o.length-1]))return{stage:ow,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=et(i,[...o],{cwd:e,reject:!1}),a=zt(ow,i,s);return a||sr(ow,s)}var JNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${TX.argv[1]}`;if(JNe){let t=_D();console.log(JSON.stringify(t)),TX.exit(t.exitCode)}dP();bD();vD();Ir();Mp();yn();import PX from"node:process";var cw="stage_2.1";function SD(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=ss("test",t))}catch(a){return{stage:cw,pass:!1,exitCode:1,stderr:a.message}}if(!r||!n)return{stage:cw,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${i}'`};let o=et(r,[...n],{cwd:e,reject:!1}),s=zt(cw,r,o);return s||sr(cw,o)}var QNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${PX.argv[1]}`;if(QNe){let t=SD();console.log(JSON.stringify(t)),PX.exit(t.exitCode)}Ir();gn();yn();import RX from"node:process";var lw="stage_3.3";function wD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:lw,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Uc(e,o[o.length-1]))return{stage:lw,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=et(i,[...o],{cwd:e,reject:!1}),a=zt(lw,i,s);return a||sr(lw,s)}var eje=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${RX.argv[1]}`;if(eje){let t=wD();console.log(JSON.stringify(t)),RX.exit(t.exitCode)}var tje=new Set(["fail","pending_env","advisory"]);function Pa(t){return tje.has(t)}function CX(t){return t.disposition??(t.pass?"pass":t.exitCode===2?"skip":"fail")}function DX(t,e){return Pa(e)?t.disposition?1:t.exitCode:0}pP();$D();ED();yf();Sb();var BX=kt(or(),1);import{existsSync as AD,readFileSync as _je,readdirSync as qX,statSync as bje,writeFileSync as vje}from"node:fs";import{basename as Up,join as qp,relative as UX}from"node:path";var Sje=["self-dogfood:","fixture:","derived:"],HX=/\.(test|spec)\.[jt]sx?$/;function ZX(t,e=t,r=[]){let n;try{n=qX(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=qp(e,i);try{bje(o).isDirectory()?ZX(t,o,r):HX.test(i)&&r.push(o)}catch{continue}}return r}function GX(t="."){let e=qp(t,"spec","features"),r=qp(t,"tests"),n=[],i=[];if(!AD(e)||!AD(r))return{repaired:n,suggested:i};let o=ZX(r),s=new Map;for(let a of o){let c=UX(t,a).split("\\").join("/"),l=s.get(Up(a))??[];l.push(c),s.set(Up(a),l)}for(let a of qX(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=qp(e,a),l,u;try{l=_je(c,"utf8"),u=(0,BX.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(Sje.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(AD(qp(t,b)))continue;let _=s.get(Up(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>Up(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>UX(t,h).split("\\").join("/")).find(h=>{let g=Up(h).replace(HX,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 ${_}test_refs: -${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&lje(c,l,"utf8")}return{repaired:n,suggested:i}}Cd();import{existsSync as dje,readFileSync as fje}from"node:fs";import{join as pje}from"node:path";function mje(t,e){let r=pje(t,e);if(!dje(r))return[];let n=[];for(let i of fje(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function FX(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>mje(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function zX(t){let e=[];e.push(`# Spec-conformance oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` -`)}wv();lt();No();Ln();Cd();var hje={ALL_FEATURES_DONE:"All work complete.",MAX_ITERATIONS:"Stopped \u2014 reached the iteration limit.",WALL_CLOCK:"Stopped \u2014 exceeded the time budget.",BUDGET_EXCEEDED:"Stopped \u2014 budget exhausted.",BLOCKED_FEATURE:"Stopped \u2014 a feature is blocked by dependencies.",RETRY_THRESHOLD:"Stopped \u2014 a feature failed too many times.",GATE_NO_PROGRESS:"Stopped \u2014 gates are not making progress.",HUMAN_REQUIRED:"Paused \u2014 needs human sign-off.",TRANSPORT_AUTH_FAILED:"Stopped \u2014 agent rejected the credentials. Check your API key.",TRANSPORT_RATE_LIMITED:"Stopped \u2014 agent is rate-limited. Try again after the cooldown.",TRANSPORT_NETWORK:"Stopped \u2014 could not reach the agent over the network.",LLM_UNAVAILABLE:"Stopped \u2014 could not reach the agent.",UNCAUGHT_ERROR:"Stopped \u2014 unexpected error."},gje={"stage_1.1":"Type","stage_1.2":"Lint","stage_1.3":"Drift","stage_1.4":"Commit","stage_1.5":"Architecture","stage_1.6":"Secret","stage_2.1":"Unit tests","stage_2.2":"Coverage","stage_2.3":"Spec conformance","stage_2.4":"Deliverable smoke","stage_3.1":"Smoke","stage_3.2":"Performance","stage_3.3":"Visual","stage_4.1":"Audit","stage_4.2":"UAT"};function bD(t,e){let r=e.features.find(n=>n.id===t);return r&&r.title?r.title:t}function LX(t,e){let r=hje[t.class]??"Stopped.",n=yje(t.detail,e);return n?`${r} ${n}`:r}function fw(t){return gje[t]??t}function yje(t,e){return t?t.replace(/\bF-\d{3,}\b/g,r=>{let n=bD(r,e);return n===r?r:`"${n}"`}):""}var UX=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"];function _je(t,e,r){if(e.startsWith("stage_4")){let n=gn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return JS(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function vje(t,e,r){let n=t.modules??[];if(t.status!=="done"||n.length===0)return"\xB7";if(e===null)return"-";let i=e.get(t.id);return i===void 0?"!":i===Rd(r,n)?"\u2713":"!"}function qX(t,e=".",r={}){let n=r.internal??!1,i=gc(e),o=[...UX.map(l=>n?l.replace("stage_",""):bje(l)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,c=t.features.map(l=>({featureId:l.id,title:l.title||l.id,cells:[...UX.map(u=>_je(l,u,e)),vje(l,i,e)]})).map(l=>{let u=l.cells.join(" ");return n?`${l.featureId.padEnd(12)} ${u} ${l.title}`:`${l.title.padEnd(35).slice(0,35)} ${u}`});return[s,...c].join(` -`)}function bje(t){return fw(t).slice(0,3)}async function RZe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Hse(),Bse)),Promise.resolve().then(()=>(Kse(),Wse)),Promise.resolve().then(()=>(If(),HJ))]),i=e({cwd:t.cwd});n(i.server);let o=new r;K.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function CZe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await zY({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});for(let o of n.created)H("pass",`created ${o}`);for(let o of n.skipped)H("skip",o);for(let o of n.proposals??[])H("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(H("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){K.stdout.write(` +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&vje(c,l,"utf8")}return{repaired:n,suggested:i}}Md();import{existsSync as wje,readFileSync as xje}from"node:fs";import{join as $je}from"node:path";function kje(t,e){let r=$je(t,e);if(!wje(r))return[];let n=[];for(let i of xje(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function VX(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>kje(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function WX(t){let e=[];e.push(`# Spec-conformance oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` +`)}$b();at();zo();Hn();Md();var Eje={ALL_FEATURES_DONE:"All work complete.",MAX_ITERATIONS:"Stopped \u2014 reached the iteration limit.",WALL_CLOCK:"Stopped \u2014 exceeded the time budget.",BUDGET_EXCEEDED:"Stopped \u2014 budget exhausted.",BLOCKED_FEATURE:"Stopped \u2014 a feature is blocked by dependencies.",RETRY_THRESHOLD:"Stopped \u2014 a feature failed too many times.",GATE_NO_PROGRESS:"Stopped \u2014 gates are not making progress.",HUMAN_REQUIRED:"Paused \u2014 needs human sign-off.",TRANSPORT_AUTH_FAILED:"Stopped \u2014 agent rejected the credentials. Check your API key.",TRANSPORT_RATE_LIMITED:"Stopped \u2014 agent is rate-limited. Try again after the cooldown.",TRANSPORT_NETWORK:"Stopped \u2014 could not reach the agent over the network.",LLM_UNAVAILABLE:"Stopped \u2014 could not reach the agent.",UNCAUGHT_ERROR:"Stopped \u2014 unexpected error."},Aje={"stage_1.1":"Type","stage_1.2":"Lint","stage_1.3":"Drift","stage_1.4":"Commit","stage_1.5":"Architecture","stage_1.6":"Secret","stage_2.1":"Unit tests","stage_2.2":"Coverage","stage_2.3":"Spec conformance","stage_2.4":"Deliverable smoke","stage_3.1":"Smoke","stage_3.2":"Performance","stage_3.3":"Visual","stage_4.1":"Audit","stage_4.2":"UAT"};function TD(t,e){let r=e.features.find(n=>n.id===t);return r&&r.title?r.title:t}function KX(t,e){let r=Eje[t.class]??"Stopped.",n=Tje(t.detail,e);return n?`${r} ${n}`:r}function gw(t){return Aje[t]??t}function Tje(t,e){return t?t.replace(/\bF-\d{3,}\b/g,r=>{let n=TD(r,e);return n===r?r:`"${n}"`}):""}var JX=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"];function Oje(t,e,r){if(e.startsWith("stage_4")){let n=_n(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return ew(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function Ije(t,e,r){let n=t.modules??[];if(t.status!=="done"||n.length===0)return"\xB7";if(e===null)return"-";let i=e.get(t.id);return i===void 0?"!":i===jd(r,n)?"\u2713":"!"}function YX(t,e=".",r={}){let n=r.internal??!1,i=vc(e),o=[...JX.map(l=>n?l.replace("stage_",""):Pje(l)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,c=t.features.map(l=>({featureId:l.id,title:l.title||l.id,cells:[...JX.map(u=>Oje(l,u,e)),Ije(l,i,e)]})).map(l=>{let u=l.cells.join(" ");return n?`${l.featureId.padEnd(12)} ${u} ${l.title}`:`${l.title.padEnd(35).slice(0,35)} ${u}`});return[s,...c].join(` +`)}function Pje(t){return gw(t).slice(0,3)}async function BZe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Qse(),Xse)),Promise.resolve().then(()=>(iae(),nae)),Promise.resolve().then(()=>(Cf(),QJ))]),i=e({cwd:t.cwd});n(i.server);let o=new r;K.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function HZe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await WY({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});for(let o of n.created)B("pass",`created ${o}`);for(let o of n.skipped)B("skip",o);for(let o of n.proposals??[])B("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(B("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){K.stdout.write(` \u{1F4A1} \uB2E4\uC74C \uC815\uBCF4\uAC00 \uC788\uC73C\uBA74 \uB354 \uC815\uD655\uD55C \uC2A4\uD399\uC774 \uB429\uB2C8\uB2E4: `);for(let[o,s]of n.clarifyingQuestions.entries())K.stdout.write(` ${o+1}. ${s} `);K.stdout.write(` @@ -723,30 +723,30 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&lje(c,l,"u `),K.stdout.write(` \uC608: clad init \uACB0\uC81C SaaS for B2B `),K.stdout.write(` \uAE30\uC874 seeds \uB294 .cladding/scan/*.proposal \uB85C \uBD84\uAE30\uB429\uB2C8\uB2E4. -`));K.exit(0)}async function DZe(t,e){H("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(bae(),vae)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)H(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),K.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=J(e.cwd??"."),a=n.featuresTouched.map(l=>bD(l,s)),c=`${LX(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;H(i,"run",c),a.length>0&&K.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&H("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),K.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function NZe(t={}){try{let e=J(),r=Ho(".");Bc(".",r),aa("."),l3(".");let n=MX(".");for(let o of n.repaired)H("note","test_refs",`repaired ${o.from} \u2192 ${o.to} (${o.shard})`);for(let o of n.suggested)H("note","test_refs",`suggested ${o.ref} (${o.shard}) \u2014 confirm by removing the 'derived:' prefix`);let i=dw(".");if(i&&H("note","deliverable",`auto-detected entry '${i.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`),t.proposeArchive){let s=$v.run({cwd:"."}).filter(a=>a.suggestion?.action==="propose-archive");if(s.length===0){H("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),K.exit(0);return}for(let a of s){let c=a.suggestion?.args??{},l=String(c.featureId??"?"),u=String(c.reason??a.message);H("note",`propose-archive \xB7 ${l}`,u)}H("pass","sync",`${e.features.length} features \xB7 ${s.length} archive candidate(s)`),K.exit(0);return}H("pass","sync",`${e.features.length} features valid`),K.exit(0)}catch(e){H("fail","sync",e.message),K.exit(1)}}function jZe(t){if(!t){H("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),K.exit(2);return}let e=sw(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";H("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),K.exit(0)}function MZe(t,e={}){if(!t){H("fail","rollback","feature id required (e.g. clad rollback F-001)"),K.exit(2);return}let r=aw(".",t);if(!r){H("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),K.exit(1);return}cw(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";H("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?K.stdout.write(`Run: git checkout ${r.gitHead} +`));K.exit(0)}async function ZZe(t,e){B("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Oae(),Tae)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)B(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),K.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=J(e.cwd??"."),a=n.featuresTouched.map(l=>TD(l,s)),c=`${KX(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;B(i,"run",c),a.length>0&&K.stdout.write(`Touched: ${a.join(", ")} +`)}let o=n.stubsCreated.length>0;o&&B("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),K.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function GZe(t={}){try{let e=J(),r=Wo(".");Vc(".",r),da("."),y3(".");let n=GX(".");for(let o of n.repaired)B("note","test_refs",`repaired ${o.from} \u2192 ${o.to} (${o.shard})`);for(let o of n.suggested)B("note","test_refs",`suggested ${o.ref} (${o.shard}) \u2014 confirm by removing the 'derived:' prefix`);let i=hw(".");if(i&&B("note","deliverable",`auto-detected entry '${i.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`),t.proposeArchive){let s=Eb.run({cwd:"."}).filter(a=>a.suggestion?.action==="propose-archive");if(s.length===0){B("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),K.exit(0);return}for(let a of s){let c=a.suggestion?.args??{},l=String(c.featureId??"?"),u=String(c.reason??a.message);B("note",`propose-archive \xB7 ${l}`,u)}B("pass","sync",`${e.features.length} features \xB7 ${s.length} archive candidate(s)`),K.exit(0);return}B("pass","sync",`${e.features.length} features valid`),K.exit(0)}catch(e){B("fail","sync",e.message),K.exit(1)}}function VZe(t){if(!t){B("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),K.exit(2);return}let e=uw(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";B("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),K.exit(0)}function WZe(t,e={}){if(!t){B("fail","rollback","feature id required (e.g. clad rollback F-001)"),K.exit(2);return}let r=dw(".",t);if(!r){B("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),K.exit(1);return}fw(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";B("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?K.stdout.write(`Run: git checkout ${r.gitHead} `):K.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),K.exit(0)}async function FZe(t){let e=await U1({force:t.force,quiet:t.quiet});K.exit(e.errors.length>0?1:0)}async function zZe(){H("note","update","reconciling the current project after the engine upgrade");let t=await uJ(".",{wireHosts:async()=>(await U1({quiet:!0})).errors.length});if(H(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){H("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),K.exit(t.code);return}H("pass","spec",`inventory synced \xB7 ${t.features} features`),H(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),H(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)H("note","deprecated",r);K.stdout.write(` +`),K.exit(0)}async function KZe(t){let e=await W1({force:t.force,quiet:t.quiet});K.exit(e.errors.length>0?1:0)}async function JZe(){B("note","update","reconciling the current project after the engine upgrade");let t=await bJ(".",{wireHosts:async()=>(await W1({quiet:!0})).errors.length});if(B(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){B("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),K.exit(t.code);return}B("pass","spec",`inventory synced \xB7 ${t.features} features`),B(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),B(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)B("note","deprecated",r);K.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),O2({tier:"pre-commit",strict:!0}).anyFailed?K.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):H("pass","drift","clean against the stricter detectors"),K.exit(t.code)}var LZe={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function O2(t){let e=t.tier??"all",r=LZe[e];if(!r)return t.json?K.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):H("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0};let n={focusModules:t.focusModules},o=[["stage_1.1",()=>jp(n)],["stage_1.2",()=>Np(n)],["stage_1.3",()=>ro({...n,strict:t.strict})],["stage_1.4",oD],["stage_1.5",na],["stage_1.6",$f],["stage_2.1",()=>pD(n)],["stage_2.2",()=>sD(n)],["stage_2.3",oP],["stage_2.4",lD],["stage_3.1",uD],["stage_3.2",cD],["stage_3.3",mD],["stage_4.1",iD],["stage_4.2",Mp]].filter(([u])=>r.includes(u)),s=0,a=!1,c=u=>u==="pass"?"pass":u==="liveness"?"note":u==="na"?"skip":Aa(u)?"fail":"skip",l=[];for(let[u,d]of o){let f=d({}),p=t.internal?u:fw(u),m=$X(f);Aa(m)&&(a=!0,s=Math.max(s,kX(f,m))),l.push({stage:u,label:p,status:m,exitCode:f.exitCode,stderr:f.stderr,findings:f.findings}),t.json||(H(c(m),p),Aa(m)&&WZe(f))}if(t.strict)try{let u=J();for(let d of uX(u,l))s=Math.max(s,1),a=!0,l.push({stage:d.stage,label:d.label,status:"fail",exitCode:1,stderr:d.message}),t.json||H("fail",d.label,d.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let u=l.find(m=>m.stage==="stage_1.3"),d=(u?.findings??[]).filter(m=>m.severity==="error"||m.severity==="warn"),f=u?.status==="fail"&&d.length>0&&d.every(m=>m.detector==="STALE_ATTESTATION"),p=l.every(m=>m.stage==="stage_1.3"||!Aa(m.status));if(f&&p&&u&&(u.status="pass",u.exitCode=0,u.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",a=l.some(m=>Aa(m.status)),s=a?Math.max(1,s):0,t.json||H("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!a)try{p6(".",J())&&(t.json||H("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json?K.stdout.write(`${JSON.stringify({tier:e,worst:s,anyFailed:a,stages:l},null,2)} -`):a&&K.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),Zi(".","gate_run",{tier:e,strict:t.strict===!0,worst:s,anyFailed:a}),{worst:s,anyFailed:a}}function UZe(t){try{let e=J(),r=xl(e,t);K.stdout.write(`${JSON.stringify(r,null,2)} -`),K.exit("not_found"in r?1:0)}catch(e){H("fail","context",e.message),K.exit(1)}}function qZe(t,e={}){try{let r=J(),n=e.depth!==void 0?Number(e.depth):void 0,i=gi(r,t,{depth:n});K.stdout.write(`${JSON.stringify(i,null,2)} -`),K.exit("not_found"in i?1:0)}catch(r){H("fail","impact",r.message),K.exit(1)}}function BZe(t={}){try{let e=J(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Iv(e,o=>{try{return wae(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});K.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),K.exit(0)}catch(e){H("fail","infer-deps",e.message),K.exit(1)}}function HZe(t={}){try{let e=J(),n=JY(e,i=>{try{return wae(i,"utf8")}catch{return null}},".");if(t.json)K.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let i=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${n.context.medianSliceTokens} tok vs naive ${n.context.medianNaiveTokens} tok = ${n.context.medianShrinkFactor}x smaller (median)`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`," (deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"];K.stdout.write(`${i.join(` +`),M2({tier:"pre-commit",strict:!0}).anyFailed?K.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):B("pass","drift","clean against the stricter detectors"),K.exit(t.code)}var YZe={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function M2(t){let e=t.tier??"all",r=YZe[e];if(!r)return t.json?K.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):B("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0};let n={focusModules:t.focusModules},o=[["stage_1.1",()=>zp(n)],["stage_1.2",()=>Fp(n)],["stage_1.3",()=>so({...n,strict:t.strict})],["stage_1.4",pD],["stage_1.5",aa],["stage_1.6",Tf],["stage_2.1",()=>SD(n)],["stage_2.2",()=>mD(n)],["stage_2.3",uP],["stage_2.4",yD],["stage_3.1",_D],["stage_3.2",gD],["stage_3.3",wD],["stage_4.1",fD],["stage_4.2",Lp]].filter(([u])=>r.includes(u)),s=0,a=!1,c=u=>u==="pass"?"pass":u==="liveness"?"note":u==="na"?"skip":Pa(u)?"fail":"skip",l=[];for(let[u,d]of o){let f=d({}),p=t.internal?u:gw(u),m=CX(f);Pa(m)&&(a=!0,s=Math.max(s,DX(f,m))),l.push({stage:u,label:p,status:m,exitCode:f.exitCode,stderr:f.stderr,findings:f.findings}),t.json||(B(c(m),p),Pa(m)&&oGe(f))}if(t.strict)try{let u=J();for(let d of bX(u,l))s=Math.max(s,1),a=!0,l.push({stage:d.stage,label:d.label,status:"fail",exitCode:1,stderr:d.message}),t.json||B("fail",d.label,d.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let u=l.find(m=>m.stage==="stage_1.3"),d=(u?.findings??[]).filter(m=>m.severity==="error"||m.severity==="warn"),f=u?.status==="fail"&&d.length>0&&d.every(m=>m.detector==="STALE_ATTESTATION"),p=l.every(m=>m.stage==="stage_1.3"||!Pa(m.status));if(f&&p&&u&&(u.status="pass",u.exitCode=0,u.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",a=l.some(m=>Pa(m.status)),s=a?Math.max(1,s):0,t.json||B("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!a)try{S6(".",J())&&(t.json||B("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json?K.stdout.write(`${JSON.stringify({tier:e,worst:s,anyFailed:a,stages:l},null,2)} +`):a&&K.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),Ki(".","gate_run",{tier:e,strict:t.strict===!0,worst:s,anyFailed:a}),{worst:s,anyFailed:a}}function XZe(t){try{let e=J(),r=Tl(e,t);K.stdout.write(`${JSON.stringify(r,null,2)} +`),K.exit("not_found"in r?1:0)}catch(e){B("fail","context",e.message),K.exit(1)}}function QZe(t,e={}){try{let r=J(),n=e.depth!==void 0?Number(e.depth):void 0,i=bn(r,t,{depth:n});K.stdout.write(`${JSON.stringify(i,null,2)} +`),K.exit("not_found"in i?1:0)}catch(r){B("fail","impact",r.message),K.exit(1)}}function eGe(t={}){try{let e=J(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Rb(e,o=>{try{return Pae(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});K.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),K.exit(0)}catch(e){B("fail","infer-deps",e.message),K.exit(1)}}function tGe(t={}){try{let e=J(),n=sX(e,i=>{try{return Pae(i,"utf8")}catch{return null}},".");if(t.json)K.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let i=n.context,o=i.truncatedCount>0?`budget enforces ${i.medianShrinkTruncated}x on ${i.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",s=i.fitsCount>0?`${i.medianShrinkFit}x on ${i.fitsCount} fitting`:"none fit untruncated",a=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${i.medianSliceTokens} tok vs naive ${i.medianNaiveTokens} tok \u2014 ${o}, ${s}`,` uncapped structural slice = ${i.medianStructuralRatio}x of naive \u2014 the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`," (deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"];K.stdout.write(`${a.join(` `)} -`)}K.exit(0)}catch(e){H("fail","measure",e.message),K.exit(1)}}function ZZe(t){let e;if(t.feature)try{let n=(J().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(H("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),K.exit(1)),e=n.modules}catch(r){H("fail","check",r.message),K.exit(1)}K.exit(O2({...t,focusModules:e}).worst)}function GZe(t){let e=v6(".",t,{checkStages:O2,onIndex:aa});H(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),K.exit(e.code)}function VZe(t,e={}){let r=e.cwd??".",n;try{n=J(r)}catch(o){H("fail","oracle",`spec not loaded: ${o.message}`),K.exit(1);return}if(e.required){t&&K.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=p3(n);if(o.length===0){K.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`)}K.exit(0)}catch(e){B("fail","measure",e.message),K.exit(1)}}function rGe(t){let e;if(t.feature)try{let n=(J().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(B("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),K.exit(1)),e=n.modules}catch(r){B("fail","check",r.message),K.exit(1)}K.exit(M2({...t,focusModules:e}).worst)}function nGe(t){let e=A6(".",t,{checkStages:M2,onIndex:da});B(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),K.exit(e.code)}function iGe(t,e={}){let r=e.cwd??".",n;try{n=J(r)}catch(o){B("fail","oracle",`spec not loaded: ${o.message}`),K.exit(1);return}if(e.required){t&&K.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=S3(n);if(o.length===0){K.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),K.exit(0);return}let s=o.filter(a=>!a.hasOracle);for(let a of o){let c=a.hasOracle?"\u2713":"\xB7",l=a.hasOracle?"":" \u2190 needs an impl-blind oracle";K.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}K.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),K.exit(s.length>0?1:0);return}if(!t){H("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),K.exit(1);return}let i=FX(n,t,e.ac,r);if(!i||i.acs.length===0){H("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),K.exit(1);return}K.stdout.write(`${zX(i)} -`),K.exit(0)}function WZe(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=i.path?` ${i.path}`:"";K.stdout.write(` [${i.detector}]${o} \u2014 ${Sae(i.message,140)} +`),K.exit(s.length>0?1:0);return}if(!t){B("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),K.exit(1);return}let i=VX(n,t,e.ac,r);if(!i||i.acs.length===0){B("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),K.exit(1);return}K.stdout.write(`${WX(i)} +`),K.exit(0)}function oGe(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=i.path?` ${i.path}`:"";K.stdout.write(` [${i.detector}]${o} \u2014 ${Iae(i.message,140)} `)}n.length>3&&K.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&K.stdout.write(` ${Sae(e.trim(),160)} -`)}}function Sae(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function KZe(t){let e=J();K.stdout.write(`${qX(e,".",{internal:t.internal})} -`),K.exit(0)}function JZe(t){let e=Qk(t);H("note",`route \u2192 ${e}`,t),K.exit(e==="unknown"?1:0)}var YZe={refine:"clarify",panel:"status",drive:"run"};function XZe(t){let e=t?YZe[t]:void 0;e&&K.stderr.write(`cladding: '${t}' is now '${e}' \u2014 the old verb is removed in 0.7 -`)}function QZe(){let t=new B2;t.name("clad").description("Reference Ironclad CLI").version("0.7.0"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init \uACB0\uC81C SaaS for B2B`) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").action(CZe),t.command("run [goal]").alias("drive").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(DZe),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(NZe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(FZe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(zZe),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(ZZe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(jZe),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(GZe),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>VZe(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(MZe),t.command("status").alias("panel").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").action(KZe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(UZe),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>qZe(r,n)),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>BZe(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full per-feature report as JSON").action(r=>HZe(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>aX(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>cX()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{lX(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").action(r=>a6(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(JZe),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(nJ),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(RZe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").action(g6),t.command("clarify [answer...]").alias("refine").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, e.g. `clad clarify \uBC95\uC778 \uC0AC\uC5C5\uC790\uB9CC`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(ZY),t}var eGe=!!globalThis.__CLADDING_BUNDLED,tGe=eGe||import.meta.url===`file://${K.argv[1]}`;tGe&&(XZe(K.argv[2]),QZe().parse());export{YZe as RENAMED_VERBS,LZe as TIER_STAGES,QZe as createProgram,XZe as printVerbDeprecationNotice,ZZe as runCheckCommand,O2 as runCheckStages,jZe as runCheckpointCommand,UZe as runContextCommand,GZe as runDoneCommand,qZe as runImpactCommand,BZe as runInferDepsCommand,CZe as runInitCommand,HZe as runMeasureCommand,VZe as runOracleCommand,MZe as runRollbackCommand,JZe as runRouteCommand,DZe as runRunCommand,RZe as runServeCommand,FZe as runSetupCommand,KZe as runStatusCommand,NZe as runSyncCommand,zZe as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&K.stdout.write(` ${Iae(e.trim(),160)} +`)}}function Iae(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function sGe(t){let e=J();K.stdout.write(`${YX(e,".",{internal:t.internal})} +`),K.exit(0)}function aGe(t){let e=nE(t);B("note",`route \u2192 ${e}`,t),K.exit(e==="unknown"?1:0)}var cGe={refine:"clarify",panel:"status",drive:"run"};function lGe(t){let e=t?cGe[t]:void 0;e&&K.stderr.write(`cladding: '${t}' is now '${e}' \u2014 the old verb is removed in 0.8 +`)}function uGe(){let t=new Y2;t.name("clad").description("Reference Ironclad CLI").version("0.7.0"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init \uACB0\uC81C SaaS for B2B`) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").action(HZe),t.command("run [goal]").alias("drive").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(ZZe),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(GZe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(KZe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(JZe),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(rGe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(VZe),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(nGe),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>iGe(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(WZe),t.command("status").alias("panel").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").action(sGe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(XZe),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>QZe(r,n)),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>eGe(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full per-feature report as JSON").action(r=>tGe(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>gX(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>yX()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{_X(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").action(r=>h6(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(aGe),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(fJ),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(BZe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").action($6),t.command("clarify [answer...]").alias("refine").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, e.g. `clad clarify \uBC95\uC778 \uC0AC\uC5C5\uC790\uB9CC`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(eX),t}var dGe=!!globalThis.__CLADDING_BUNDLED,fGe=dGe||import.meta.url===`file://${K.argv[1]}`;fGe&&(lGe(K.argv[2]),uGe().parse());export{cGe as RENAMED_VERBS,YZe as TIER_STAGES,uGe as createProgram,lGe as printVerbDeprecationNotice,rGe as runCheckCommand,M2 as runCheckStages,VZe as runCheckpointCommand,XZe as runContextCommand,nGe as runDoneCommand,QZe as runImpactCommand,eGe as runInferDepsCommand,HZe as runInitCommand,tGe as runMeasureCommand,iGe as runOracleCommand,WZe as runRollbackCommand,aGe as runRouteCommand,ZZe as runRunCommand,BZe as runServeCommand,KZe as runSetupCommand,sGe as runStatusCommand,GZe as runSyncCommand,JZe as runUpdateCommand}; diff --git a/scripts/build.mjs b/scripts/build.mjs index c260e088..861f9b74 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -87,7 +87,9 @@ await build({ format: 'iife', outfile: 'dist/viewer/app.js', minify: true, - legalComments: 'none', + // The viewer vendors three.js — its MIT notice must ride the bundle + // ('none' stripped it, a license violation for a distributed artifact). + legalComments: 'eof', }); copyFileSync('src/graph/viewer/styles.css', 'dist/viewer/styles.css'); const viewerCount = 2; diff --git a/spec.yaml b/spec.yaml index e84f4682..36794313 100644 --- a/spec.yaml +++ b/spec.yaml @@ -53,4 +53,4 @@ inventory: scenarios: 2 capabilities: 6 test_files: 170 - last_synced: "2026-07-01" + last_synced: "2026-07-02" diff --git a/spec/_doc-links.yaml b/spec/_doc-links.yaml index ed81bc59..b71e183b 100644 --- a/spec/_doc-links.yaml +++ b/spec/_doc-links.yaml @@ -8,10 +8,16 @@ docs: doc_links: ["docs/code-style.md"] "docs/glossary.md": features: [F-1d23a6, F-7ce18e, F-b84c38] + "docs/knowledge-graph/design.md": + features: [F-02343cd1, F-64a5c159, F-77f7ead0] + "docs/multi-provider-roadmap.md": + features: [F-049, F-068, F-069, F-070, F-071, F-072, F-073, F-074, F-075] "docs/project-context.md": features: [F-4db939, F-ba2e05] doc_links: ["docs/ab-evaluation/README.md", "docs/ssot-model.md", "docs/ssot-testing.md"] "docs/ssot-audit.md": features: [F-a4b512, F-f44d1b, F-f6d13e] + "docs/ssot-model.md": + features: [F-001] "docs/ssot-testing.md": doc_links: ["docs/ssot-model.md"] diff --git a/spec/attestation.yaml b/spec/attestation.yaml index e1fdf1df..74baed6a 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -28,7 +28,7 @@ attested: F-020: 2c5f4a94e3e57e9b F-021: 8a1a82a59a1c45c7 F-022: 8f596a1c737f6d42 - F-02343cd1: 77875ee09a7ea3bf + F-02343cd1: 578290b9ec320991 F-023: 0c14948e5a91bb0f F-024: f67a86816b06f8ee F-025: 187339b684896b8e @@ -46,17 +46,17 @@ attested: F-037: 7f811c5c8bc0e8e3 F-038: 1338100beadb15a6 F-039: 2e60f3d899b72d7f - F-040: f678671ad6613fd8 + F-040: fb89f810140a4a91 F-041: cddb50fc41e49066 F-042: d1f661281bb9fb6e F-043: 2c5f4a94e3e57e9b - F-044: 2f5ee0e3cee5f762 + F-044: e6e44528a461c0f5 F-045: b494c9a80442ac20 F-046: 4b563fce74b6bb4b F-047: baf5a2dbb9bb5a4b - F-048: 30dcf0786717f873 - F-049: 444a75986c1c3430 - F-051: 1c6cf231cc139640 + F-048: 2b7e21a3ed5c32b6 + F-049: 46e2ac1a6cce6a91 + F-051: 098fd3879abffe4d F-052: 61e043371b9f7c71 F-053: 13a90cd08aec07ae F-054: 5f5d30500bd8cd7f @@ -68,134 +68,134 @@ attested: F-060: 96dc261212a0dd3d F-061: c16123610e8fe7fc F-062: 0ab83282a7f7b1ef - F-063: 76a719993cc71fa8 - F-064: e176668e53f61c6e + F-063: d1aa5d1a0e591012 + F-064: 231f01f694cb46b5 F-065: e6ed3ef916201947 - F-066: 512896be3294c6e4 + F-066: b5de473db7a89eff F-067: 6e6dbd05bf314b56 F-068: 058091774fa65ef8 F-069: 9cf62671c6057a36 - F-06dfdad6: cec2318015dfa5bf + F-06dfdad6: 40a338458a879a3d F-070: e50bb5d3addc7720 F-071: 3183a483a8015d4c F-072: 44e1d39139c816cc - F-073: 47be139281e7940a - F-074: a4cc2b9bf66c77ac - F-075: f8242e8d7fdc0488 + F-073: 94a40afd6119e9aa + F-074: 086d43ceef38da3f + F-075: 4d8346cb6a1bbd14 F-076: 0061ab2d4b4991a8 F-077: 7aac44757146b695 F-078: c6af3d128b98f4e6 - F-079: eaa08d9aeeb2a263 + F-079: aa032a8dc1704024 F-080: 1c19da74d32894e6 F-081: 248f9660cfb1b02b F-098d3b: 42d61bf806ce462b - F-09d68b: dca7938bcf6fa47e + F-09d68b: 378483eabe4ee4d8 F-0ed2db: f94e2f45a16ff99c - F-0f2984d0: b852882d00177ef9 + F-0f2984d0: a85294b0b4128d5d F-12d740: 84ad71574d306c81 F-15999130: 894b484b7a93690c - F-16138071: c8b73555d47cfdd7 + F-16138071: 12d9c7b057fea527 F-16746b: 2f98a1261b9b1fc2 F-17df0a: 915d13b33258d3fc F-18e951: d907c170a230e052 - F-1c9166: c72ece4c25cc4748 - F-1d23a6: 8edadd4a7f136330 + F-1c9166: 09dad0dc6b0be87d + F-1d23a6: 1a236a840d631afb F-1edb38: 64283112a3ab96ce - F-24062d: 7d0f890c1b7c68d0 + F-24062d: 7b14f2aef3ceee4d F-245bd5: a8372aeb83acc411 - F-2be3e3bb: b852882d00177ef9 + F-2be3e3bb: a85294b0b4128d5d F-2de65d: 84ad71574d306c81 F-315fd7: c3b042c80fa7c187 F-31eeb8: d88a9880d29ae411 - F-32b1e0: 9b29e21313d121b1 + F-32b1e0: 9792422c1c008207 F-3788c2: af9778dea8687b29 F-37b4a8: e067655bad681488 - F-3a5339: b2b2ea8775f99267 + F-3a5339: 0dfdeec23abfa841 F-3b3690: 6a36aad282d36f3a F-40327b: 8295358f7b813c8a - F-417ff0: 0cc5eeefc5e08377 + F-417ff0: dde21c2716b745dc F-42af48: 7702447a407758a1 F-43d8e3: bbea25941e2b675d F-4747ef: c255a18b6849d002 F-4db939: b2c386ca4e18c117 F-50ff43: fac674314685a912 - F-551a1c: 305488fada044107 - F-569f4b37: 6ad74b9c3113817a - F-56abaa: a8863eff906b4d73 - F-570a3f: 3f60012b22c9b715 + F-551a1c: 30bb1ad68313708f + F-569f4b37: b65f8d46b6e57af7 + F-56abaa: 34257a997efcb048 + F-570a3f: d424bb82a591d619 F-59f093: 26735424fba6308c - F-5b188856: 92b72281c248eba3 - F-5b9f9f: 0b972209be8b642f + F-5b188856: d1e2e4184aa76c12 + F-5b9f9f: dcc903a25cdfe77f F-5d3ed2: 9452eac28760fb99 F-5f6b45: 15323c4f5b619de7 - F-64a5c159: adedb516a257c7ec + F-64a5c159: a14622fa5f30f985 F-65814a: 2136c8b8c94ef535 - F-67d2e9: 03dc30dc995da728 - F-67e33f: c8f84d2f7b3971aa + F-67d2e9: ad7a8fe2939cd13c + F-67e33f: 77f9d583176bb4f2 F-6d943d: e02e71ed007aded2 F-6f80e7: 0c0e5b71ae22cc26 F-7076f7: 7e819e0d440f3ffe - F-7794a6bc: 4d075a1a19bf4ba5 - F-77f7ead0: 3f8cd4feeece1abd + F-7794a6bc: 1eb3a1bcee7017dc + F-77f7ead0: 4fd1ec36a5726fe9 F-78b50d: 688e6afe2352a034 F-7afbd4: 18ce48352bee0fce - F-7ce18e: 42fe8057bc8e250b + F-7ce18e: 7effa760a0661b6a F-7fa4a7: 19b7709a0b2202e3 - F-80d19d: 6e03a098269ce4c3 - F-836a90: a0d57b88aafbe6e8 + F-80d19d: 4988733647f7777d + F-836a90: 2397ddde473a959a F-8f419e: f3473746f4e252bc - F-904495a5: 56b5bb4bf3c35ddf - F-9064ff: b586e3aa6bc24aac + F-904495a5: 2edac28aac267ee6 + F-9064ff: 9efbbb6021aadfb9 F-94dda4: 8dfb0267c45534f9 - F-95a096: 4c7b844669411617 - F-96250595: 846ab496e40cdd48 + F-95a096: 29bc5fbffce6f117 + F-96250595: c095846f30f2eb0e F-96700032: 5ae97b4c82c14acc F-99c6e5: 8a8724852f1d6059 F-9a3b61: 786eeefef2d25138 - F-9b643e: 1c68e95890f2671e - F-9d168287: 6a3dc163c77b9e15 + F-9b643e: b0672cf024eacf79 + F-9d168287: 34d2194d7ab98cf5 F-a04cd9: e65d87671306d305 F-a4b512: d136f2a1bbc4383a - F-a5228c: 4a9f641497c37b67 + F-a5228c: aaf1d6876a5c7221 F-aa7197: 7f561e4f3c902716 F-ae61c1: 7c3c8622e5375754 F-aee1da: a6d7525a6c547877 F-aee61f: e009b9eb07addd30 - F-af45042a: 9c61ca116a28cbb6 - F-af96b1: e75ca2cb3412a7a5 + F-af45042a: 17c898c92c9ac27e + F-af96b1: 108264660d611b56 F-b2094740: f379bf4feef6771a F-b43066: 9402b630adcf1eae F-b61449: 7095ce00662e987d - F-b84c38: 61a41c3f765e8a92 - F-b99577: b3de7411ed1f21aa + F-b84c38: 0fe2398b9a9bf903 + F-b99577: e4d31fc716849096 F-ba2e05: 158e77c8af32514a F-ba4b7a: c282e0e915ed547c - F-bb15e6: 9b629bd8910007fa + F-bb15e6: c8884a476d268166 F-bd07d7: 4bf7e1baddf5d754 - F-bdcd90: 826853f7885a5a08 - F-c037ae: 6a58cdcfd0474e5f - F-c2c996: 5c73fa010b1502fa - F-c48eb2: 6a581a63e255c279 + F-bdcd90: 1fd023791a264f34 + F-c037ae: 1d498809c898760d + F-c2c996: c92ab5bb0fbd1367 + F-c48eb2: 9358d7394e88e95c F-c4c5ae: 18200d79542ae22e F-c8aef8: 02e07f929a1d0ded F-cd0415: 9cf6ce40e2a8b381 F-cfba0c: 077c03b8a96f562b F-d12edf: c19aa5d1007e0b8f - F-d2c806: b3d8668905855a6c + F-d2c806: 5aa60f71bbd0a136 F-d3bde4: 915d13b33258d3fc - F-d49585: 11e3ac2dce796fc6 - F-d6b93648: f755a47c66e07635 - F-d7312b: 000237d094145b6a + F-d49585: f3ef2fc02122533a + F-d6b93648: 065d493eb44c4b7b + F-d7312b: 9b7db1624caf7302 F-d8223c: 0501e9564231899b F-d980359c: 8f1559276afc5c03 F-dd51b42c: 496eeffa2641169d F-dddb89: f5625354e55eba9b - F-e0f6c7: fe68521cda464f23 + F-e0f6c7: d5680b929768cc3c F-eb732f: d8abb536ff850a7a F-ee47fc2b: adb87c97b8ccf6e1 - F-ee5f643e: 7c61f35852f093ca + F-ee5f643e: ae47c1d5466936fa F-ef2fd9: b3a1dcd1e750a714 F-f334fa: 5207f35968a0c9b2 F-f44d1b: 62e0779d9c0ef11f F-f6d13e: fb5c242416832024 - F-fcece7: ce9967822b5a2ebe + F-fcece7: eab583d9b33492f7 diff --git a/spec/features/doc-graph-links-ee5f643e.yaml b/spec/features/doc-graph-links-ee5f643e.yaml index 68a93474..4a1170f2 100644 --- a/spec/features/doc-graph-links-ee5f643e.yaml +++ b/spec/features/doc-graph-links-ee5f643e.yaml @@ -4,6 +4,7 @@ title: "Doc graph — doc→spec (F-id) + doc→doc (.md) link index and integri status: done modules: - src/spec/doc-references.ts + - src/spec/feature-id.ts - src/stages/detectors/doc-reference-integrity.ts - src/stages/detectors/index.ts - src/cli/clad.ts diff --git a/spec/features/graph-context-wiring-d6b93648.yaml b/spec/features/graph-context-wiring-d6b93648.yaml index 3cabf528..b47b1b06 100644 --- a/spec/features/graph-context-wiring-d6b93648.yaml +++ b/spec/features/graph-context-wiring-d6b93648.yaml @@ -16,11 +16,12 @@ acceptance_criteria: condition: "when a source-file Edit/Write/MultiEdit completes (PostToolUse) and the file touches a feature" action: "emit a one-line impact card — the owning feature(s) + how many downstream features could break + how many regression tests to run — appended to (not replacing) the existing drift nudge; degrade to silence on any error and never block the edit" response: "the AI automatically sees the blast radius of what it just edited, without having to call a tool" - text: "When a source edit completes, the system shall append a one-line impact card (owner + breaks + tests) derived from the impact slice, never blocking and degrading to silence on error." + text: "When a source edit completes, the system shall append a one-line impact card (owner + breaks + tests) derived from the impact slice — relativizing the host's absolute file_path to the spec's repo-relative module keys — never blocking and degrading to silence on error." test_refs: - "tests/cli/impact-card.test.ts#formatImpactCard renders owner, breaks, and tests for a touched file" - "tests/cli/impact-card.test.ts#formatImpactCard is empty when the file touches no feature" - notes: "## Why\nThe working set (F-06dfdad6) is a PULL tool the AI must remember to call. This is the PUSH half: PostToolUse is the only plain-text lane (PreToolUse is JSON-only — sim finding), so the blast radius is surfaced automatically AFTER the edit. The pure formatter is what's pinned; the hook I/O wiring is manual-smoke." + - "tests/cli/hook.test.ts#impact card fires for a host-style ABSOLUTE file_path and shows the repo-relative path" + notes: "## Why\nThe working set (F-06dfdad6) is a PULL tool the AI must remember to call. This is the PUSH half: PostToolUse is the only plain-text lane (PreToolUse is JSON-only — sim finding), so the blast radius is surfaced automatically AFTER the edit. ## Correction (0.7.1)\n'The hook I/O wiring is manual-smoke' hid the fact that the card NEVER fired in production: hosts send absolute file paths, the module index is repo-relative (0/361 resolved on cladding-self; 99.2% after relativizing). The wiring is now pinned end-to-end (runHookEvent + absolute path + on-disk spec)." - id: AC-e49483 ears: state condition: "while the edit's changed-text magnitude is below the tiny-edit threshold" diff --git a/spec/features/graph-efficiency-measure-16138071.yaml b/spec/features/graph-efficiency-measure-16138071.yaml index 0c2a9535..c2885195 100644 --- a/spec/features/graph-efficiency-measure-16138071.yaml +++ b/spec/features/graph-efficiency-measure-16138071.yaml @@ -14,11 +14,12 @@ acceptance_criteria: condition: "when measureGraphEfficiency runs over a spec with module files" action: "for each feature compute the working-set token size, the naive baseline (shard + full text of all its module files), the dependency depth + edges the graph resolves, and the iterative slice's coverage + stop reason; aggregate to medians/p95" response: "a per-feature + aggregate efficiency report quantifying what the graph hands you vs what you'd reconstruct by hand" - text: "When measureGraphEfficiency runs, the system shall produce per-feature and aggregate context-efficiency (slice vs naive tokens), search-efficiency (depth/edges), and regression-coverage metrics." + text: "When measureGraphEfficiency runs, the system shall produce per-feature and aggregate context-efficiency metrics that ATTRIBUTE shrink honestly (cap-driven vs structural: fits/truncated split + medianStructuralRatio via an uncapped second pass), search-efficiency (depth/edges), and regression-coverage metrics, feeding the slice and the naive baseline through ONE injected reader." test_refs: - - "tests/optimizer/measurement.test.ts#computes the slice-vs-naive context ratio per feature" - - "tests/optimizer/measurement.test.ts#aggregates median shrink factor, search depth, and coverage" - notes: "## Why\nThe graph tooling's goal is search/context efficiency + stable dev at scale, NOT agent correctness — four correctness-framed A/Bs were NULL on the wrong axis. This measures the right axis DETERMINISTICALLY (no agent, no NULL risk). Measured on vapt (698-edge graph): median working-set 3028 tok vs naive 14442 = 4.1x smaller context. ## Honest scope\nUpper bound of what the infrastructure CAN provide vs ONE naive baseline (shard+all-modules) — NOT proof a strong agent adopts it (A/Bs show strong agents grep regardless)." + - "tests/optimizer/measurement.test.ts#the injected reader feeds BOTH slice and baseline — one universe, honest ratio" + - "tests/optimizer/measurement.test.ts#splits cap-driven shrink from structural shrink (honest attribution)" + - "tests/optimizer/measurement.test.ts#a fitting feature counts as fits (no cap attribution) and structural == budgeted" + notes: "## Why\nThe graph tooling's goal is search/context efficiency + stable dev at scale, NOT agent correctness — four correctness-framed A/Bs were NULL on the wrong axis. This measures the right axis DETERMINISTICALLY (no agent, no NULL risk). ## Correction (0.7.1)\nThe original 4.1x headline was largely the 3000-token budget CAP compressing, not the graph: uncapped, the structural slice is ~1.16x of naive on cladding-self (code + metadata). The report now splits cap-driven vs structural shrink and the CLI attributes the reduction to the budget; the honest sell is a GUARANTEED bounded context with needs/breaks/verify wiring, not raw shrink. The injected reader also reaches buildWorkingSet now, so slice and baseline read one universe. ## Honest scope\nUpper bound of what the infrastructure CAN provide vs ONE naive baseline (shard+all-modules) — NOT proof a strong agent adopts it (A/Bs show strong agents grep regardless)." - id: AC-612e57 ears: ubiquitous text: "Measurement shall be pure + deterministic given the spec and an injected file reader (no direct fs in the core; reader injected like code-excerpt), and shall never throw on a feature that resolves to a lookup miss (skip it)." diff --git a/spec/features/graph-serve-live-64a5c159.yaml b/spec/features/graph-serve-live-64a5c159.yaml index d5f90f65..3327d667 100644 --- a/spec/features/graph-serve-live-64a5c159.yaml +++ b/spec/features/graph-serve-live-64a5c159.yaml @@ -21,12 +21,13 @@ acceptance_criteria: action: "debounce briefly then broadcast an SSE refresh event to all connected viewers" response: "open browsers reload to the updated graph automatically — develop and the graph follows" text: "When a watched spec/doc file changes, the server shall (debounced) broadcast an SSE refresh so connected viewers auto-update." - test_refs: ["tests/cli/graph-serve.test.ts#a watched-file change broadcasts an SSE refresh"] + test_refs: ["tests/cli/graph-serve.test.ts#a REAL file change under a watched dir reaches SSE through fs.watch + debounce"] notes: "## Decision\nnode:fs.watch (stdlib) on spec/ + docs/, ~400ms debounce (fs.watch is platform-racy; debounce coalesces). No stale-trap: server always recomputes; if it dies the connection closes (visible)." - id: AC-236bcc1e ears: event condition: "when a host calls the clad_get_graph MCP tool" - action: "return the live knowledge-graph JSON (optionally focused) so agents read the current graph without a subprocess" - response: "an LLM references the always-current spec↔code↔doc graph in one call" - text: "When clad_get_graph is called, the system shall return the live graph JSON (nodes+edges, optionally a --focus neighborhood) with schema_version." - test_refs: ["tests/serve/server.test.ts#clad_get_graph returns the live graph; a focus miss is isError"] + action: "with a query, return the live focused neighborhood (a path query unions its kind-twins); without a query, return a compact graphStats summary instead of the full graph" + response: "an LLM references the always-current spec↔code↔doc graph in one call, without a ~70k-token unbudgeted payload riding the no-query form" + text: "When clad_get_graph is called with a query, the system shall return the live focused subgraph JSON with schema_version; when called without a query it shall return a stats summary (counts by kind + hubs), never the full node/edge dump." + test_refs: ["tests/serve/server.test.ts#no-query answers a stats SUMMARY (token-budget discipline), focus answers a subgraph, miss is isError"] + notes: "## Why (0.7.1)\nThe 0.7.0 no-query form returned the whole graph pretty-printed — measured 285KB (~70k tokens) on cladding-self in ONE MCP result, contradicting the working-set budget discipline. Summary + hint keeps the tool safe to call blind; full dumps live on the CLI (clad graph export)." diff --git a/spec/features/working-set-assembler-06dfdad6.yaml b/spec/features/working-set-assembler-06dfdad6.yaml index 286c14ed..be206ba2 100644 --- a/spec/features/working-set-assembler-06dfdad6.yaml +++ b/spec/features/working-set-assembler-06dfdad6.yaml @@ -22,10 +22,12 @@ acceptance_criteria: notes: "## Why\nFreeze F-d2c806's buildContextSlice + clad_get_context (schema_version=1, existing tests) — this is an ADDITIVE buildWorkingSet, never a mutation of the existing slice (sim verdict: backward-compat blocker)." - id: AC-d2b3c8 ears: ubiquitous - text: "The working set shall fuse, in one structured payload: must-edit (focus feature + full ACs), needs (forward depends_on ancestors), breaks-if-changed (direct backward dependents + the regression test union), verify (scenarios + test_refs + oracle_refs + EARS unwanted/state high-risk AC flags), and guidance (ai_hints preferred_patterns) — so one call replaces the forward+backward two-call dance and the hand-grep." + text: "The working set shall fuse, in one structured payload: must-edit (focus feature + full ACs), needs (forward depends_on ancestors), breaks-if-changed (backward dependents + the regression test union — a module query seeds EVERY co-owner, not just the focus owner), verify (scenarios + test_refs + oracle_refs + EARS unwanted/state high-risk AC flags), and guidance (ai_hints preferred_patterns) — so one call replaces the forward+backward two-call dance and the hand-grep." test_refs: - "tests/optimizer/working-set.test.ts#fuses forward needs + backward breaks + verify + guidance into one payload" - "tests/optimizer/working-set.test.ts#flags EARS unwanted/state acceptance criteria as high-risk" + - "tests/optimizer/working-set.test.ts#a module query seeds ALL co-owners — their dependents and tests reach breaks_if_changed" + notes: "## Correction (0.7.1)\n0.7.0 computed the backward radius from the alphabetically-first owner only — a shared file's other owners contributed nothing (src/cli/clad.ts on cladding-self: impacted 0 vs the real 83). The module query now passes through to the iterative slice, which seeds all owners." - id: AC-42bd08 ears: event condition: "when the working set includes a focus module's source" @@ -38,11 +40,13 @@ acceptance_criteria: - id: AC-05ea70 ears: unwanted condition: "if the assembled payload would exceed the token budget (default 3000, configurable)" - action: "clip droppable sections in priority order — distant transitive ancestors, then code excerpts — and record what was dropped in budget.truncated[]; the focus (must-edit + ACs) is always retained" - response: "the droppable sections shrink to fit the budget and the LLM is told what was omitted; the focus is never dropped (so a focus larger than the cap is reported, not truncated)" - text: "While the payload would exceed the token budget, the system shall clip droppable sections (ancestors then code) and record budget.truncated[]; the focus is always retained even if it alone exceeds the cap." + action: "clip droppable sections in priority order — distant transitive ancestors, then code excerpts, then the backward radius (deeper dependents from the far end first, then their tests; the depth-1 direct set is never dropped) — measuring each fit WITH the pending truncation marker, and record every clip in budget.truncated[]; the focus (must-edit + ACs) is always retained" + response: "the payload fits the budget even at hub features and tight caller budgets, the LLM is told exactly what was omitted, and the focus + direct blast radius are never dropped" + text: "While the payload would exceed the token budget, the system shall clip droppable sections (ancestors, then code, then deeper backward dependents/tests — never the depth-1 direct set) with marker-inclusive fit checks, and record budget.truncated[]; the focus is always retained even if it alone exceeds the cap." test_refs: - "tests/optimizer/working-set.test.ts#enforces the token budget and records what was truncated" + - "tests/optimizer/working-set.test.ts#budget pressure clips deeper dependents (and reports it) but never the depth-1 direct set" + notes: "## Correction (0.7.1)\n0.7.0 never clipped breaks_if_changed, so hub features + module fan-out broke the budget contract exactly where scale bites (simulated: fan-out doubles breach paths 17→33/144, worst 2.9x). Clip order (breaks AFTER code) was simulation-compared against clip-before-code and is strictly better; marker-inclusive fit checks close the +3..10-token overshoot the old loops carried." - id: AC-c2cef0 ears: event condition: "when the MCP server registers its tools" diff --git a/spec/index.yaml b/spec/index.yaml index f254aa46..72195000 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -195,7 +195,7 @@ features: F-e0f6c7: {slug: smoke-disposition-spine, status: done, modules: 3} F-eb732f: {slug: spec-authoring-anti-hollow, status: done, modules: 2} F-ee47fc2b: {slug: reverse-index-core, status: done, modules: 1} - F-ee5f643e: {slug: doc-graph-links, status: done, modules: 4} + F-ee5f643e: {slug: doc-graph-links, status: done, modules: 5} F-ef2fd9: {slug: ab-ext-dashboard, status: done, modules: 7} F-f334fa: {slug: ab-ext-scenarios-emit, status: done, modules: 3} F-f44d1b: {slug: hollow-governance-detector, status: done, modules: 2} diff --git a/src/agents/loader.ts b/src/agents/loader.ts index 21a4e21c..9fd088cd 100644 --- a/src/agents/loader.ts +++ b/src/agents/loader.ts @@ -44,7 +44,7 @@ const cache = new Map(); /** * 0.6.0 persona renames (alias-and-deprecate, docs/glossary.md). Resolving an * old id loads the NEW persona file and emits a one-line stderr deprecation - * notice; the old ids are removed in 0.7. + * notice; the old ids are removed in 0.8 (still shipped through 0.7.x). */ export const PERSONA_ALIASES: Readonly> = { librarian: 'planner', @@ -72,7 +72,7 @@ export function loadPersona(id: string, rootDir?: string): PersonaSpec { const replacement = PERSONA_ALIASES[id]; if (replacement) { process.stderr.write( - `cladding: persona '${id}' is now '${replacement}' — the old id is removed in 0.7\n`, + `cladding: persona '${id}' is now '${replacement}' — the old id is removed in 0.8\n`, ); } const resolvedId = replacement ?? id; diff --git a/src/cli/clad.ts b/src/cli/clad.ts index b2ec6d0d..3a6a0a56 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -623,6 +623,11 @@ export function runInferDepsCommand(opts: {ambiguity?: string} = {}): void { * baseline, the dependency depth/edges it resolves for you, and the regression-set coverage. * No agent, no test run — measures what the infrastructure CAN provide (an upper bound vs one * naive baseline), not whether an agent adopts it. + * + * ATTRIBUTION (v0.7.1): the shrink number is split — for budget-capped features the reduction + * is the CAP doing the work (arithmetic, not graph value), and the uncapped structural slice is + * ≈1x of naive (code + structured metadata). What the working set sells is the guaranteed + * budget + the wired needs/breaks/verify context, not raw byte shrink. */ export function runMeasureCommand(opts: {json?: boolean} = {}): void { try { @@ -638,9 +643,16 @@ export function runMeasureCommand(opts: {json?: boolean} = {}): void { if (opts.json) { process.stdout.write(`${JSON.stringify(r, null, 2)}\n`); } else { + const c = r.context; + const capPart = + c.truncatedCount > 0 + ? `budget enforces ${c.medianShrinkTruncated}x on ${c.truncatedCount} capped feature(s) (cap-driven)` + : 'no feature hit the budget cap'; + const fitPart = c.fitsCount > 0 ? `${c.medianShrinkFit}x on ${c.fitsCount} fitting` : 'none fit untruncated'; const lines = [ `graph efficiency · ${r.measured}/${r.featureCount} features`, - ` context: working-set ${r.context.medianSliceTokens} tok vs naive ${r.context.medianNaiveTokens} tok = ${r.context.medianShrinkFactor}x smaller (median)`, + ` context: working-set ${c.medianSliceTokens} tok vs naive ${c.medianNaiveTokens} tok — ${capPart}, ${fitPart}`, + ` uncapped structural slice = ${c.medianStructuralRatio}x of naive — the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`, ` search: median ${r.search.medianDepth} hop(s) resolved (p95 ${r.search.p95Depth}), median ${r.search.medianEdges} edge(s)/feature (max hub ${r.search.maxEdges})`, ` stability: median blast-radius coverage ${r.stability.medianCoverage}, median ${r.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(r.stability.byStopReason)}`, ` (deterministic upper bound vs the shard+all-modules baseline — not an agent-adoption measurement)`, @@ -792,7 +804,7 @@ export function runRouteCommand(prompt: string): void { /** * 0.6.0 verb renames (alias-and-deprecate, docs/glossary.md). Commander keeps * the old spellings working via `.alias()`; this map only powers the one-line - * stderr deprecation notice. The old verbs are removed in 0.7. + * stderr deprecation notice. The old verbs are removed in 0.8 (still shipped through 0.7.x). */ export const RENAMED_VERBS: Readonly> = { refine: 'clarify', @@ -809,7 +821,7 @@ export function printVerbDeprecationNotice(verb: string | undefined): void { const replacement = verb ? RENAMED_VERBS[verb] : undefined; if (!replacement) return; process.stderr.write( - `cladding: '${verb}' is now '${replacement}' — the old verb is removed in 0.7\n`, + `cladding: '${verb}' is now '${replacement}' — the old verb is removed in 0.8\n`, ); } @@ -842,7 +854,7 @@ export function createProgram(): Command { program .command('run [goal]') - .alias('drive') // 0.6.0 rename — `drive` is removed in 0.7 + .alias('drive') // 0.6.0 rename — `drive` is removed in 0.8 .description('(experimental) Headless autonomous loop — iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked') .option('--cwd ', 'target project directory (default cwd)') .option('--max-iterations ', 'cap iterations (default 50)', '50') @@ -911,7 +923,7 @@ export function createProgram(): Command { program .command('status') - .alias('panel') // 0.6.0 rename — `panel` is removed in 0.7 + .alias('panel') // 0.6.0 rename — `panel` is removed in 0.8 .description('Render the feature × stage integrity matrix (business titles; use --internal for raw F-NNN ids)') .option('--internal', 'show internal F-NNN ids and stage codes') .action(runStatusCommand); @@ -1005,7 +1017,7 @@ export function createProgram(): Command { program .command('clarify [answer...]') - .alias('refine') // 0.6.0 rename — `refine` is removed in 0.7 + .alias('refine') // 0.6.0 rename — `refine` is removed in 0.8 .description( 'Advance the onboarding Q&A loop. Pass the user\'s answer to the next pending question as a positional ' + '(no quotes needed, e.g. `clad clarify 법인 사업자만`); the LLM refines spec/docs based on the full Q-A ' + diff --git a/src/cli/graph-serve.ts b/src/cli/graph-serve.ts index 60a07c37..61e97454 100644 --- a/src/cli/graph-serve.ts +++ b/src/cli/graph-serve.ts @@ -48,16 +48,29 @@ export function createGraphServer(opts: {readonly port?: number; readonly cwd?: const server = createServer((req, res) => { const path = (req.url ?? '/').split('?')[0]; + // DNS-rebinding guard: the server binds 127.0.0.1, but a hostile web page can + // still point a rebound hostname at it — only local Host headers are served. + const host = (req.headers.host ?? '').split(':')[0]; + if (host && host !== 'localhost' && host !== '127.0.0.1' && host !== '[::1]' && host !== '::1') { + res.writeHead(403, {'Content-Type': 'text/plain'}); + res.end('forbidden host'); + return; + } try { + // Bodies are computed BEFORE writeHead on every non-SSE route: a mid-write / + // unparseable spec throws in liveGraph(), and committing 200+JSON headers first + // turned that into an HTTP 200 with a prose YAML error as the "JSON" body. if (path === '/graph.json') { + const body = toJson(liveGraph()); res.writeHead(200, {'Content-Type': 'application/json', 'Cache-Control': 'no-store'}); - res.end(toJson(liveGraph())); + res.end(body); return; } if (path === '/health.json') { // KILLER: live spec↔code conformance from cladding's drift detectors, per node. + const body = JSON.stringify(nodeHealth(liveGraph(), cwd)); res.writeHead(200, {'Content-Type': 'application/json', 'Cache-Control': 'no-store'}); - res.end(JSON.stringify(nodeHealth(liveGraph(), cwd))); + res.end(body); return; } if (path === '/events') { @@ -74,19 +87,30 @@ export function createGraphServer(opts: {readonly port?: number; readonly cwd?: if (path === '/' || path === '/index.html') { // The viewer self-wires SSE (EventSource('events')) and re-fetches graph/health // on refresh — health-only changes heal smoothly, structural changes reload. + const body = toHtmlShell(liveGraph()); res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-store'}); - res.end(toHtmlShell(liveGraph())); + res.end(body); return; } res.writeHead(404, {'Content-Type': 'text/plain'}); res.end('not found'); } catch (err) { - // Headers may already be sent (e.g. an SSE stream) — only set status if not. - if (!res.headersSent) res.writeHead(500, {'Content-Type': 'text/plain'}); - try { - res.end((err as Error).message); - } catch { - /* socket already gone */ + // Error-as-data: a temporarily unreadable spec is a 503 JSON payload the viewer + // can react to, never a 200. headersSent stays guarded for mid-stream failures + // (SSE) where the status line is already on the wire. + if (!res.headersSent) { + res.writeHead(503, {'Content-Type': 'application/json', 'Cache-Control': 'no-store'}); + try { + res.end(JSON.stringify({error: (err as Error).message})); + } catch { + /* socket already gone */ + } + } else { + try { + res.end(); + } catch { + /* socket already gone */ + } } } }); @@ -102,7 +126,17 @@ export function createGraphServer(opts: {readonly port?: number; readonly cwd?: const abs = join(cwd, dir); if (!existsSync(abs)) continue; try { - watchers.push(watch(abs, {recursive: true}, onChange)); + const w = watch(abs, {recursive: true}, onChange); + // A runtime watcher error (EMFILE, deleted root, …) must degrade to + // manual refresh — an unhandled 'error' event would crash the server. + w.on('error', () => { + try { + w.close(); + } catch { + /* already closed */ + } + }); + watchers.push(w); } catch { /* recursive watch unsupported on this platform → skip (manual refresh still works) */ } @@ -119,7 +153,13 @@ export function createGraphServer(opts: {readonly port?: number; readonly cwd?: }, 30000); if (typeof ka.unref === 'function') ka.unref(); - return new Promise((resolve) => { + return new Promise((resolve, reject) => { + // A listen failure (EADDRINUSE on a busy port) rejects the boot promise so the + // CLI's catch prints one pulse line — before this the 'error' event was unhandled + // and the process died with a raw stack while the promise never settled. The + // listener stays attached for the server's lifetime (rejecting a settled promise + // is a no-op) so later runtime errors can't crash the process either. + server.on('error', reject); server.listen(opts.port ?? 0, '127.0.0.1', () => { const addr = server.address(); const port = typeof addr === 'object' && addr ? addr.port : (opts.port ?? 0); diff --git a/src/cli/graph.ts b/src/cli/graph.ts index 90b1c399..5686dd17 100644 --- a/src/cli/graph.ts +++ b/src/cli/graph.ts @@ -7,7 +7,7 @@ import {mkdirSync, writeFileSync} from 'node:fs'; import {dirname, join} from 'node:path'; -import {buildGraph, resolveNodeId, subgraph} from '../graph/model.js'; +import {buildGraph, resolveNodeIds, subgraph} from '../graph/model.js'; import {toDot, toJson, toMermaid, toObsidianVault} from '../graph/render.js'; import {toHtmlShell} from '../graph/viewer-shell.js'; import {nodeHealth} from '../stages/graph-health.js'; @@ -24,22 +24,38 @@ export interface GraphExportOptions { readonly out?: string; } +const FORMATS: ReadonlySet = new Set(['mermaid', 'dot', 'json', 'obsidian', 'html']); + /** Handler for `clad graph export`. */ export function runGraphExportCommand(opts: GraphExportOptions = {}): void { try { - const format = (opts.format ?? 'mermaid') as GraphFormat; + // A typo'd --format used to fall through SILENTLY to mermaid — fail loudly instead. + const requested = opts.format ?? 'mermaid'; + if (!FORMATS.has(requested)) { + pulse('fail', 'graph', `unknown --format '${requested}' — use mermaid | dot | json | obsidian | html`); + process.exit(1); + return; + } + const format = requested as GraphFormat; const spec = loadSpec(); let graph = buildGraph(spec, '.'); if (opts.focus) { - const focusId = resolveNodeId(spec, graph, opts.focus); - if (!focusId) { + // A path focus seeds every kind-twin (module:/test:/doc: nodes of one file) — + // first-twin-only silently dropped the other twins' edges from the neighborhood. + const focusIds = resolveNodeIds(spec, graph, opts.focus); + if (focusIds.length === 0) { pulse('fail', 'graph', `no node matches '${opts.focus}' — try a feature id (F-…), slug, or module path`); process.exit(1); return; } const depth = opts.depth !== undefined ? Number(opts.depth) : Infinity; - graph = subgraph(graph, focusId, depth); + if (Number.isNaN(depth) || depth < 0) { + pulse('fail', 'graph', `--depth must be a non-negative number, got '${opts.depth}'`); + process.exit(1); + return; + } + graph = subgraph(graph, focusIds, depth); } if (format === 'obsidian') { diff --git a/src/cli/hook.ts b/src/cli/hook.ts index 5c8b80e0..c23c3538 100644 --- a/src/cli/hook.ts +++ b/src/cli/hook.ts @@ -25,7 +25,7 @@ import {createHash} from 'node:crypto'; import {existsSync, mkdirSync, readFileSync, rmSync, writeFileSync} from 'node:fs'; -import {dirname, isAbsolute, join} from 'node:path'; +import {dirname, isAbsolute, join, relative, resolve, sep} from 'node:path'; import process from 'node:process'; import {parse as parseYaml} from 'yaml'; @@ -408,11 +408,14 @@ function runPostToolUseDrift(input: unknown, cwd: string): string { /* unwritable stamp → still run; worst case is an extra drift pass */ } // Impact card: the blast radius of the file just edited (skip trivial edits; degrade to ''). + // Hosts send tool_input.file_path ABSOLUTE while moduleOwners keys are repo-relative posix — + // without relativization the lookup never hits (measured 0/361 on cladding-self; 99.2% after). let card = ''; if (editMagnitude(rec.tool_input) >= MIN_EDIT_CHARS) { try { - const slice = buildImpactSlice(loadSpec(cwd), filePath); - if (!('not_found' in slice)) card = formatImpactCard(slice, filePath); + const rel = isAbsolute(filePath) ? relative(resolve(cwd), filePath).split(sep).join('/') : filePath; + const slice = buildImpactSlice(loadSpec(cwd), rel); + if (!('not_found' in slice)) card = formatImpactCard(slice, rel); } catch { /* spec unreadable → no card, still run drift */ } diff --git a/src/graph/model.ts b/src/graph/model.ts index daf0a54628401073ba7dd3ffdbe2c5face191425..a2643b1d031860bd2a27d400c9c30d0a3386fad4 100644 GIT binary patch delta 1116 zcmbVLO=}ZD7$z1GB0{NJyrjOSg={3<#zV2D#85GZLTO7Yg2X__op-ZCH?!-^Y-7+8 z&tBKNdKVSzFYqk>1;M-EPw<`D^ic8S9(LLJc;@+`cR~7s*X!$qTWqv~G;QAD|^*r4(} z!B-sW^mspFn#Kxz5rXH?{TSuIL=Loha^rffbl#2UJ8<=a@B8-WB!cgyiFJ6duuYS( znI^$cGgMH0%1E1+*t*k1(BD9Hm8*^ZHvAVQu0o}JI%R4yj#mGxR(WUXTIIAE|13uCSMN`Dw!3F?Xw zLrVVa1#&lzL{M0Wsdkd7cFRrwwtuTI$K5{LYol0TsH+MB7RTg@gEiJwi8#vvpV0#H m&t7rC^HG084mb=}M35O0q&JEN`(g?1BuA_?eKb!b|bk>Q%g5eKbt3;qQ$TH6f ze!Khl>}})9zrY{w4POUc{2DCAnwwHfn8uO`7Mofp5t0RgVAkhf&$<`FXk=f8&eHh> D4Mb^8 diff --git a/src/graph/render.ts b/src/graph/render.ts index c1932bb2..1b3617ce 100644 --- a/src/graph/render.ts +++ b/src/graph/render.ts @@ -70,36 +70,57 @@ const SHAPE: Record = { doc: ['>', ']'], // asymmetric (a note) }; +/** safeId collapses distinct ids to one identifier (src/a.ts vs src/a_ts) — + * a deterministic suffix keeps every node distinct in the diagram. */ +function mermaidIds(graph: KnowledgeGraph): Map { + const ids = new Map(); + const used = new Set(); + for (const n of graph.nodes) { + let s = safeId(n.id); + while (used.has(s)) s = `${s}_`; + used.add(s); + ids.set(n.id, s); + } + return ids; +} + /** Mermaid `graph LR` of the (sub)graph, with per-tier color classes. */ export function toMermaid(graph: KnowledgeGraph): string { + const mid = mermaidIds(graph); const lines: string[] = ['graph LR']; for (const n of graph.nodes) { const [open, close] = SHAPE[n.kind]; - const text = `${n.label}`.replace(/"/g, "'"); - lines.push(` ${safeId(n.id)}${open}"${text}"${close}`); + // Quotes and newlines break the quoted-label syntax silently — flatten both. + const text = `${n.label}`.replace(/"/g, "'").replace(/\s+/g, ' '); + lines.push(` ${mid.get(n.id)}${open}"${text}"${close}`); } for (const e of graph.edges) { - lines.push(` ${safeId(e.from)} -->|${e.kind}| ${safeId(e.to)}`); + lines.push(` ${mid.get(e.from) ?? safeId(e.from)} -->|${e.kind}| ${mid.get(e.to) ?? safeId(e.to)}`); } // Tier coloring: one classDef per tier present + a `code` class, then assign. for (const {key, color} of getTierLegend(graph)) { lines.push(` classDef ${key} fill:${color},stroke:${color},color:#fff;`); const members = graph.nodes .filter((n) => (key === 'code' ? n.tier === undefined : n.tier === key)) - .map((n) => safeId(n.id)); + .map((n) => mid.get(n.id) ?? safeId(n.id)); if (members.length > 0) lines.push(` class ${members.join(',')} ${key};`); } return `${lines.join('\n')}\n`; } +/** DOT-safe double-quoted string: backslashes first, then quotes, newlines flattened. */ +function dotQuote(s: string): string { + return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\s+/g, ' '); +} + /** Graphviz DOT digraph. */ export function toDot(graph: KnowledgeGraph): string { const lines: string[] = ['digraph cladding {', ' rankdir=LR;', ' node [shape=box];']; for (const n of graph.nodes) { - lines.push(` "${n.id}" [label="${n.label.replace(/"/g, '\\"')}"];`); + lines.push(` "${dotQuote(n.id)}" [label="${dotQuote(n.label)}"];`); } for (const e of graph.edges) { - lines.push(` "${e.from}" -> "${e.to}" [label="${e.kind}"];`); + lines.push(` "${dotQuote(e.from)}" -> "${dotQuote(e.to)}" [label="${e.kind}"];`); } lines.push('}'); return `${lines.join('\n')}\n`; @@ -126,7 +147,8 @@ export function toObsidianVault(graph: KnowledgeGraph): Map { const link = (id: string): string => { const n = byId.get(id); - return n ? `[[${noteName(n)}|${n.label}]]` : `[[${id}]]`; + // Wikilink metacharacters in a label ('|', '[', ']') corrupt the link silently. + return n ? `[[${noteName(n)}|${n.label.replace(/[[\]|]/g, ' ')}]]` : `[[${id.replace(/[[\]|]/g, ' ')}]]`; }; const vault = new Map(); diff --git a/src/graph/viewer/main.ts b/src/graph/viewer/main.ts index ffa34daa..f0e66c4d 100644 --- a/src/graph/viewer/main.ts +++ b/src/graph/viewer/main.ts @@ -539,6 +539,10 @@ THREE.ColorManagement.enabled = false; if (on) b.classList.add('on'); b.onclick = () => fn(b); } + // Mobile: the burger toggles the off-canvas sidebar (#side.show, styles.css ≤760px). + const burger = document.getElementById('burger'); + const side = document.getElementById('side'); + if (burger && side) burger.onclick = () => side.classList.toggle('show'); const sb = document.getElementById('search') as HTMLInputElement | null; if (sb) sb.addEventListener('input', () => { @@ -592,8 +596,13 @@ THREE.ColorManagement.enabled = false; el.style.display = 'none'; return; } - let bad = 0; - for (const k in HEALTH) if (Object.prototype.hasOwnProperty.call(HEALTH, k)) bad++; + // Count distinct PATHS, not node keys: one file can exist as module:/test:/doc: + // twins that each carry the badge — raw key counting doubles the headline. + const seen = new Set(); + for (const k in HEALTH) { + if (Object.prototype.hasOwnProperty.call(HEALTH, k)) seen.add(k.slice(k.indexOf(':') + 1)); + } + const bad = seen.size; const pct = Math.max(0, Math.round((1 - bad / (nodes.length || 1)) * 100)); el.style.display = 'block'; const dot = mkEl('span', 'dot'); @@ -611,8 +620,14 @@ THREE.ColorManagement.enabled = false; function liveWire(): void { if (typeof fetch !== 'function' || typeof EventSource !== 'function') return; fetch('graph.json', {cache: 'no-store'}) - .then((r) => { + .then(async (r) => { if (!r.ok) return; // static export / file:// → embedded data only + // Change detection compares the SERVER's exact response text — the old + // nodes.length proxy missed edge-only and same-count node changes, so + // the view rendered stale. Never re-serialize client-side: toJson() is + // pretty-printed + trailing newline, a parse→stringify round-trip + // would mismatch on every poll. + const prevText = await r.text(); const pull = (): void => { fetch('health.json', {cache: 'no-store'}) .then((r2) => (r2.ok ? r2.json() : null)) @@ -623,13 +638,13 @@ THREE.ColorManagement.enabled = false; const es = new EventSource('events'); es.onmessage = () => { fetch('graph.json', {cache: 'no-store'}) - .then((r2) => (r2.ok ? r2.json() : null)) - .then((g2) => { - if (g2 && g2.nodes && g2.nodes.length !== nodes.length) { - location.reload(); + .then((r2) => (r2.ok ? r2.text() : null)) + .then((t2) => { + if (t2 !== null && t2 !== prevText) { + location.reload(); // reload re-embeds the new graph and re-runs liveWire return; } - pull(); // health-only → smooth heal + pull(); // unchanged graph (or a transient 503 mid-write) → health-only heal }) .catch(() => undefined); }; diff --git a/src/optimizer/code-excerpt.ts b/src/optimizer/code-excerpt.ts index a571f80a..42ec8de4 100644 --- a/src/optimizer/code-excerpt.ts +++ b/src/optimizer/code-excerpt.ts @@ -46,26 +46,40 @@ export function withinCwd(rel: string, cwd: string): boolean { return abs === root || abs.startsWith(root + sep); } +/** Injectable source reader (measurement/tests) — returns file text or null when unreadable. */ +export type ExcerptReader = (rel: string) => string | null; + /** * Reads `rel` (relative to `cwd`) as a bounded, path-safe excerpt. Never throws. * `maxChars` caps the included text; longer files are clipped with a marker. + * When `read` is supplied it replaces the filesystem — the same safety gates + * (path, extension, size, binary) apply, so a virtual universe measures like + * the real one (measurement.ts compares slice vs naive through ONE reader). */ -export function codeExcerpt(rel: string, cwd: string, maxChars: number): CodeExcerpt { +export function codeExcerpt(rel: string, cwd: string, maxChars: number, read?: ExcerptReader): CodeExcerpt { if (!withinCwd(rel, cwd)) return {path: rel, omitted: 'unsafe-path'}; if (!CODE_EXTS.has(extname(rel).toLowerCase())) return {path: rel, omitted: 'unsupported'}; - const abs = resolve(cwd, rel); - let bytes: number; - try { - bytes = statSync(abs).size; - } catch { - return {path: rel, omitted: 'missing'}; - } - if (bytes > MAX_READ_BYTES) return {path: rel, omitted: 'too-large', bytes}; let raw: string; - try { - raw = readFileSync(abs, 'utf8'); - } catch { - return {path: rel, omitted: 'missing', bytes}; + let bytes: number; + if (read) { + const virtual = read(rel); + if (virtual == null) return {path: rel, omitted: 'missing'}; + raw = virtual; + bytes = Buffer.byteLength(virtual, 'utf8'); + if (bytes > MAX_READ_BYTES) return {path: rel, omitted: 'too-large', bytes}; + } else { + const abs = resolve(cwd, rel); + try { + bytes = statSync(abs).size; + } catch { + return {path: rel, omitted: 'missing'}; + } + if (bytes > MAX_READ_BYTES) return {path: rel, omitted: 'too-large', bytes}; + try { + raw = readFileSync(abs, 'utf8'); + } catch { + return {path: rel, omitted: 'missing', bytes}; + } } if (raw.includes(NUL)) return {path: rel, omitted: 'binary', bytes}; const budget = Math.max(0, Math.floor(maxChars)); diff --git a/src/optimizer/infer-depends-on.ts b/src/optimizer/infer-depends-on.ts index 5f87466e..d4c728f7 100644 --- a/src/optimizer/infer-depends-on.ts +++ b/src/optimizer/infer-depends-on.ts @@ -60,10 +60,21 @@ export interface InferOptions { // Dynamic/runtime import patterns — dependencies static extraction cannot see (so a file with // these may have UNDER-reported edges; we surface it for manual review rather than pretend it's complete). const DYNAMIC_IMPORT = /\b(?:importlib\.import_module|importlib\.__import__|__import__\s*\(|import_module\s*\(|require\s*\(\s*[^'"\s)])/; +// JS-only: dynamic import() with a NON-literal argument (a literal one IS extracted below). +// Kept apart from DYNAMIC_IMPORT because `import\s*\(` would false-flag Python's +// parenthesized `from x import (a, b)` form. +const JS_DYNAMIC_NONLITERAL = /\bimport\s*\(\s*[^'"\s)]/; // Import extractors per language family. Each returns the raw imported "specifier" strings. const PY_IMPORT = /^\s*(?:from\s+([.\w]+)\s+import\b|import\s+([.\w]+))/gm; -const JS_IMPORT = /(?:^|\n)\s*(?:import\b[^'"]*from\s*['"]([^'"]+)['"]|import\s*['"]([^'"]+)['"]|(?:const|let|var)\s+[^=]+=\s*require\(\s*['"]([^'"]+)['"]\s*\))/g; +// Statement-position forms: import…from, side-effect import, export…from (re-exports — +// barrel files are dependencies too; v0.7.0 missed them), and require(). +const JS_IMPORT = + /(?:^|\n)\s*(?:import\b[^'"]*from\s*['"]([^'"]+)['"]|import\s*['"]([^'"]+)['"]|export\b[^'"]*from\s*['"]([^'"]+)['"]|(?:const|let|var)\s+[^=]+=\s*require\(\s*['"]([^'"]+)['"]\s*\))/g; +// Expression-position: dynamic import('./literal') — sits mid-line (await import(…)). +const JS_DYNAMIC_LITERAL = /\bimport\s*\(\s*['"]([^'"]+)['"]\s*\)/g; + +const JS_EXTS: readonly string[] = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs']; /** Lowercase ext check. */ function ext(p: string): string { @@ -105,9 +116,11 @@ function extractImports(source: string, fileExt: string): string[] { if (fileExt === '.py') { for (let m = PY_IMPORT.exec(source); m; m = PY_IMPORT.exec(source)) out.push(m[1] ?? m[2]); PY_IMPORT.lastIndex = 0; - } else if (['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'].includes(fileExt)) { - for (let m = JS_IMPORT.exec(source); m; m = JS_IMPORT.exec(source)) out.push(m[1] ?? m[2] ?? m[3]); + } else if (JS_EXTS.includes(fileExt)) { + for (let m = JS_IMPORT.exec(source); m; m = JS_IMPORT.exec(source)) out.push(m[1] ?? m[2] ?? m[3] ?? m[4]); JS_IMPORT.lastIndex = 0; + for (let m = JS_DYNAMIC_LITERAL.exec(source); m; m = JS_DYNAMIC_LITERAL.exec(source)) out.push(m[1]); + JS_DYNAMIC_LITERAL.lastIndex = 0; } return out.filter(Boolean); } @@ -146,17 +159,21 @@ export function inferDependsOn(spec: Spec, read: ModuleReader, opts: InferOption const fromId = f.id; for (const modPath of f.modules ?? []) { const fileExt = ext(modPath); - if (fileExt !== '.py' && !['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'].includes(fileExt)) continue; + if (fileExt !== '.py' && !JS_EXTS.includes(fileExt)) continue; const src = read(modPath); if (src == null) continue; - if (DYNAMIC_IMPORT.test(src)) dynamicFiles.add(modPath); // edges may be under-reported here + // Under-reporting flags: runtime imports static extraction can't see — + // literal import('…') IS extracted; only the non-literal form is flagged. + if (DYNAMIC_IMPORT.test(src) || (JS_EXTS.includes(fileExt) && JS_DYNAMIC_NONLITERAL.test(src))) { + dynamicFiles.add(modPath); // edges may be under-reported here + } for (const spec0 of extractImports(src, fileExt)) { for (const key of importKeys(spec0, fileExt)) { const owners = resolve.get(key); if (!owners || owners.size > maxAmbiguity) continue; // ambiguous shared module → weak signal, skip for (const ownerId of owners) { if (ownerId === fromId) continue; // a feature importing its own module is not a dep - const k = `${fromId}${ownerId}`; + const k = `${fromId}\u0000${ownerId}`; const existing = edgeMap.get(k); if (!existing || modPath < existing.via) edgeMap.set(k, {from: fromId, to: ownerId, via: modPath}); } diff --git a/src/optimizer/measurement.ts b/src/optimizer/measurement.ts index 69302183..17a120ee 100644 --- a/src/optimizer/measurement.ts +++ b/src/optimizer/measurement.ts @@ -33,12 +33,16 @@ export type ModuleReader = (path: string) => string | null; export interface FeatureEfficiency { readonly id: string; - /** working-set payload tokens (what the slice hands you). */ + /** working-set payload tokens (what the slice hands you, at the default budget). */ readonly sliceTokens: number; + /** working-set payload tokens with the budget lifted — the STRUCTURAL slice size. */ + readonly structuralTokens: number; /** naive baseline tokens: the shard + the full text of every module file. */ readonly naiveTokens: number; /** sliceTokens / naiveTokens — < 1 means the slice is smaller (the context it saves). */ readonly contextRatio: number; + /** True when the default budget truncated anything — the shrink is then CAP-DRIVEN. */ + readonly budgetSaturated: boolean; /** hops the iterative slice expanded (≈ grep rounds to reconstruct the radius by hand). */ readonly searchDepth: number; /** forward depends_on + backward dependents the graph resolves for you. */ @@ -57,8 +61,26 @@ export interface EfficiencyReport { readonly context: { /** median sliceTokens / naiveTokens across measured features (< 1 = smaller). */ readonly medianContextRatio: number; - /** median naive / slice (e.g. 6.0 = "6x smaller"). Infinity-safe. */ + /** + * median naive / slice at the default budget. HONEST ATTRIBUTION: when + * `truncatedCount` > 0 this number is largely the BUDGET CAP doing the + * shrinking, not the graph — read it as "the budget enforces this + * reduction", and read `medianStructuralRatio` for what the slice + * structurally is without a cap. + */ readonly medianShrinkFactor: number; + /** features whose working set fit the default budget untouched. */ + readonly fitsCount: number; + /** features the default budget truncated (code/needs/breaks clipped) — cap-driven shrink. */ + readonly truncatedCount: number; + /** median naive/slice over fitting features only (the graph's own shrink). */ + readonly medianShrinkFit: number; + /** median naive/slice over truncated features only (cap arithmetic, labeled as such). */ + readonly medianShrinkTruncated: number; + /** median structuralTokens / naiveTokens — the uncapped slice vs naive (≈0.9 on cladding-self: + * the slice is the code PLUS structured metadata; its value is the bounded budget + the + * needs/breaks/verify wiring, NOT raw byte shrink). */ + readonly medianStructuralRatio: number; readonly medianSliceTokens: number; readonly medianNaiveTokens: number; }; @@ -99,13 +121,18 @@ export function measureGraphEfficiency(spec: Spec, read: ModuleReader, cwd = '.' const rows: FeatureEfficiency[] = []; for (const f of features) { - const ws = buildWorkingSet(spec, f.id, {cwd}); + // The injected reader feeds BOTH sides — slice and baseline read the same universe + // (before this, buildWorkingSet read the real fs while the baseline read `read`, + // so any virtual universe silently inflated the shrink factor). + const ws = buildWorkingSet(spec, f.id, {cwd, read}); if ('not_found' in ws) continue; + const structural = buildWorkingSet(spec, f.id, {cwd, read, maxTokens: Number.MAX_SAFE_INTEGER}); const it = buildIterativeImpactSlice(spec, f.id); const itOk = !('not_found' in it); // slice tokens = the assembled working-set payload. const sliceTokens = estTokens(JSON.stringify(ws)); + const structuralTokens = 'not_found' in structural ? sliceTokens : estTokens(JSON.stringify(structural)); // naive baseline = the shard object + the full text of every module file. let naive = estTokens(JSON.stringify(f)); for (const m of f.modules ?? []) { @@ -118,8 +145,10 @@ export function measureGraphEfficiency(spec: Spec, read: ModuleReader, cwd = '.' rows.push({ id: f.id, sliceTokens, + structuralTokens, naiveTokens: naive, contextRatio: naive > 0 ? sliceTokens / naive : 1, + budgetSaturated: ws.budget.truncated.length > 0, searchDepth: itOk ? it.depthUsed : 1, edgesResolved: forward + backward, stoppedBy: itOk ? it.stoppedBy : 'n/a', @@ -130,7 +159,13 @@ export function measureGraphEfficiency(spec: Spec, read: ModuleReader, cwd = '.' rows.sort((a, b) => a.id.localeCompare(b.id)); const ratios = rows.map((r) => r.contextRatio); - const shrink = rows.filter((r) => r.sliceTokens > 0).map((r) => r.naiveTokens / r.sliceTokens); + const shrinkOf = (rs: readonly FeatureEfficiency[]): number[] => + rs.filter((r) => r.sliceTokens > 0).map((r) => r.naiveTokens / r.sliceTokens); + const fits = rows.filter((r) => !r.budgetSaturated); + const capped = rows.filter((r) => r.budgetSaturated); + const structuralRatios = rows + .filter((r) => r.naiveTokens > 0) + .map((r) => r.structuralTokens / r.naiveTokens); const byStop: Record = {}; for (const r of rows) byStop[r.stoppedBy] = (byStop[r.stoppedBy] ?? 0) + 1; @@ -139,7 +174,12 @@ export function measureGraphEfficiency(spec: Spec, read: ModuleReader, cwd = '.' measured: rows.length, context: { medianContextRatio: Math.round(median(ratios) * 1000) / 1000, - medianShrinkFactor: Math.round(median(shrink) * 10) / 10, + medianShrinkFactor: Math.round(median(shrinkOf(rows)) * 10) / 10, + fitsCount: fits.length, + truncatedCount: capped.length, + medianShrinkFit: Math.round(median(shrinkOf(fits)) * 10) / 10, + medianShrinkTruncated: Math.round(median(shrinkOf(capped)) * 10) / 10, + medianStructuralRatio: Math.round(median(structuralRatios) * 100) / 100, medianSliceTokens: Math.round(median(rows.map((r) => r.sliceTokens))), medianNaiveTokens: Math.round(median(rows.map((r) => r.naiveTokens))), }, diff --git a/src/optimizer/working-set.ts b/src/optimizer/working-set.ts index f6f49f88..7c18cf59 100644 --- a/src/optimizer/working-set.ts +++ b/src/optimizer/working-set.ts @@ -8,9 +8,10 @@ // buildContextSlice stays pure/frozen (sim verdict: backward-compat); this NEW function does // the impure file reads via code-excerpt.ts. Deterministic given identical spec + file content. -import {codeExcerpt, estTokens, type CodeExcerpt} from './code-excerpt.js'; +import {codeExcerpt, estTokens, type CodeExcerpt, type ExcerptReader} from './code-excerpt.js'; import {buildContextSlice, type ContextLookupMiss} from './context-slice.js'; import {buildIterativeImpactSlice} from './iterative-slice.js'; +import {buildImpactSlice} from './reverse-slice.js'; import {reverseIndexOf} from '../spec/reverse-index.js'; import type {Feature, Spec} from '../spec/types.js'; @@ -30,7 +31,10 @@ export interface WorkingSet { }; /** What it needs: transitive depends_on ancestors (forward). */ readonly needs: readonly Summary[]; - /** What breaks if you change it: direct dependents + the regression set (backward). */ + /** What breaks if you change it: dependents + the regression set (backward). A module query + * seeds ALL co-owners (fan-out). Under budget pressure deeper dependents and their tests are + * clipped — the depth-1 direct set is always retained — with a `breaks: omitted …` entry in + * budget.truncated. */ readonly breaks_if_changed: { readonly impacted: readonly Summary[]; readonly regression_tests: readonly string[]; @@ -55,6 +59,8 @@ export interface WorkingSet { export interface WorkingSetOptions { readonly cwd?: string; readonly maxTokens?: number; + /** Injected source reader — replaces the filesystem for code excerpts (measurement/tests). */ + readonly read?: ExcerptReader; } const DEFAULT_MAX_TOKENS = 3000; @@ -94,7 +100,12 @@ export function buildWorkingSet(spec: Spec, query: string, opts: WorkingSetOptio // criterion holds (coverage / exhaustion / marginal-yield), instead of a fixed depth-1 slice // that under-reports 2nd-hop dependents (the "narrow miss"). The depth/coverage/stop reason // are surfaced in `breaks_if_changed` so the result is self-describing, not a blind bound. - const iter = buildIterativeImpactSlice(spec, focus.id); + // A MODULE query keeps its original form so the slice seeds EVERY co-owner (the fan-out) — + // seeding only the alphabetically-first owner under-reported shared files (src/cli/clad.ts: + // impacted 0 vs 83 measured on cladding-self). Co-owners sit in the seed set, so they appear + // in co_owners, not impacted; their dependents and tests are what the fan-out adds. + const backQuery = owners && owners.size > 0 ? query : focus.id; + const iter = buildIterativeImpactSlice(spec, backQuery); const impact = 'not_found' in iter ? null : iter.slice; const impacted: readonly Summary[] = impact ? impact.impacted : []; const regression: readonly string[] = impact ? impact.test_refs : []; @@ -145,7 +156,7 @@ export function buildWorkingSet(spec: Spec, query: string, opts: WorkingSetOptio truncated.push(`code: omitted ${m} (budget)`); continue; } - const ex = codeExcerpt(m, cwd, Math.floor((maxTokens - before) * 4 * 0.8)); // 0.8 = JSON-escape headroom + const ex = codeExcerpt(m, cwd, Math.floor((maxTokens - before) * 4 * 0.8), opts.read); // 0.8 = JSON-escape headroom if (structuralTokens <= maxTokens && sizeOf(base, needs, [...code, ex]) > maxTokens) { truncated.push(`code: omitted ${m} (budget)`); continue; @@ -158,11 +169,74 @@ export function buildWorkingSet(spec: Spec, query: string, opts: WorkingSetOptio truncated.push('must-edit exceeds budget — retained in full (focus is never dropped)'); } - const used = sizeOf(base, needs, code); + // 3. Clip the BACKWARD radius last (needs → code → breaks; simulation showed clipping breaks + // before the code fill is strictly worse — marker inflation with zero code recovered). + // Deeper dependents drop from the far end first, then tests outside the depth-1 floor; + // the depth-1 direct set is never dropped (the must-edit precedent). Every fit check + // measures WITH the pending 'breaks: omitted …' marker so the marker itself cannot push + // the payload over — the +3..10-token overshoot the old loops carried. A payload already + // inside the budget is returned byte-identical (the clip is a pure no-op). + const breaksOf = (imp: readonly Summary[], reg: readonly string[]): WorkingSet['breaks_if_changed'] => ({ + impacted: imp, + regression_tests: reg, + ...(radius ? {radius} : {}), + }); + const overWith = (imp: readonly Summary[], reg: readonly string[], di: number, dr: number): boolean => { + const marker = di + dr > 0 ? [`breaks: omitted ${di} feature(s) / ${dr} test(s)`] : []; + const trial = { + ...base, + needs, + must_edit: {...base.must_edit, code}, + breaks_if_changed: breaksOf(imp, reg), + budget: {...base.budget, truncated: [...truncated, ...marker]}, + }; + return estTokens(JSON.stringify(trial)) > maxTokens; + }; + let impKeep: readonly Summary[] = impacted; + let regKeep: readonly string[] = regression; + if (overWith(impKeep, regKeep, 0, 0)) { + const direct = buildImpactSlice(spec, backQuery, {depth: 1}); + const directIds = new Set('not_found' in direct ? [] : direct.impacted.map((f) => f.id)); + const floorTests = new Set('not_found' in direct ? [] : direct.test_refs); + // Retention order: direct dependents first, deeper ones behind them (drop from the end). + const ordered = [...impacted.filter((f) => directIds.has(f.id)), ...impacted.filter((f) => !directIds.has(f.id))]; + let imp: readonly Summary[] = ordered; + let di = 0; + while (imp.length > directIds.size && overWith(imp, regKeep, di, 0)) { + imp = imp.slice(0, -1); + di++; + } + const reg = [...regression]; + let dr = 0; + while (overWith(imp, reg, di, dr)) { + let cut = -1; + for (let i = reg.length - 1; i >= 0; i--) { + if (!floorTests.has(reg[i])) { + cut = i; + break; + } + } + if (cut < 0) break; // only depth-1-floor tests remain — never dropped + reg.splice(cut, 1); + dr++; + } + impKeep = imp; + regKeep = reg; + if (di + dr > 0) truncated.push(`breaks: omitted ${di} feature(s) / ${dr} test(s)`); + if (overWith(impKeep, regKeep, 0, 0)) { + truncated.push('breaks: direct set retained in full — exceeds budget'); + } + } + + const finalBreaks = breaksOf(impKeep, regKeep); + const used = estTokens( + JSON.stringify({...base, needs, must_edit: {...base.must_edit, code}, breaks_if_changed: finalBreaks}), + ); return { ...base, needs, must_edit: {...base.must_edit, code}, + breaks_if_changed: finalBreaks, budget: {max_tokens: maxTokens, used_tokens: used, truncated}, }; } diff --git a/src/serve/server.ts b/src/serve/server.ts index ccd05630..cf18ad71 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -44,7 +44,8 @@ import {computeInventory, writeInventoryToSpecYaml, writeFeatureIndex} from '../ import {buildContextSlice} from '../optimizer/context-slice.js'; import {buildImpactSlice} from '../optimizer/reverse-slice.js'; import {buildWorkingSet} from '../optimizer/working-set.js'; -import {buildGraph, resolveNodeId, subgraph} from '../graph/model.js'; +import {buildGraph, resolveNodeIds, subgraph} from '../graph/model.js'; +import {graphStats} from '../graph/stats.js'; import {runDrift} from '../stages/drift.js'; /** Persona ids registered as MCP prompts (mirrors src/agents/). */ @@ -59,7 +60,7 @@ export const PERSONA_IDS = [ /** * 0.6.0 persona renames (docs/glossary.md). The old prompt names stay * registered as aliases serving the NEW persona body — hosts may have cached - * the prompt names — and are removed in 0.7. + * the prompt names — and are removed in 0.8 (still shipped through 0.7.x). */ export const PERSONA_PROMPT_ALIASES: Readonly> = { librarian: 'planner', @@ -542,61 +543,85 @@ function registerTools(server: McpServer, cwd: string): void { }, ); - // clad_get_graph (F-64a5c159) — the live spec↔code↔doc knowledge graph (or a - // focused neighborhood). Always recomputed from the current spec, so the graph - // an agent reads is never stale. Companion to the `clad graph serve` live view. + // clad_get_graph (F-64a5c159) — the live spec↔code↔doc knowledge graph as a + // focused neighborhood, or a stats SUMMARY when no focus is given. The whole + // graph is ~285KB (~70k tokens) on cladding-self and grows with the project — + // an unbudgeted MCP payload that contradicts the working-set discipline — so + // the no-query form answers with graphStats + hubs and points at the CLI + // export for full dumps. Always recomputed from the current spec (never stale). server.registerTool( 'clad_get_graph', { - title: 'Get the live knowledge graph (nodes + edges)', + title: 'Get the live knowledge graph (focused neighborhood, or a stats summary)', description: - 'Returns the current spec↔code↔doc knowledge graph: nodes (feature/module/skill/test/scenario/capability/doc, ' + + 'With query: the focus node’s N-hop neighborhood — nodes (feature/module/skill/test/scenario/capability/doc, ' + 'tier-classified A/B/C/D, features labeled by slug) + typed edges (depends_on/touches/covers/binds/' + - 'implements/references/links). Optionally focus on one node’s N-hop neighborhood. Recomputed live — never stale.', + 'implements/references/links); a path query unions all its kind-twins (module/test/doc nodes of one file). ' + + 'WITHOUT query: a compact summary (node/edge counts by kind + top hubs) — the full graph is tens of ' + + 'thousands of tokens, use `clad graph export --format json` for a complete dump. Recomputed live — never stale.', inputSchema: { query: z .string() .optional() - .describe('Focus node: feature id (F-…), slug, or module path. Omit for the whole graph.'), + .describe('Focus node: feature id (F-…), slug, or module path. Omit for the stats summary.'), max_depth: z .number() .int() .positive() .max(6) .optional() - .describe('Neighborhood radius around the focus node (default: full graph from the focus)'), + .describe('Neighborhood radius around the focus node (default: full reachable subgraph from the focus)'), }, }, async (args) => { try { const spec = loadSpec(cwd); - let graph = buildGraph(spec, cwd); - if (args.query) { - const focusId = resolveNodeId(spec, graph, args.query); - if (!focusId) { - return { - isError: true, - content: [ - { - type: 'text', - text: JSON.stringify( - { - schema_version: PAYLOAD_SCHEMA_VERSION, - not_found: args.query, - accepted_forms: ['feature id (F-…)', 'slug', 'module path'], - }, - null, - 2, - ), - }, - ], - }; - } - graph = subgraph(graph, focusId, args.max_depth ?? Infinity); + const graph = buildGraph(spec, cwd); + if (!args.query) { + return { + content: [ + { + type: 'text', + text: JSON.stringify( + { + schema_version: PAYLOAD_SCHEMA_VERSION, + summary: true, + stats: graphStats(graph), + hint: + 'pass query (feature id, slug, or module path) for a neighborhood subgraph; ' + + '`clad graph export --format json` dumps the full graph', + }, + null, + 2, + ), + }, + ], + }; } + const focusIds = resolveNodeIds(spec, graph, args.query); + if (focusIds.length === 0) { + return { + isError: true, + content: [ + { + type: 'text', + text: JSON.stringify( + { + schema_version: PAYLOAD_SCHEMA_VERSION, + not_found: args.query, + accepted_forms: ['feature id (F-…)', 'slug', 'module path'], + }, + null, + 2, + ), + }, + ], + }; + } + const focused = subgraph(graph, focusIds, args.max_depth ?? Infinity); return { content: [ - {type: 'text', text: JSON.stringify({schema_version: PAYLOAD_SCHEMA_VERSION, ...graph}, null, 2)}, + {type: 'text', text: JSON.stringify({schema_version: PAYLOAD_SCHEMA_VERSION, ...focused}, null, 2)}, ], }; } catch (err) { @@ -689,8 +714,17 @@ function registerTools(server: McpServer, cwd: string): void { .split('\n') .filter((l) => l.trim().length > 0); const tail = lines.slice(-limit); + // A single corrupt/partial JSONL line (a mid-write tail read) must not + // crash the whole tool call — surface it as data instead. + const events = tail.map((l) => { + try { + return JSON.parse(l) as unknown; + } catch { + return {unparseable: l.slice(0, 200)}; + } + }); return { - content: [{type: 'text', text: JSON.stringify({events: tail.map((l) => JSON.parse(l))}, null, 2)}], + content: [{type: 'text', text: JSON.stringify({events}, null, 2)}], }; }, ); @@ -1117,12 +1151,12 @@ function registerPrompts(server: McpServer, cwd: string): void { register(id, id, `Persona prompt body for the ${id} agent.`); } // 0.6.0 alias prompts — old names serve the renamed persona's body so hosts - // with cached prompt names keep working for one release; removed in 0.7. + // with cached prompt names keep working; removed in 0.8. for (const [oldName, newId] of Object.entries(PERSONA_PROMPT_ALIASES)) { register( oldName, newId, - `Persona prompt body for the ${newId} agent. (Renamed: '${oldName}' is now '${newId}' in 0.6.0 — this alias is removed in 0.7.)`, + `Persona prompt body for the ${newId} agent. (Renamed: '${oldName}' is now '${newId}' in 0.6.0 — this alias is removed in 0.8.)`, ); } // Suppress the unused-cwd lint — cwd is reserved for future diff --git a/src/spec/attestation.ts b/src/spec/attestation.ts index 3cfd983e2d46d356adc08912d3a6c771f07f7987..4b3b2e6fb27c09a46df61061da852bd5c6510321 100644 GIT binary patch delta 30 fcmew+-XO8z1q)kDsR0m7e#ue+Wo}Mlox%nHs=*2z delta 20 ccmZpW_$I#L1q&m?(); for (const m of prose.matchAll(MD_LINK_RE)) { diff --git a/src/spec/feature-id.ts b/src/spec/feature-id.ts new file mode 100644 index 00000000..68541aff --- /dev/null +++ b/src/spec/feature-id.ts @@ -0,0 +1,17 @@ +// Cladding · spec · canonical F-id lexer — shared by the graph layer's prose scanners +// +// v0.7.0 shipped TWO diverging F-id finders: doc-references.ts matched only +// hash ids (`\bF-[0-9a-f]{6,8}\b`), so every legacy sequential id (F-001…F-083, +// 80 live shards) was invisible to the doc graph and DOC_LINK_INTEGRITY, while +// graph-health.ts carried the correct alternation. One source of truth here so +// the scan sites can never diverge again. Legacy = 3+ digits; hash = 6–8 +// lowercase hex (8 since 0.6.0, legacy 6-char stays valid — CLAUDE.md). +// Scope: prose/message SCANNING only — the anchored full-match validators +// (spec/new.ts, serve/server.ts zod schemas) are a different contract. + +export const FEATURE_ID_SOURCE = String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`; + +/** Fresh RegExp per call — a shared global regex object would leak lastIndex state. */ +export function featureIdRe(flags: string = ''): RegExp { + return new RegExp(FEATURE_ID_SOURCE, flags); +} diff --git a/src/stages/graph-health.ts b/src/stages/graph-health.ts index 60cbe06c..c3031af2 100644 --- a/src/stages/graph-health.ts +++ b/src/stages/graph-health.ts @@ -23,6 +23,8 @@ import {untestedAc} from './detectors/untested-ac.js'; import type {DriftDetector, DriftFinding} from './types.js'; import {nodeId} from '../graph/model.js'; import type {KnowledgeGraph} from '../graph/model.js'; +import {featureIdRe} from '../spec/feature-id.js'; +import {loadSpec, primeSpecCache} from '../spec/load.js'; /** Per-node conformance health: worst severity + which detectors fired. */ export interface NodeHealth { @@ -45,19 +47,18 @@ const HEALTH_DETECTORS: readonly DriftDetector[] = [ staleAttestation, ]; -const FEATURE_ID = /\bF-(?:\d{3,}|[a-f0-9]{6,8})\b/; - -/** Resolves a finding to the graph node it concerns, or null. */ -function findingNode(f: DriftFinding, ids: ReadonlySet): string | null { +/** Resolves a finding to EVERY graph node it concerns (a path badges all its + * kind-twins — module:/test:/doc: nodes of one file; first-twin-only left the + * other twins looking healthy). Empty when nothing matches. */ +function findingNodes(f: DriftFinding, ids: ReadonlySet): string[] { if (f.path) { const p = f.path.split('#')[0].trim(); // test_refs carry `file#anchor` - for (const cand of [nodeId.module(p), nodeId.test(p), nodeId.doc(p)]) { - if (ids.has(cand)) return cand; - } + const twins = [nodeId.module(p), nodeId.test(p), nodeId.doc(p)].filter((cand) => ids.has(cand)); + if (twins.length > 0) return twins; } - const m = FEATURE_ID.exec(f.message ?? ''); - if (m && ids.has(nodeId.feature(m[0]))) return nodeId.feature(m[0]); - return null; + const m = featureIdRe().exec(f.message ?? ''); + if (m && ids.has(nodeId.feature(m[0]))) return [nodeId.feature(m[0])]; + return []; } /** @@ -69,22 +70,35 @@ function findingNode(f: DriftFinding, ids: ReadonlySet): string | null { export function nodeHealth(graph: KnowledgeGraph, cwd: string = '.'): Record { const ids = new Set(graph.nodes.map((n) => n.id)); const acc: Record}> = {}; - for (const detector of HEALTH_DETECTORS) { - let findings: readonly DriftFinding[] = []; - try { - findings = detector.run({cwd}); - } catch { - continue; // a detector that can't load the spec just contributes nothing - } - for (const f of findings) { - if (f.severity !== 'error' && f.severity !== 'warn') continue; - const id = findingNode(f, ids); - if (!id) continue; - const cur = acc[id] ?? (acc[id] = {severity: 'warn', count: 0, detectors: new Set()}); - cur.count += 1; - cur.detectors.add(f.detector); - if (f.severity === 'error') cur.severity = 'error'; + // ONE spec parse for all detectors (the drift.ts run-scope pattern): each + // withSpec detector otherwise re-parses the whole shard tree — measured + // 611ms → 21ms for the loop on cladding-self. Best-effort: an unreadable + // spec leaves the cache unprimed and each detector degrades on its own. + try { + primeSpecCache(cwd, loadSpec(cwd)); + } catch { + /* unreadable spec → detectors handle it individually */ + } + try { + for (const detector of HEALTH_DETECTORS) { + let findings: readonly DriftFinding[] = []; + try { + findings = detector.run({cwd}); + } catch { + continue; // a detector that can't load the spec just contributes nothing + } + for (const f of findings) { + if (f.severity !== 'error' && f.severity !== 'warn') continue; + for (const id of findingNodes(f, ids)) { + const cur = acc[id] ?? (acc[id] = {severity: 'warn', count: 0, detectors: new Set()}); + cur.count += 1; + cur.detectors.add(f.detector); + if (f.severity === 'error') cur.severity = 'error'; + } + } } + } finally { + primeSpecCache(cwd, null); } const out: Record = {}; for (const id of Object.keys(acc).sort()) { diff --git a/tests/agents/loader.test.ts b/tests/agents/loader.test.ts index 84b72e06..8d006942 100644 --- a/tests/agents/loader.test.ts +++ b/tests/agents/loader.test.ts @@ -114,7 +114,7 @@ describe('loadPersona', () => { expect(p.body).toBe('planner body'); const written = stderrSpy.mock.calls.map((c) => String(c[0])).join(''); expect(written).toContain( - "cladding: persona 'librarian' is now 'planner' — the old id is removed in 0.7", + "cladding: persona 'librarian' is now 'planner' — the old id is removed in 0.8", ); } finally { stderrSpy.mockRestore(); @@ -133,7 +133,7 @@ describe('loadPersona', () => { expect(p.body).toBe('developer body'); const written = stderrSpy.mock.calls.map((c) => String(c[0])).join(''); expect(written).toContain( - "cladding: persona 'specialists' is now 'developer' — the old id is removed in 0.7", + "cladding: persona 'specialists' is now 'developer' — the old id is removed in 0.8", ); } finally { stderrSpy.mockRestore(); diff --git a/tests/cli/clad.test.ts b/tests/cli/clad.test.ts index 6de5897f..4c9bb704 100644 --- a/tests/cli/clad.test.ts +++ b/tests/cli/clad.test.ts @@ -517,7 +517,7 @@ describe('cli/clad — createProgram', () => { try { clad.printVerbDeprecationNotice('panel'); expect(stderrSpy.mock.calls.map((c) => String(c[0])).join('')).toBe( - "cladding: 'panel' is now 'status' — the old verb is removed in 0.7\n", + "cladding: 'panel' is now 'status' — the old verb is removed in 0.8\n", ); stderrSpy.mockClear(); clad.printVerbDeprecationNotice('status'); diff --git a/tests/cli/graph-serve.test.ts b/tests/cli/graph-serve.test.ts index 19a7d0dc..ea59094d 100644 --- a/tests/cli/graph-serve.test.ts +++ b/tests/cli/graph-serve.test.ts @@ -1,4 +1,4 @@ -import {mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import {mkdirSync, mkdtempSync, rmSync, watch, writeFileSync} from 'node:fs'; import {tmpdir} from 'node:os'; import {join} from 'node:path'; import http from 'node:http'; @@ -106,7 +106,7 @@ describe('F-64a5c159 live graph HTTP server', () => { } }); - test('a watched-file change broadcasts an SSE refresh', async () => { + test('broadcast() pushes an SSE refresh to connected clients', async () => { const srv = await createGraphServer({port: 0, cwd: dir}); const chunks: string[] = []; const req = http.get( @@ -128,4 +128,93 @@ describe('F-64a5c159 live graph HTTP server', () => { await srv.close(); } }); + + test('a REAL file change under a watched dir reaches SSE through fs.watch + debounce', async ctx => { + // Capability probe: recursive fs.watch throws on platforms without it + // (Linux + Node < 20) — the server degrades to manual refresh there. + try { + const probe = watch(dir, {recursive: true}, () => undefined); + probe.close(); + } catch { + ctx.skip(); + return; + } + // The watcher covers spec/ and docs/ — the dir must exist BEFORE boot. + mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); + const srv = await createGraphServer({port: 0, cwd: dir}); + const chunks: string[] = []; + const req = http.get( + {host: '127.0.0.1', port: srv.port, path: '/events'}, + res => { + res.setEncoding('utf8'); + res.on('data', c => { + chunks.push(c as string); + }); + }, + ); + try { + await new Promise(r => setTimeout(r, 100)); // let the connection register + writeFileSync(join(dir, 'spec', 'features', 'live-abc123.yaml'), 'id: F-abc999\n', 'utf8'); + // fs.watch delivery + the server's 400ms debounce — poll generously. + const deadline = Date.now() + 5000; + while (Date.now() < deadline && !chunks.join('').includes('data: refresh')) { + await new Promise(r => setTimeout(r, 100)); + } + expect(chunks.join('')).toContain('data: refresh'); + } finally { + req.destroy(); + await srv.close(); + } + }); + + test('an unparseable spec answers 503 with a JSON error body, never 200 (error-as-data)', async () => { + // Mid-write / truncated YAML: liveGraph() throws AFTER the old code had + // already committed writeHead(200, application/json) — clients got a 200 + // whose body was a prose YAML error. Now the body is computed first. + writeFileSync(join(dir, 'spec.yaml'), 'features:\n - id: F-abc123\n badly: indented\n', 'utf8'); + const srv = await createGraphServer({port: 0, cwd: dir}); + try { + for (const path of ['/graph.json', '/health.json', '/']) { + const r = await get(srv.port, path); + expect(r.status, `${path} must not pretend success`).toBe(503); + const doc = JSON.parse(r.body) as {error: string}; + expect(doc.error.length).toBeGreaterThan(0); + } + } finally { + await srv.close(); + } + }); + + test('a busy port rejects the boot promise cleanly instead of crashing the process', async () => { + const blocker = http.createServer(() => undefined); + await new Promise(r => blocker.listen(0, '127.0.0.1', () => r())); + const addr = blocker.address(); + const busyPort = typeof addr === 'object' && addr ? addr.port : 0; + try { + await expect(createGraphServer({port: busyPort, cwd: dir})).rejects.toThrow(/EADDRINUSE/); + } finally { + await new Promise(r => blocker.close(() => r())); + } + }); + + test('a foreign Host header is refused (DNS-rebinding guard)', async () => { + const srv = await createGraphServer({port: 0, cwd: dir}); + try { + const status = await new Promise((resolve, reject) => { + const req = http.get( + {host: '127.0.0.1', port: srv.port, path: '/graph.json', headers: {Host: 'evil.example.com'}}, + res => { + res.resume(); + resolve(res.statusCode ?? 0); + }, + ); + req.on('error', reject); + }); + expect(status).toBe(403); + const local = await get(srv.port, '/graph.json'); + expect(local.status).toBe(200); + } finally { + await srv.close(); + } + }); }); diff --git a/tests/cli/hook.test.ts b/tests/cli/hook.test.ts index f6311a09..c02ad324 100644 --- a/tests/cli/hook.test.ts +++ b/tests/cli/hook.test.ts @@ -347,6 +347,50 @@ describe('PostToolUse — debounced drift nudge', () => { expect(runHookEvent('PostToolUse', {tool_name: 'Bash', tool_input: {command: 'ls'}}, cwd)).toBe(''); expect(driftStub).not.toHaveBeenCalled(); }); + + test('impact card fires for a host-style ABSOLUTE file_path and shows the repo-relative path', () => { + // v0.7.0 regression: hosts send tool_input.file_path absolute while the + // module index keys are repo-relative — the card never rendered in real + // usage (0/361 on cladding-self). Locks the relativization seam. + writeFileSync( + join(cwd, 'spec.yaml'), + [ + 'schema: "0.1"', + 'project: {name: t, language: typescript}', + 'features:', + ' - id: F-aaa111', + ' slug: alpha', + ' title: alpha', + ' status: done', + ' modules: [src/foo.ts]', + ' acceptance_criteria:', + ' - id: AC-001', + ' ears: ubiquitous', + ' text: t', + ' test_refs: [tests/foo.test.ts]', + ' - id: F-bbb222', + ' slug: beta', + ' title: beta', + ' status: done', + ' depends_on: [F-aaa111]', + ' modules: [src/bar.ts]', + ' acceptance_criteria:', + ' - id: AC-001', + ' ears: ubiquitous', + ' text: t', + '', + ].join('\n'), + 'utf8', + ); + const out = runHookEvent( + 'PostToolUse', + {tool_name: 'Edit', tool_input: {file_path: join(cwd, 'src/foo.ts'), new_string: 'x'.repeat(50)}}, + cwd, + ); + expect(out).toContain('cladding impact: src/foo.ts → F-aaa111'); + expect(out).toContain('breaks 1 feature'); + expect(out).toContain('run 1 test'); + }); }); describe('protocol resilience', () => { diff --git a/tests/graph/model.test.ts b/tests/graph/model.test.ts index 0e83df84..2485a49a 100644 --- a/tests/graph/model.test.ts +++ b/tests/graph/model.test.ts @@ -2,7 +2,7 @@ import {mkdtempSync, rmSync} from 'node:fs'; import {tmpdir} from 'node:os'; import {join} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; -import {buildGraph, subgraph, resolveNodeId, nodeId} from '../../src/graph/model.js'; +import {buildGraph, subgraph, resolveNodeId, resolveNodeIds, nodeId} from '../../src/graph/model.js'; import type {Spec} from '../../src/spec/types.js'; describe('graph model (F-569f4b37)', () => { @@ -144,4 +144,43 @@ describe('graph model (F-569f4b37)', () => { expect(resolveNodeId(spec, g, 'zed')).toBe('feature:F-z'); expect(resolveNodeId(spec, g, 'nope')).toBeNull(); }); + + test('a path query resolves ALL kind-twins and the subgraph seeds the union', () => { + // One file, two roles: feature A lists tests/shared.test.ts as a MODULE, + // feature B cites it as a TEST — two graph nodes for one path (95 such + // paths on cladding-self). First-twin-only focus dropped B's edges. + const spec = { + schema: '0.1', + project: {name: 'x', language: 'typescript'}, + features: [ + {id: 'F-aaa111', slug: 'alpha', title: 'A', status: 'done', modules: ['tests/shared.test.ts']}, + { + id: 'F-bbb222', + slug: 'beta', + title: 'B', + status: 'done', + acceptance_criteria: [ + {id: 'AC-001', ears: 'ubiquitous', text: 't', test_refs: ['tests/shared.test.ts#covers it']}, + ], + }, + ], + scenarios: [], + capabilities: [], + } as unknown as Spec; + + const g = buildGraph(spec, cwd); + const twins = resolveNodeIds(spec, g, 'tests/shared.test.ts'); + expect(twins.sort()).toEqual(['module:tests/shared.test.ts', 'test:tests/shared.test.ts']); + + // Union focus reaches BOTH features at depth 1; the old single-twin focus reached one. + const union = subgraph(g, twins, 1); + const unionIds = union.nodes.map((n) => n.id); + expect(unionIds).toContain('feature:F-aaa111'); + expect(unionIds).toContain('feature:F-bbb222'); + const single = subgraph(g, 'module:tests/shared.test.ts', 1); + expect(single.nodes.map((n) => n.id)).not.toContain('feature:F-bbb222'); + + // The singular resolver keeps its first-twin contract for old callers. + expect(resolveNodeId(spec, g, 'tests/shared.test.ts')).toBe('module:tests/shared.test.ts'); + }); }); diff --git a/tests/optimizer/infer-depends-on.test.ts b/tests/optimizer/infer-depends-on.test.ts index 930d0461..543d41fe 100644 --- a/tests/optimizer/infer-depends-on.test.ts +++ b/tests/optimizer/infer-depends-on.test.ts @@ -156,4 +156,72 @@ describe('inferDependsOn', () => { }); expect(result.suggestions['F-a']).toContain('F-c'); }); + + // v0.7.0 shipped the whole JS/TS extraction branch with zero fixtures (all + // Python) — on a TypeScript project (cladding itself!) nothing pinned it. + describe('JS/TS extraction', () => { + test('import…from, side-effect import, and require() all resolve owned edges', () => { + const spec = makeSpec([ + feature('F-a', ['src/app/main.ts']), + feature('F-b', ['src/lib/mod.ts']), + feature('F-c', ['src/lib/side.ts']), + feature('F-d', ['src/lib/legacy.ts']), + ]); + const read: Reader = (p) => + p === 'src/app/main.ts' + ? [ + "import {x} from '../lib/mod.js';", + "import '../lib/side.js';", + "const legacy = require('src/lib/legacy');", + ].join('\n') + : null; + + const result = inferDependsOn(spec, read); + const targets = result.edges.filter((e) => e.from === 'F-a').map((e) => e.to); + expect(targets).toContain('F-b'); + expect(targets).toContain('F-c'); + expect(targets).toContain('F-d'); + }); + + test('export…from re-exports (barrel files) are dependencies — v0.7.0 missed them', () => { + const spec = makeSpec([ + feature('F-barrel', ['src/api/index.ts']), + feature('F-impl', ['src/api/impl.ts']), + ]); + const read: Reader = (p) => + p === 'src/api/index.ts' ? "export {run} from './api/impl.js';\nexport * from 'src/api/impl';\n" : null; + + const result = inferDependsOn(spec, read); + expect(result.edges).toContainEqual({from: 'F-barrel', to: 'F-impl', via: 'src/api/index.ts'}); + }); + + test("a LITERAL dynamic import('…') is an edge; a non-literal one flags the file", () => { + const spec = makeSpec([ + feature('F-a', ['src/app/lazy.ts']), + feature('F-b', ['src/lib/mod.ts']), + feature('F-x', ['src/app/plugin.ts']), + ]); + const read: Reader = (p) => { + if (p === 'src/app/lazy.ts') return "const m = await import('src/lib/mod');\n"; + if (p === 'src/app/plugin.ts') return 'const m = await import(userChoice);\n'; + return null; + }; + + const result = inferDependsOn(spec, read); + expect(result.edges).toContainEqual({from: 'F-a', to: 'F-b', via: 'src/app/lazy.ts'}); + expect(result.dynamicImportFiles).toContain('src/app/plugin.ts'); + expect(result.dynamicImportFiles).not.toContain('src/app/lazy.ts'); + }); + + test('a bare single-segment specifier stays excluded (ambiguity rule holds in TS too)', () => { + const spec = makeSpec([ + feature('F-a', ['src/app/main.ts']), + feature('F-b', ['utils.ts']), // single segment — no multi-segment key exists + ]); + const read: Reader = (p) => (p === 'src/app/main.ts' ? "import u from 'utils';\n" : null); + + const result = inferDependsOn(spec, read); + expect(result.edges).toEqual([]); + }); + }); }); diff --git a/tests/optimizer/measurement.test.ts b/tests/optimizer/measurement.test.ts index 045356a3..d2614c7e 100644 --- a/tests/optimizer/measurement.test.ts +++ b/tests/optimizer/measurement.test.ts @@ -31,7 +31,11 @@ function spec(features: Record[]): Spec { } describe('measureGraphEfficiency', () => { - test('computes the slice-vs-naive context ratio per feature', () => { + test('the injected reader feeds BOTH slice and baseline — one universe, honest ratio', () => { + // Pre-v0.7.1 the slice read the real fs while the baseline read the + // injected reader, so a virtual module inflated the shrink factor. With + // one reader the module text lands on both sides: a module that fits the + // budget makes the slice ≈ naive + metadata (ratio ≈ 1, NOT a big shrink). const s = spec([feat('F-aaa111', 'a', ['pkg/a.py'])]); const read = (p: string): string | null => p === 'pkg/a.py' ? 'x'.repeat(8000) : null; @@ -43,32 +47,46 @@ describe('measureGraphEfficiency', () => { if (row === undefined) { throw new Error('expected a measured feature row'); } - // A large module source makes the naive baseline (shard JSON + full module - // text) much bigger than the working-set slice. - expect(row.naiveTokens).toBeGreaterThan(row.sliceTokens); - expect(row.contextRatio).toBeLessThan(1); + // 8000 chars fits the default budget: the code rides the slice, so the + // slice cannot be dramatically smaller than naive — the honest reading. + expect(row.sliceTokens).toBeGreaterThan(2000); // the module text is IN the slice + expect(row.contextRatio).toBeGreaterThan(0.8); expect(row.contextRatio).toBeCloseTo(row.sliceTokens / row.naiveTokens, 5); }); - test('aggregates median shrink factor, search depth, and coverage', () => { + test('splits cap-driven shrink from structural shrink (honest attribution)', () => { const features = [ feat('F-aaa111', 'a', ['pkg/a.py']), feat('F-bbb222', 'b', ['pkg/b.py'], ['F-aaa111']), feat('F-ccc333', 'c', ['pkg/c.py'], ['F-bbb222']), ]; const s = spec(features); + // 40k-char modules: naive ≈ 10k tokens, the 3000-token default budget + // clips the code — the "shrink" is the cap's arithmetic, and the report + // must say so instead of selling it as graph value. const source: Record = { - 'pkg/a.py': 'x'.repeat(8000), - 'pkg/b.py': 'y'.repeat(9000), - 'pkg/c.py': 'z'.repeat(7000), + 'pkg/a.py': 'x'.repeat(40000), + 'pkg/b.py': 'y'.repeat(40000), + 'pkg/c.py': 'z'.repeat(40000), }; const read = (p: string): string | null => source[p] ?? null; const result = measureGraphEfficiency(s, read); expect(result.measured).toBe(features.length); - // Bigger naive source than slice ⇒ shrink factor > 1. + expect(result.context.truncatedCount).toBe(3); + expect(result.context.fitsCount).toBe(0); + // Cap-driven shrink is real arithmetic (naive >> capped slice)… + expect(result.context.medianShrinkTruncated).toBeGreaterThan(1); expect(result.context.medianShrinkFactor).toBeGreaterThan(1); + // …but the UNCAPPED structural slice is naive + metadata, ratio ≈≥ 1 — + // the graph does not structurally shrink the bytes. + expect(result.context.medianStructuralRatio).toBeGreaterThanOrEqual(0.9); + for (const row of result.features) { + expect(row.budgetSaturated).toBe(true); + expect(row.structuralTokens).toBeGreaterThan(row.sliceTokens); + } + expect(typeof result.search.medianDepth).toBe('number'); expect(result.search.medianDepth).toBeGreaterThanOrEqual(1); expect(result.stability.medianCoverage).toBeGreaterThanOrEqual(0); @@ -82,6 +100,21 @@ describe('measureGraphEfficiency', () => { expect(stopReasonSum).toBeLessThanOrEqual(result.measured); }); + test('a fitting feature counts as fits (no cap attribution) and structural == budgeted', () => { + const s = spec([feat('F-eee555', 'e', ['pkg/e.py'])]); + const read = (p: string): string | null => (p === 'pkg/e.py' ? 'x'.repeat(800) : null); + + const result = measureGraphEfficiency(s, read); + + expect(result.context.fitsCount).toBe(1); + expect(result.context.truncatedCount).toBe(0); + const row = result.features[0]; + if (row === undefined) throw new Error('expected a row'); + expect(row.budgetSaturated).toBe(false); + // identical content; only the serialized budget.max_tokens digits differ (~3 tokens) + expect(Math.abs(row.structuralTokens - row.sliceTokens)).toBeLessThanOrEqual(5); + }); + test('is deterministic for identical spec and file contents', () => { const features = [ feat('F-aaa111', 'a', ['pkg/a.py']), diff --git a/tests/optimizer/working-set.test.ts b/tests/optimizer/working-set.test.ts index 16772244..f941c609 100644 --- a/tests/optimizer/working-set.test.ts +++ b/tests/optimizer/working-set.test.ts @@ -288,4 +288,79 @@ describe('working-set', () => { const b = buildWorkingSet(spec, 'F-aaa111', {cwd: dir, maxTokens: 100000}); expect(JSON.stringify(a)).toBe(JSON.stringify(b)); }); + + test('a module query seeds ALL co-owners — their dependents and tests reach breaks_if_changed', () => { + // v0.7.0 regression: only the alphabetically-first owner was seeded, so a + // shared file's other owners contributed nothing to the blast radius + // (src/cli/clad.ts on cladding-self: impacted 0 vs 83). Simulation + // fixture, now locked as a test. + const spec = makeSpec([ + feature({ + id: 'F-aaa111', + slug: 'alpha', + title: 'Alpha', + modules: ['src/shared.ts'], + acceptance_criteria: [ac({id: 'AC-001', test_refs: []})], + }), + feature({ + id: 'F-bbb222', + slug: 'beta', + title: 'Beta', + modules: ['src/shared.ts'], + acceptance_criteria: [ac({id: 'AC-001', test_refs: ['tests/beta.test.ts']})], + }), + feature({ + id: 'F-ccc333', + slug: 'gamma', + title: 'Gamma', + depends_on: ['F-bbb222'], + acceptance_criteria: [ac({id: 'AC-001', test_refs: ['tests/gamma.test.ts']})], + }), + ]); + + const r = buildWorkingSet(spec, 'src/shared.ts') as WorkingSetShape | MissShape; + expect(isMiss(r)).toBe(false); + if (isMiss(r)) throw new Error('expected a working set'); + expect(r.must_edit.id).toBe('F-aaa111'); // focus stays the first owner + // F-ccc333 is reachable only through co-owner F-bbb222 — the fan-out. + expect(r.breaks_if_changed.impacted.map((f) => f.id)).toContain('F-ccc333'); + expect(r.breaks_if_changed.regression_tests).toContain('tests/gamma.test.ts'); + expect(r.breaks_if_changed.regression_tests).toContain('tests/beta.test.ts'); + // co-owners are seeds, not impacted — they already sit in co_owners. + expect(r.breaks_if_changed.impacted.map((f) => f.id)).not.toContain('F-bbb222'); + }); + + test('budget pressure clips deeper dependents (and reports it) but never the depth-1 direct set', () => { + const deepTitle = 'E'.repeat(300); + const directs = ['F-d00001', 'F-d00002', 'F-d00003'].map((id, i) => + feature({id, slug: `d${i}`, title: `D${i}`, depends_on: ['F-hub111']}), + ); + const deepers = Array.from({length: 10}, (_, i) => + feature({ + id: `F-e${String(i).padStart(5, '0')}`, + slug: `e${i}`, + title: deepTitle, + depends_on: ['F-d00001'], + acceptance_criteria: [ac({id: 'AC-001', test_refs: [`tests/e${i}.test.ts`]})], + }), + ); + const spec = makeSpec([feature({id: 'F-hub111', slug: 'hub', title: 'Hub'}), ...directs, ...deepers]); + + const clipped = buildWorkingSet(spec, 'F-hub111', {maxTokens: 600}) as WorkingSetShape | MissShape; + expect(isMiss(clipped)).toBe(false); + if (isMiss(clipped)) throw new Error('expected a working set'); + expect(clipped.budget.used_tokens).toBeLessThanOrEqual(600); + const keptIds = clipped.breaks_if_changed.impacted.map((f) => f.id); + for (const d of ['F-d00001', 'F-d00002', 'F-d00003']) expect(keptIds).toContain(d); // direct floor retained + expect(keptIds.length).toBeLessThan(13); // some deeper dependents dropped + expect(clipped.budget.truncated.some((t) => t.startsWith('breaks: omitted'))).toBe(true); + // the depth-1 floor's tests survive + expect(clipped.breaks_if_changed.regression_tests).toContain('tests/x.test.ts#a'); + + // Generous budget → pure no-op: full radius, no breaks marker. + const roomy = buildWorkingSet(spec, 'F-hub111', {maxTokens: 100000}) as WorkingSetShape | MissShape; + if (isMiss(roomy)) throw new Error('expected a working set'); + expect(roomy.breaks_if_changed.impacted).toHaveLength(13); + expect(roomy.budget.truncated.some((t) => t.startsWith('breaks:'))).toBe(false); + }); }); diff --git a/tests/self-consistency.test.ts b/tests/self-consistency.test.ts index e3071a5d..418d53d1 100644 --- a/tests/self-consistency.test.ts +++ b/tests/self-consistency.test.ts @@ -14,7 +14,7 @@ // a self-test gives the reference implementation honesty without imposing // it on adopters. -import {readFileSync, readdirSync} from 'node:fs'; +import {readFileSync, readdirSync, statSync} from 'node:fs'; import {join} from 'node:path'; import {describe, expect, test} from 'vitest'; @@ -119,4 +119,31 @@ describe('glossary is the terminology SSoT (F-7ce18e)', () => { expect(row, `'${oldName}' alias row must name '${newName}'`).toContain('`' + newName + '`'); } }); + + test('no source file carries a raw NUL byte (git would treat it as binary)', () => { + // v0.7.0 shipped src/graph/model.ts with literal 0x00 chars inside a + // template literal — git's binary heuristic then hid the ENTIRE file from + // every diff/blame/review ("Bin 0 -> 9363 bytes"). The escape sequence + // spelling (backslash-u-0000) is byte-identical at runtime; only the raw byte is + // banned. Scans the source tree, not node_modules/dist. + const offenders: string[] = []; + const walk = (dir: string): void => { + for (const name of readdirSync(join(ROOT, dir))) { + if (name.startsWith('.') || name === 'node_modules' || name === 'dist') continue; + const rel = join(dir, name); + let stat; + try { + stat = statSync(join(ROOT, rel)); + } catch { + continue; + } + if (stat.isDirectory()) walk(rel); + else if (/\.(ts|tsx|mts|cts|js|mjs|md|yaml|yml|json|css)$/.test(name)) { + if (readFileSync(join(ROOT, rel)).includes(0)) offenders.push(rel); + } + } + }; + for (const top of ['src', 'tests', 'spec', 'docs', 'skills', 'scripts']) walk(top); + expect(offenders, `raw 0x00 byte(s) found — use the '\\u0000' escape instead: ${offenders.join(', ')}`).toEqual([]); + }); }); diff --git a/tests/serve/server.test.ts b/tests/serve/server.test.ts index 9bd0a614..947849ac 100644 --- a/tests/serve/server.test.ts +++ b/tests/serve/server.test.ts @@ -738,7 +738,7 @@ describe('clad_get_impact (F-7794a6bc)', () => { // ─── F-64a5c159 — clad_get_graph (live knowledge graph) over MCP ─── describe('clad_get_graph (F-64a5c159)', () => { - test('clad_get_graph returns the live graph; a focus miss is isError', async () => { + test('no-query answers a stats SUMMARY (token-budget discipline), focus answers a subgraph, miss is isError', async () => { const dir = mkdtempSync(join(tmpdir(), 'clad-serve-graph-')); writeFileSync(join(dir, 'spec.yaml'), IMPACT_SPEC); mkdirSync(join(dir, '.cladding'), {recursive: true}); @@ -747,23 +747,32 @@ describe('clad_get_graph (F-64a5c159)', () => { const {tools} = await client.listTools(); expect(tools.map((t) => t.name)).toContain('clad_get_graph'); + // v0.7.1: the no-query form used to dump the WHOLE graph (~70k tokens on a + // mid-size project) into one MCP result — now it is a compact summary. const all = await client.callTool({name: 'clad_get_graph', arguments: {}}); expect(all.isError).toBeFalsy(); - const graph = JSON.parse((all.content as Array<{type: string; text: string}>)[0].text) as { + const summaryText = (all.content as Array<{type: string; text: string}>)[0].text; + const summary = JSON.parse(summaryText) as { schema_version: number; - nodes: Array<{id: string}>; - edges: unknown[]; + summary: boolean; + stats: {nodeCount: number; edgeCount: number; hubs: Array<{id: string}>}; + hint: string; }; - expect(graph.schema_version).toBe(1); - expect(graph.nodes.some((n) => n.id === 'feature:F-001')).toBe(true); - expect(graph.edges.length).toBeGreaterThan(0); + expect(summary.schema_version).toBe(1); + expect(summary.summary).toBe(true); + expect(summary.stats.nodeCount).toBeGreaterThan(0); + expect(summary.stats.hubs.length).toBeGreaterThan(0); + expect(summary.hint).toContain('clad graph export'); + expect(summaryText).not.toContain('"from"'); // no raw edge dump rides the summary const focused = await client.callTool({name: 'clad_get_graph', arguments: {query: 'F-001', max_depth: 1}}); expect(focused.isError).toBeFalsy(); const sub = JSON.parse((focused.content as Array<{type: string; text: string}>)[0].text) as { nodes: Array<{id: string}>; + edges: unknown[]; }; expect(sub.nodes.some((n) => n.id === 'feature:F-001')).toBe(true); + expect(sub.edges.length).toBeGreaterThan(0); const gmiss = await client.callTool({name: 'clad_get_graph', arguments: {query: 'nope'}}); expect(gmiss.isError).toBe(true); @@ -781,4 +790,40 @@ describe('clad_get_working_set (F-06dfdad6)', () => { expect(TOOL_NAMES).toContain('clad_get_working_set'); expect(TOOL_NAMES).toContain('clad_get_context'); // the existing context tool stays registered + frozen }); + + test('clad_get_working_set round-trips real module CODE, echoes the budget, and misses as isError', async () => { + // The only prior test asserted a hand-maintained constant against itself + // (vacuous — the handler was never invoked). This drives the real MCP path + // the way clad_get_impact's test does. + const dir = mkdtempSync(join(tmpdir(), 'clad-serve-ws-')); + writeFileSync(join(dir, 'spec.yaml'), IMPACT_SPEC); + mkdirSync(join(dir, 'src'), {recursive: true}); + writeFileSync(join(dir, 'src', 'core.ts'), 'export const CORE_MARKER = 42;\n', 'utf8'); + mkdirSync(join(dir, '.cladding'), {recursive: true}); + const {client, cleanup} = await makePair(dir); + try { + const ok = await client.callTool({name: 'clad_get_working_set', arguments: {query: 'F-001', max_tokens: 5000}}); + expect(ok.isError).toBeFalsy(); + const ws = JSON.parse((ok.content as Array<{type: string; text: string}>)[0].text) as { + schema_version: number; + must_edit: {id: string; code: Array<{path: string; text?: string}>}; + breaks_if_changed: {impacted: Array<{id: string}>; regression_tests: string[]}; + budget: {max_tokens: number; used_tokens: number}; + }; + expect(ws.schema_version).toBe(1); + expect(ws.must_edit.id).toBe('F-001'); + expect(ws.must_edit.code.some((c) => c.path === 'src/core.ts' && c.text?.includes('CORE_MARKER'))).toBe(true); + expect(ws.breaks_if_changed.impacted.map((f) => f.id)).toContain('F-002'); + expect(ws.budget.max_tokens).toBe(5000); // the argument reaches buildWorkingSet + expect(ws.budget.used_tokens).toBeGreaterThan(0); + + const miss = await client.callTool({name: 'clad_get_working_set', arguments: {query: 'nope'}}); + expect(miss.isError).toBe(true); + const parsed = JSON.parse((miss.content as Array<{type: string; text: string}>)[0].text) as {not_found: string}; + expect(parsed.not_found).toBe('nope'); + } finally { + await cleanup(); + rmSync(dir, {recursive: true, force: true}); + } + }); }); diff --git a/tests/spec/doc-references.test.ts b/tests/spec/doc-references.test.ts index c5eb804e..d609d035 100644 --- a/tests/spec/doc-references.test.ts +++ b/tests/spec/doc-references.test.ts @@ -30,6 +30,16 @@ describe('doc-references', () => { const byDoc = (s: {docs: readonly DocEntry[]}): Record => Object.fromEntries(s.docs.map((d) => [d.doc, d])); + test('legacy sequential F-NNN ids are extracted alongside hash ids (shared lexer)', () => { + // v0.7.0 regression: the doc axis matched only 6-8 hex ids, so prose + // referencing legacy shards (F-001…F-083, still live) produced no edges + // and no DOC_LINK_INTEGRITY validation. The shared feature-id lexer + // (src/spec/feature-id.ts) restores them. + wdoc('docs/legacy.md', 'Shipped in **v0.2.24 (F-073)** and F-049; hash sibling F-ee47fc2b. `F-001` in a code span stays ignored.'); + const m = byDoc(extractDocReferences(dir)); + expect(m['docs/legacy.md'].features).toEqual(['F-049', 'F-073', 'F-ee47fc2b']); + }); + test('extracts F-ids and resolved .md links, excluding fixture dirs and code spans', () => { wdoc('docs/a.md', 'see F-ee47fc2b and F-7794a6bc here. [link](./b.md). inline `F-cafef00d` ignored.'); wdoc('docs/b.md', '# b'); From 033b1487e39a4f9742566610d771833ad97f50d9 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Thu, 2 Jul 2026 18:14:42 +0900 Subject: [PATCH 5/6] =?UTF-8?q?feat(graph):=20fallback=20safety=20contract?= =?UTF-8?q?=20=E2=80=94=20a=20graph=20answer=20that=20cannot=20know=20says?= =?UTF-8?q?=20so=20(F-c6a32fff)=20(#226)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The graph layer's miss/exception handling was solid, but three verified holes let "unknown" read as "safe" — every fix design was simulated against real repo data before implementation (one proposed fix was invalidated by the simulation and dropped: promoting clad_get_impact to the iterative slice would have silently shrunk 41% of responses). Ledger honesty: every impact slice now carries spec-wide edge counts {depends_on_edges, test_ref_edges}. On a blank ledger (measured on a 196-feature clone: a feature with 10 real dependents answered impacted:[] coverage:1.0, byte-identical to a verified leaf) the answer gains fallback hints — unknown, not safe; fall back to grep / the full suite. Zero known dependents stops with 'no-known-dependents' + coverage:null (44% of cladding-self features take this path); the working-set radius carries the denominator and guards the JS null→0 coercion the simulation caught. The impact card discloses '· deps unledgered'. Hook scoping: Stop and PostToolUse now mirror SessionStart's spec.yaml guard — a non-cladding cwd (or a monorepo subdir; hook cwd is process.cwd()) used to get falsely BLOCKED by ABSENCE_OF_GOVERNANCE with .cladding/ state written into the foreign tree (reproduced with the shipped bundle). Not under cladding → silence, zero writes; a present-but-broken spec keeps its honest one-time block. Gate footer: an engine fault fabricated {pass:true} on the one structural channel hook-less hosts see — now fails closed with {pass:false, unavailable:true} (pass stays, per the F-570a3f wire contract). The four graph MCP tools adopt the loadSpecOrError guidance (was raw ENOENT), clad_get_graph misses gain the discovery hint, and discovery hints name the baseline fallback. SessionStart renders an unparseable spec with no resolvable counts as 'counts unavailable' (conditional — a healthy spec/index.yaml still renders true counts). Feature cycle: shard F-c6a32fff authored via clad_create_feature, all 6 ACs test_ref-wired, flipped done through the strict pre-push gate. e2e-verified on the built binary: dense ledger {246,323} no hints / blank ledger {0,0} both hints / spec-less Stop silent with no .cladding. Co-authored-by: Claude Fable 5 --- CHANGELOG.md | 32 ++ plugins/claude-code/dist/clad.js | 530 +++++++++--------- spec.yaml | 4 +- spec/attestation.yaml | 49 +- spec/capabilities.yaml | 2 +- .../graph-honest-fallback-c6a32fff.yaml | 71 +++ spec/index.yaml | 1 + src/cli/hook.ts | 23 +- src/optimizer/context-slice.ts | 4 +- src/optimizer/iterative-slice.ts | 24 +- src/optimizer/measurement.ts | 9 +- src/optimizer/reverse-slice.ts | 47 +- src/optimizer/working-set.ts | 23 +- src/serve/server.ts | 42 +- tests/cli/hook.test.ts | 54 ++ tests/cli/impact-card.test.ts | 35 ++ tests/optimizer/iterative-slice.test.ts | 14 + tests/optimizer/reverse-slice.test.ts | 36 ++ tests/optimizer/working-set.test.ts | 21 + tests/serve/gate-footer-unavailable.test.ts | 61 ++ tests/serve/server.test.ts | 9 + 21 files changed, 775 insertions(+), 316 deletions(-) create mode 100644 spec/features/graph-honest-fallback-c6a32fff.yaml create mode 100644 tests/serve/gate-footer-unavailable.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 38f25efe..07811ac6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,40 @@ Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added + +- **Fallback safety contract — the graph says "unknown" instead of "safe".** + Every impact answer now carries the spec-wide edge counts (`ledger`): on a + project whose dependency ledger is empty (every freshly adopted project), + `impacted: []` used to be byte-identical to a verified leaf — measured on a + real 196-feature clone, a feature with 10 actual dependents answered + "nothing breaks, coverage 1.0". A blank ledger now answers with explicit + zero-counts plus a hint to fall back to normal code search / the full test + suite; a feature with zero known dependents stops with + `no-known-dependents` and `coverage: null` (never a vacuous 100%), and the + working-set radius carries the denominator. The after-edit impact card + discloses `deps unledgered` on blank ledgers. + ### Fixed +- **Hooks no longer gate projects that never adopted cladding.** In a cwd + without spec.yaml (a non-cladding repo, or a subdirectory of a cladding + monorepo), the Stop hook falsely blocked the session once with + "governance absent" findings and wrote `.cladding/` state into the foreign + tree; the PostToolUse nudge did the same. Both now mirror the SessionStart + guard: not under cladding → silence, zero writes. (A present-but-broken + spec keeps its honest one-time block.) +- **A gate that could not run no longer reports GREEN.** The gate footer on + mutating MCP tool results — the only structural channel for hosts without + lifecycle hooks — fabricated `{pass: true}` when the drift engine itself + threw; it now fails closed with `{pass: false, unavailable: true}` and + points at `clad check --strict`. +- **Every graph-tool failure now says how to proceed without the graph.** + Absent spec → the "run `clad init`" guidance (was a raw ENOENT) on all four + graph tools; query misses carry the discovery hint on `clad_get_graph` too, + and discovery hints name the baseline fallback (normal code search). The + SessionStart card renders an unparseable spec with no resolvable counts as + "counts unavailable" instead of a healthy-looking "0 features". - **The after-edit impact card now actually fires.** Hosts send absolute file paths while the spec's module index is repo-relative, so the PostToolUse impact card (0.7.0) never rendered in real usage — 0/361 module paths resolved diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index a52cb026..0d47797d 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,102 +4,102 @@ const require = __claddingCreateRequire(import.meta.url); // Marker for stages/*.ts: when true, the per-stage CLI-entry guard // short-circuits so the bundle doesn't fire every stage at startup. globalThis.__CLADDING_BUNDLED = true; -var Cae=Object.create;var zk=Object.defineProperty;var Dae=Object.getOwnPropertyDescriptor;var Nae=Object.getOwnPropertyNames;var jae=Object.getPrototypeOf,Mae=Object.prototype.hasOwnProperty;var Be=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Er=(t,e)=>{for(var r in e)zk(t,r,{get:e[r],enumerable:!0})},Fae=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Nae(e))!Mae.call(t,i)&&i!==r&&zk(t,i,{get:()=>e[i],enumerable:!(n=Dae(e,i))||n.enumerable});return t};var kt=(t,e,r)=>(r=t!=null?Cae(jae(t)):{},Fae(e||!t||!t.__esModule?zk(r,"default",{value:t,enumerable:!0}):r,t));var rd=v(Uk=>{var Jh=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},Lk=class extends Jh{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Uk.CommanderError=Jh;Uk.InvalidArgumentError=Lk});var Yh=v(Bk=>{var{InvalidArgumentError:zae}=rd(),qk=class{constructor(e,r){switch(this.description=r||"",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.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new zae(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Lae(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}Bk.Argument=qk;Bk.humanReadableArgName=Lae});var Gk=v(Zk=>{var{humanReadableArgName:Uae}=Yh(),Hk=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>Uae(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` +var Cae=Object.create;var Uk=Object.defineProperty;var Dae=Object.getOwnPropertyDescriptor;var Nae=Object.getOwnPropertyNames;var jae=Object.getPrototypeOf,Mae=Object.prototype.hasOwnProperty;var Be=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Er=(t,e)=>{for(var r in e)Uk(t,r,{get:e[r],enumerable:!0})},Fae=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Nae(e))!Mae.call(t,i)&&i!==r&&Uk(t,i,{get:()=>e[i],enumerable:!(n=Dae(e,i))||n.enumerable});return t};var kt=(t,e,r)=>(r=t!=null?Cae(jae(t)):{},Fae(e||!t||!t.__esModule?Uk(r,"default",{value:t,enumerable:!0}):r,t));var nd=v(Bk=>{var Xh=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},qk=class extends Xh{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Bk.CommanderError=Xh;Bk.InvalidArgumentError=qk});var Qh=v(Zk=>{var{InvalidArgumentError:zae}=nd(),Hk=class{constructor(e,r){switch(this.description=r||"",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.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new zae(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Lae(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}Zk.Argument=Hk;Zk.humanReadableArgName=Lae});var Wk=v(Vk=>{var{humanReadableArgName:Uae}=Qh(),Gk=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>Uae(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` `)}displayWidth(e){return F2(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return u{let a=s.match(i);if(a===null){o.push("");return}let c=[a.shift()],l=this.displayWidth(c[0]);a.forEach(u=>{let d=this.displayWidth(u);if(l+d<=r){c.push(u),l+=d;return}o.push(c.join(""));let f=u.trimStart();c=[f],l=this.displayWidth(f)}),o.push(c.join(""))}),o.join(` -`)}};function F2(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}Zk.Help=Hk;Zk.stripColor=F2});var Jk=v(Kk=>{var{InvalidArgumentError:qae}=rd(),Vk=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=Bae(e);this.short=n.shortFlag,this.long=n.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,this.helpGroupHeading=void 0}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),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}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new qae(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?z2(this.name().replace(/^no-/,"")):z2(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Wk=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function z2(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Bae(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} +`)}};function F2(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}Vk.Help=Gk;Vk.stripColor=F2});var Xk=v(Yk=>{var{InvalidArgumentError:qae}=nd(),Kk=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=Bae(e);this.short=n.shortFlag,this.long=n.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,this.helpGroupHeading=void 0}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),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}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new qae(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?z2(this.name().replace(/^no-/,"")):z2(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Jk=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function z2(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Bae(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} - a short flag is a single dash and a single character - either use a single dash and a single character (for a short flag) - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a} - too many short flags`):i.test(s)?new Error(`${a} - too many long flags`):new Error(`${a} -- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}Kk.Option=Vk;Kk.DualOptions=Wk});var U2=v(L2=>{function Hae(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function Zae(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=Hae(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` +- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}Yk.Option=Kk;Yk.DualOptions=Jk});var U2=v(L2=>{function Hae(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function Zae(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=Hae(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` (Did you mean one of ${n.join(", ")}?)`:n.length===1?` -(Did you mean ${n[0]}?)`:""}L2.suggestSimilar=Zae});var Z2=v(tE=>{var Gae=Be("node:events").EventEmitter,Yk=Be("node:child_process"),Hi=Be("node:path"),Xh=Be("node:fs"),Ue=Be("node:process"),{Argument:Vae,humanReadableArgName:Wae}=Yh(),{CommanderError:Xk}=rd(),{Help:Kae,stripColor:Jae}=Gk(),{Option:q2,DualOptions:Yae}=Jk(),{suggestSimilar:B2}=U2(),Qk=class t extends Gae{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,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._savedState=null,this._outputConfiguration={writeOut:r=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>eE()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>eE()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Jae(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}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 r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new Kae,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...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,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name +(Did you mean ${n[0]}?)`:""}L2.suggestSimilar=Zae});var Z2=v(nE=>{var Gae=Be("node:events").EventEmitter,Qk=Be("node:child_process"),Hi=Be("node:path"),eg=Be("node:fs"),Ue=Be("node:process"),{Argument:Vae,humanReadableArgName:Wae}=Qh(),{CommanderError:eE}=nd(),{Help:Kae,stripColor:Jae}=Wk(),{Option:q2,DualOptions:Yae}=Xk(),{suggestSimilar:B2}=U2(),tE=class t extends Gae{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,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._savedState=null,this._outputConfiguration={writeOut:r=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>rE()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>rE()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Jae(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}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 r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new Kae,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...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,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new Vae(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.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,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"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,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(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,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. -Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new Xk(e,r,n)),Ue.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new q2(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=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 '${n}' +Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new eE(e,r,n)),Ue.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new q2(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=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 '${n}' - already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof q2)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}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,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":Ue.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. -- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(Xh.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist +- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(eg.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=Hi.resolve(u,d);if(Xh.existsSync(f))return f;if(i.includes(Hi.extname(d)))return;let p=i.find(m=>Xh.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Xh.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=Hi.resolve(Hi.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=Hi.basename(this._scriptPath,Hi.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(Hi.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=H2(Ue.execArgv).concat(r),c=Yk.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=Yk.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=H2(Ue.execArgv).concat(r),c=Yk.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new Xk(u,"commander.executeSubCommandAsync","(close)")):Ue.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)Ue.exit(1);else{let d=new Xk(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==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=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} + - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=Hi.resolve(u,d);if(eg.existsSync(f))return f;if(i.includes(Hi.extname(d)))return;let p=i.find(m=>eg.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=eg.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=Hi.resolve(Hi.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=Hi.basename(this._scriptPath,Hi.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(Hi.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=H2(Ue.execArgv).concat(r),c=Qk.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=Qk.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=H2(Ue.execArgv).concat(r),c=Qk.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new eE(u,"commander.executeSubCommandAsync","(close)")):Ue.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)Ue.exit(1);else{let d=new eE(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==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=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` `),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Ue.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Yae(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=B2(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=B2(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} `),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>Wae(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Hi.basename(e,Hi.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(Ue.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,o=>{let s;typeof r=="function"?s=r({error:o.error,command:o.command}):s=r,s&&o.write(`${s} -`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function H2(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function eE(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}tE.Command=Qk;tE.useColor=eE});var K2=v(fn=>{var{Argument:G2}=Yh(),{Command:rE}=Z2(),{CommanderError:Xae,InvalidArgumentError:V2}=rd(),{Help:Qae}=Gk(),{Option:W2}=Jk();fn.program=new rE;fn.createCommand=t=>new rE(t);fn.createOption=(t,e)=>new W2(t,e);fn.createArgument=(t,e)=>new G2(t,e);fn.Command=rE;fn.Option=W2;fn.Argument=G2;fn.Help=Qae;fn.CommanderError=Xae;fn.InvalidArgumentError=V2;fn.InvalidOptionArgumentError=V2});var Pe=v(Jt=>{"use strict";var iE=Symbol.for("yaml.alias"),Q2=Symbol.for("yaml.document"),Qh=Symbol.for("yaml.map"),eU=Symbol.for("yaml.pair"),oE=Symbol.for("yaml.scalar"),eg=Symbol.for("yaml.seq"),Zi=Symbol.for("yaml.node.type"),oce=t=>!!t&&typeof t=="object"&&t[Zi]===iE,sce=t=>!!t&&typeof t=="object"&&t[Zi]===Q2,ace=t=>!!t&&typeof t=="object"&&t[Zi]===Qh,cce=t=>!!t&&typeof t=="object"&&t[Zi]===eU,tU=t=>!!t&&typeof t=="object"&&t[Zi]===oE,lce=t=>!!t&&typeof t=="object"&&t[Zi]===eg;function rU(t){if(t&&typeof t=="object")switch(t[Zi]){case Qh:case eg:return!0}return!1}function uce(t){if(t&&typeof t=="object")switch(t[Zi]){case iE:case Qh:case oE:case eg:return!0}return!1}var dce=t=>(tU(t)||rU(t))&&!!t.anchor;Jt.ALIAS=iE;Jt.DOC=Q2;Jt.MAP=Qh;Jt.NODE_TYPE=Zi;Jt.PAIR=eU;Jt.SCALAR=oE;Jt.SEQ=eg;Jt.hasAnchor=dce;Jt.isAlias=oce;Jt.isCollection=rU;Jt.isDocument=sce;Jt.isMap=ace;Jt.isNode=uce;Jt.isPair=cce;Jt.isScalar=tU;Jt.isSeq=lce});var nd=v(sE=>{"use strict";var Mt=Pe(),Ar=Symbol("break visit"),nU=Symbol("skip children"),li=Symbol("remove node");function tg(t,e){let r=iU(e);Mt.isDocument(t)?sc(null,t.contents,r,Object.freeze([t]))===li&&(t.contents=null):sc(null,t,r,Object.freeze([]))}tg.BREAK=Ar;tg.SKIP=nU;tg.REMOVE=li;function sc(t,e,r,n){let i=oU(t,e,r,n);if(Mt.isNode(i)||Mt.isPair(i))return sU(t,n,i),sc(t,i,r,n);if(typeof i!="symbol"){if(Mt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var aU=Pe(),fce=nd(),pce={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},mce=t=>t.replace(/[!,[\]{}]/g,e=>pce[e]),id=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+mce(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&aU.isNode(e.contents)){let o={};fce.visit(e.contents,(s,a)=>{aU.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` -`)}};id.defaultYaml={explicit:!1,version:"1.2"};id.defaultTags={"!!":"tag:yaml.org,2002:"};cU.Directives=id});var ng=v(od=>{"use strict";var lU=Pe(),hce=nd();function gce(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function uU(t){let e=new Set;return hce.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function dU(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function yce(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=uU(t));let s=dU(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(lU.isScalar(s.node)||lU.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}od.anchorIsValid=gce;od.anchorNames=uU;od.createNodeAnchors=yce;od.findNewAnchor=dU});var cE=v(fU=>{"use strict";function sd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var _ce=Pe();function pU(t,e,r){if(Array.isArray(t))return t.map((n,i)=>pU(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!_ce.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}mU.toJS=pU});var ig=v(gU=>{"use strict";var bce=cE(),hU=Pe(),vce=Eo(),lE=class{constructor(e){Object.defineProperty(this,hU.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!hU.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=vce.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?bce.applyReviver(o,{"":a},"",a):a}};gU.NodeBase=lE});var ad=v(yU=>{"use strict";var Sce=ng(),wce=nd(),cc=Pe(),xce=ig(),$ce=Eo(),uE=class extends xce.NodeBase{constructor(e){super(cc.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],wce.visit(e,{Node:(o,s)=>{(cc.isAlias(s)||cc.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||($ce.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=og(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Sce.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function og(t,e,r){if(cc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(cc.isCollection(e)){let n=0;for(let i of e.items){let o=og(t,i,r);o>n&&(n=o)}return n}else if(cc.isPair(e)){let n=og(t,e.key,r),i=og(t,e.value,r);return Math.max(n,i)}return 1}yU.Alias=uE});var Pt=v(dE=>{"use strict";var kce=Pe(),Ece=ig(),Ace=Eo(),Tce=t=>!t||typeof t!="function"&&typeof t!="object",Ao=class extends Ece.NodeBase{constructor(e){super(kce.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Ace.toJS(this.value,e,r)}toString(){return String(this.value)}};Ao.BLOCK_FOLDED="BLOCK_FOLDED";Ao.BLOCK_LITERAL="BLOCK_LITERAL";Ao.PLAIN="PLAIN";Ao.QUOTE_DOUBLE="QUOTE_DOUBLE";Ao.QUOTE_SINGLE="QUOTE_SINGLE";dE.Scalar=Ao;dE.isScalarValue=Tce});var cd=v(bU=>{"use strict";var Oce=ad(),Ls=Pe(),_U=Pt(),Ice="tag:yaml.org,2002:";function Pce(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Rce(t,e,r){if(Ls.isDocument(t)&&(t=t.contents),Ls.isNode(t))return t;if(Ls.isPair(t)){let d=r.schema[Ls.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Oce.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Ice+e.slice(2));let l=Pce(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new _U.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[Ls.MAP]:Symbol.iterator in Object(t)?s[Ls.SEQ]:s[Ls.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new _U.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}bU.createNode=Rce});var ag=v(sg=>{"use strict";var Cce=cd(),ui=Pe(),Dce=ig();function fE(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Cce.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var vU=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,pE=class extends Dce.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>ui.isNode(n)||ui.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(vU(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(ui.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,fE(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(ui.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&ui.isScalar(o)?o.value:o:ui.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!ui.isPair(r))return!1;let n=r.value;return n==null||e&&ui.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return ui.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(ui.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,fE(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};sg.Collection=pE;sg.collectionFromPath=fE;sg.isEmptyPath=vU});var ld=v(cg=>{"use strict";var Nce=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function mE(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var jce=(t,e,r)=>t.endsWith(` -`)?mE(r,e):r.includes(` +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function H2(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function rE(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}nE.Command=tE;nE.useColor=rE});var K2=v(pn=>{var{Argument:G2}=Qh(),{Command:iE}=Z2(),{CommanderError:Xae,InvalidArgumentError:V2}=nd(),{Help:Qae}=Wk(),{Option:W2}=Xk();pn.program=new iE;pn.createCommand=t=>new iE(t);pn.createOption=(t,e)=>new W2(t,e);pn.createArgument=(t,e)=>new G2(t,e);pn.Command=iE;pn.Option=W2;pn.Argument=G2;pn.Help=Qae;pn.CommanderError=Xae;pn.InvalidArgumentError=V2;pn.InvalidOptionArgumentError=V2});var Pe=v(Jt=>{"use strict";var sE=Symbol.for("yaml.alias"),Q2=Symbol.for("yaml.document"),tg=Symbol.for("yaml.map"),eU=Symbol.for("yaml.pair"),aE=Symbol.for("yaml.scalar"),rg=Symbol.for("yaml.seq"),Zi=Symbol.for("yaml.node.type"),oce=t=>!!t&&typeof t=="object"&&t[Zi]===sE,sce=t=>!!t&&typeof t=="object"&&t[Zi]===Q2,ace=t=>!!t&&typeof t=="object"&&t[Zi]===tg,cce=t=>!!t&&typeof t=="object"&&t[Zi]===eU,tU=t=>!!t&&typeof t=="object"&&t[Zi]===aE,lce=t=>!!t&&typeof t=="object"&&t[Zi]===rg;function rU(t){if(t&&typeof t=="object")switch(t[Zi]){case tg:case rg:return!0}return!1}function uce(t){if(t&&typeof t=="object")switch(t[Zi]){case sE:case tg:case aE:case rg:return!0}return!1}var dce=t=>(tU(t)||rU(t))&&!!t.anchor;Jt.ALIAS=sE;Jt.DOC=Q2;Jt.MAP=tg;Jt.NODE_TYPE=Zi;Jt.PAIR=eU;Jt.SCALAR=aE;Jt.SEQ=rg;Jt.hasAnchor=dce;Jt.isAlias=oce;Jt.isCollection=rU;Jt.isDocument=sce;Jt.isMap=ace;Jt.isNode=uce;Jt.isPair=cce;Jt.isScalar=tU;Jt.isSeq=lce});var id=v(cE=>{"use strict";var Mt=Pe(),Ar=Symbol("break visit"),nU=Symbol("skip children"),li=Symbol("remove node");function ng(t,e){let r=iU(e);Mt.isDocument(t)?cc(null,t.contents,r,Object.freeze([t]))===li&&(t.contents=null):cc(null,t,r,Object.freeze([]))}ng.BREAK=Ar;ng.SKIP=nU;ng.REMOVE=li;function cc(t,e,r,n){let i=oU(t,e,r,n);if(Mt.isNode(i)||Mt.isPair(i))return sU(t,n,i),cc(t,i,r,n);if(typeof i!="symbol"){if(Mt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var aU=Pe(),fce=id(),pce={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},mce=t=>t.replace(/[!,[\]{}]/g,e=>pce[e]),od=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+mce(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&aU.isNode(e.contents)){let o={};fce.visit(e.contents,(s,a)=>{aU.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` +`)}};od.defaultYaml={explicit:!1,version:"1.2"};od.defaultTags={"!!":"tag:yaml.org,2002:"};cU.Directives=od});var og=v(sd=>{"use strict";var lU=Pe(),hce=id();function gce(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function uU(t){let e=new Set;return hce.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function dU(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function yce(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=uU(t));let s=dU(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(lU.isScalar(s.node)||lU.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}sd.anchorIsValid=gce;sd.anchorNames=uU;sd.createNodeAnchors=yce;sd.findNewAnchor=dU});var uE=v(fU=>{"use strict";function ad(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var _ce=Pe();function pU(t,e,r){if(Array.isArray(t))return t.map((n,i)=>pU(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!_ce.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}mU.toJS=pU});var sg=v(gU=>{"use strict";var bce=uE(),hU=Pe(),vce=Eo(),dE=class{constructor(e){Object.defineProperty(this,hU.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!hU.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=vce.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?bce.applyReviver(o,{"":a},"",a):a}};gU.NodeBase=dE});var cd=v(yU=>{"use strict";var Sce=og(),wce=id(),uc=Pe(),xce=sg(),$ce=Eo(),fE=class extends xce.NodeBase{constructor(e){super(uc.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],wce.visit(e,{Node:(o,s)=>{(uc.isAlias(s)||uc.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||($ce.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=ag(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Sce.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function ag(t,e,r){if(uc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(uc.isCollection(e)){let n=0;for(let i of e.items){let o=ag(t,i,r);o>n&&(n=o)}return n}else if(uc.isPair(e)){let n=ag(t,e.key,r),i=ag(t,e.value,r);return Math.max(n,i)}return 1}yU.Alias=fE});var Pt=v(pE=>{"use strict";var kce=Pe(),Ece=sg(),Ace=Eo(),Tce=t=>!t||typeof t!="function"&&typeof t!="object",Ao=class extends Ece.NodeBase{constructor(e){super(kce.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Ace.toJS(this.value,e,r)}toString(){return String(this.value)}};Ao.BLOCK_FOLDED="BLOCK_FOLDED";Ao.BLOCK_LITERAL="BLOCK_LITERAL";Ao.PLAIN="PLAIN";Ao.QUOTE_DOUBLE="QUOTE_DOUBLE";Ao.QUOTE_SINGLE="QUOTE_SINGLE";pE.Scalar=Ao;pE.isScalarValue=Tce});var ld=v(bU=>{"use strict";var Oce=cd(),Us=Pe(),_U=Pt(),Ice="tag:yaml.org,2002:";function Pce(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Rce(t,e,r){if(Us.isDocument(t)&&(t=t.contents),Us.isNode(t))return t;if(Us.isPair(t)){let d=r.schema[Us.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Oce.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Ice+e.slice(2));let l=Pce(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new _U.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[Us.MAP]:Symbol.iterator in Object(t)?s[Us.SEQ]:s[Us.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new _U.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}bU.createNode=Rce});var lg=v(cg=>{"use strict";var Cce=ld(),ui=Pe(),Dce=sg();function mE(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Cce.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var vU=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,hE=class extends Dce.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>ui.isNode(n)||ui.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(vU(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(ui.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,mE(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(ui.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&ui.isScalar(o)?o.value:o:ui.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!ui.isPair(r))return!1;let n=r.value;return n==null||e&&ui.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return ui.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(ui.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,mE(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};cg.Collection=hE;cg.collectionFromPath=mE;cg.isEmptyPath=vU});var ud=v(ug=>{"use strict";var Nce=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function gE(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var jce=(t,e,r)=>t.endsWith(` +`)?gE(r,e):r.includes(` `)?` -`+mE(r,e):(t.endsWith(" ")?"":" ")+r;cg.indentComment=mE;cg.lineComment=jce;cg.stringifyComment=Nce});var wU=v(ud=>{"use strict";var Mce="flow",hE="block",lg="quoted";function Fce(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===hE&&(h=SU(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===lg&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` -`)r===hE&&(h=SU(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+gE(r,e):(t.endsWith(" ")?"":" ")+r;ug.indentComment=gE;ug.lineComment=jce;ug.stringifyComment=Nce});var wU=v(dd=>{"use strict";var Mce="flow",yE="block",dg="quoted";function Fce(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===yE&&(h=SU(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===dg&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` +`)r===yE&&(h=SU(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` `&&p!==" "){let x=t[h+1];x&&x!==" "&&x!==` -`&&x!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===lg){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let x=h>b+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===dg){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let x=h>b+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S{"use strict";var Mn=Pt(),To=wU(),dg=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),fg=t=>/^(%|---|\.\.\.)/m.test(t);function zce(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function dd(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(fg(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length{"use strict";var Mn=Pt(),To=wU(),pg=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),mg=t=>/^(%|---|\.\.\.)/m.test(t);function zce(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function fd(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(mg(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length `;let d,f;for(f=r.length;f>0;--f){let w=r[f-1];if(w!==` `&&w!==" "&&w!==" ")break}let p=r.substring(f),m=p.indexOf(` `);m===-1?d="-":r===p||m!==p.length-1?(d="+",o&&o()):d="",p&&(r=r.slice(0,-p.length),p[p.length-1]===` -`&&(p=p.slice(0,-1)),p=p.replace(yE,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{R=!0});let E=To.foldFlowLines(`${_}${w}${p}`,l,To.FOLD_BLOCK,A);if(!R)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),R=!1,A=pg(n,!0);s!=="folded"&&e!==Mn.Scalar.BLOCK_FOLDED&&(A.onOverflow=()=>{R=!0});let E=To.foldFlowLines(`${_}${w}${p}`,l,To.FOLD_BLOCK,A);if(!R)return`>${x} ${l}${E}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} ${l}${_}${r}${p}`}function Lce(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` -`)||u&&/[[\]{},]/.test(o))return lc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?lc(o,e):ug(t,e,r,n);if(!a&&!u&&i!==Mn.Scalar.PLAIN&&o.includes(` -`))return ug(t,e,r,n);if(fg(o)){if(c==="")return e.forceBlockIndent=!0,ug(t,e,r,n);if(a&&c===l)return lc(o,e)}let d=o.replace(/\n+/g,`$& -${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return lc(o,e)}return a?d:To.foldFlowLines(d,c,To.FOLD_FLOW,dg(e,!1))}function Uce(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Mn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Mn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Mn.Scalar.BLOCK_FOLDED:case Mn.Scalar.BLOCK_LITERAL:return i||o?lc(s.value,e):ug(s,e,r,n);case Mn.Scalar.QUOTE_DOUBLE:return dd(s.value,e);case Mn.Scalar.QUOTE_SINGLE:return gE(s.value,e);case Mn.Scalar.PLAIN:return Lce(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}xU.stringifyString=Uce});var pd=v(_E=>{"use strict";var qce=ng(),Oo=Pe(),Bce=ld(),Hce=fd();function Zce(t,e){let r=Object.assign({blockQuote:!0,commentString:Bce.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function Gce(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Oo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function Vce(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Oo.isScalar(t)||Oo.isCollection(t))&&t.anchor;o&&qce.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function Wce(t,e,r,n){if(Oo.isPair(t))return t.toString(e,r,n);if(Oo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Oo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Gce(e.doc.schema.tags,o));let s=Vce(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Oo.isScalar(o)?Hce.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Oo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}_E.createStringifyContext=Zce;_E.stringify=Wce});var AU=v(EU=>{"use strict";var Gi=Pe(),$U=Pt(),kU=pd(),md=ld();function Kce({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=Gi.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Gi.isCollection(t)||!Gi.isNode(t)&&typeof t=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||Gi.isCollection(t)||(Gi.isScalar(t)?t.type===$U.Scalar.BLOCK_FOLDED||t.type===$U.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=kU.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=md.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=md.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=md.lineComment(g,r.indent,l(f))));let b,_,S;Gi.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&Gi.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&Gi.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=kU.stringify(e,r,()=>x=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` +`)||u&&/[[\]{},]/.test(o))return dc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?dc(o,e):fg(t,e,r,n);if(!a&&!u&&i!==Mn.Scalar.PLAIN&&o.includes(` +`))return fg(t,e,r,n);if(mg(o)){if(c==="")return e.forceBlockIndent=!0,fg(t,e,r,n);if(a&&c===l)return dc(o,e)}let d=o.replace(/\n+/g,`$& +${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return dc(o,e)}return a?d:To.foldFlowLines(d,c,To.FOLD_FLOW,pg(e,!1))}function Uce(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Mn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Mn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Mn.Scalar.BLOCK_FOLDED:case Mn.Scalar.BLOCK_LITERAL:return i||o?dc(s.value,e):fg(s,e,r,n);case Mn.Scalar.QUOTE_DOUBLE:return fd(s.value,e);case Mn.Scalar.QUOTE_SINGLE:return _E(s.value,e);case Mn.Scalar.PLAIN:return Lce(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}xU.stringifyString=Uce});var md=v(vE=>{"use strict";var qce=og(),Oo=Pe(),Bce=ud(),Hce=pd();function Zce(t,e){let r=Object.assign({blockQuote:!0,commentString:Bce.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function Gce(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Oo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function Vce(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Oo.isScalar(t)||Oo.isCollection(t))&&t.anchor;o&&qce.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function Wce(t,e,r,n){if(Oo.isPair(t))return t.toString(e,r,n);if(Oo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Oo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Gce(e.doc.schema.tags,o));let s=Vce(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Oo.isScalar(o)?Hce.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Oo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}vE.createStringifyContext=Zce;vE.stringify=Wce});var AU=v(EU=>{"use strict";var Gi=Pe(),$U=Pt(),kU=md(),hd=ud();function Kce({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=Gi.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Gi.isCollection(t)||!Gi.isNode(t)&&typeof t=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||Gi.isCollection(t)||(Gi.isScalar(t)?t.type===$U.Scalar.BLOCK_FOLDED||t.type===$U.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=kU.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=hd.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=hd.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=hd.lineComment(g,r.indent,l(f))));let b,_,S;Gi.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&Gi.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&Gi.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=kU.stringify(e,r,()=>x=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` `:"",_){let A=l(_);R+=` -${md.indentComment(A,r.indent)}`}w===""&&!r.inFlow?R===` +${hd.indentComment(A,r.indent)}`}w===""&&!r.inFlow?R===` `&&S&&(R=` `):R+=` ${r.indent}`}else if(!p&&Gi.isCollection(e)){let A=w[0],E=w.indexOf(` `),C=E!==-1,k=r.inFlow??e.flow??e.items.length===0;if(C||!k){let L=!1;if(C&&(A==="&"||A==="!")){let te=w.indexOf(" ");A==="&"&&te!==-1&&te{"use strict";var TU=Be("process");function Jce(t,...e){t==="debug"&&console.log(...e)}function Yce(t,e){(t==="debug"||t==="warn")&&(typeof TU.emitWarning=="function"?TU.emitWarning(e):console.warn(e))}bE.debug=Jce;bE.warn=Yce});var yg=v(gg=>{"use strict";var hg=Pe(),OU=Pt(),pg="<<",mg={identify:t=>t===pg||typeof t=="symbol"&&t.description===pg,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new OU.Scalar(Symbol(pg)),{addToJSMap:IU}),stringify:()=>pg},Xce=(t,e)=>(mg.identify(e)||hg.isScalar(e)&&(!e.type||e.type===OU.Scalar.PLAIN)&&mg.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===mg.tag&&r.default);function IU(t,e,r){let n=PU(t,r);if(hg.isSeq(n))for(let i of n.items)SE(t,e,i);else if(Array.isArray(n))for(let i of n)SE(t,e,i);else SE(t,e,n)}function SE(t,e,r){let n=PU(t,r);if(!hg.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function PU(t,e){return t&&hg.isAlias(e)?e.resolve(t.doc,t):e}gg.addMergeToJSMap=IU;gg.isMergeKey=Xce;gg.merge=mg});var xE=v(DU=>{"use strict";var Qce=vE(),RU=yg(),ele=pd(),CU=Pe(),wE=Eo();function tle(t,e,{key:r,value:n}){if(CU.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(RU.isMergeKey(t,r))RU.addMergeToJSMap(t,e,n);else{let i=wE.toJS(r,"",t);if(e instanceof Map)e.set(i,wE.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=rle(r,i,t),s=wE.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function rle(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(CU.isNode(t)&&r?.doc){let n=ele.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),Qce.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}DU.addPairToJSMap=tle});var Io=v($E=>{"use strict";var NU=cd(),nle=AU(),ile=xE(),_g=Pe();function ole(t,e,r){let n=NU.createNode(t,void 0,r),i=NU.createNode(e,void 0,r);return new bg(n,i)}var bg=class t{constructor(e,r=null){Object.defineProperty(this,_g.NODE_TYPE,{value:_g.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return _g.isNode(r)&&(r=r.clone(e)),_g.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return ile.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?nle.stringifyPair(this,e,r,n):JSON.stringify(this)}};$E.Pair=bg;$E.createPair=ole});var kE=v(MU=>{"use strict";var Us=Pe(),jU=pd(),vg=ld();function sle(t,e,r){return(e.inFlow??t.flow?cle:ale)(t,e,r)}function ale({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=vg.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;m{"use strict";var TU=Be("process");function Jce(t,...e){t==="debug"&&console.log(...e)}function Yce(t,e){(t==="debug"||t==="warn")&&(typeof TU.emitWarning=="function"?TU.emitWarning(e):console.warn(e))}SE.debug=Jce;SE.warn=Yce});var bg=v(_g=>{"use strict";var yg=Pe(),OU=Pt(),hg="<<",gg={identify:t=>t===hg||typeof t=="symbol"&&t.description===hg,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new OU.Scalar(Symbol(hg)),{addToJSMap:IU}),stringify:()=>hg},Xce=(t,e)=>(gg.identify(e)||yg.isScalar(e)&&(!e.type||e.type===OU.Scalar.PLAIN)&&gg.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===gg.tag&&r.default);function IU(t,e,r){let n=PU(t,r);if(yg.isSeq(n))for(let i of n.items)xE(t,e,i);else if(Array.isArray(n))for(let i of n)xE(t,e,i);else xE(t,e,n)}function xE(t,e,r){let n=PU(t,r);if(!yg.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function PU(t,e){return t&&yg.isAlias(e)?e.resolve(t.doc,t):e}_g.addMergeToJSMap=IU;_g.isMergeKey=Xce;_g.merge=gg});var kE=v(DU=>{"use strict";var Qce=wE(),RU=bg(),ele=md(),CU=Pe(),$E=Eo();function tle(t,e,{key:r,value:n}){if(CU.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(RU.isMergeKey(t,r))RU.addMergeToJSMap(t,e,n);else{let i=$E.toJS(r,"",t);if(e instanceof Map)e.set(i,$E.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=rle(r,i,t),s=$E.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function rle(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(CU.isNode(t)&&r?.doc){let n=ele.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),Qce.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}DU.addPairToJSMap=tle});var Io=v(EE=>{"use strict";var NU=ld(),nle=AU(),ile=kE(),vg=Pe();function ole(t,e,r){let n=NU.createNode(t,void 0,r),i=NU.createNode(e,void 0,r);return new Sg(n,i)}var Sg=class t{constructor(e,r=null){Object.defineProperty(this,vg.NODE_TYPE,{value:vg.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return vg.isNode(r)&&(r=r.clone(e)),vg.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return ile.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?nle.stringifyPair(this,e,r,n):JSON.stringify(this)}};EE.Pair=Sg;EE.createPair=ole});var AE=v(MU=>{"use strict";var qs=Pe(),jU=md(),wg=ud();function sle(t,e,r){return(e.inFlow??t.flow?cle:ale)(t,e,r)}function ale({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=wg.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;mg=null);l||(l=d.length>u||b.includes(` -`)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=vg.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` +`+wg.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function cle({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;mg=null);l||(l=d.length>u||b.includes(` +`)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=wg.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` ${o}${i}${h}`:` `;return`${m} -${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Sg({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=vg.indentComment(e(n),t);r.push(o.trimStart())}}MU.stringifyCollection=sle});var Ro=v(AE=>{"use strict";var lle=kE(),ule=xE(),dle=ag(),Po=Pe(),wg=Io(),fle=Pt();function hd(t,e){let r=Po.isScalar(e)?e.value:e;for(let n of t)if(Po.isPair(n)&&(n.key===e||n.key===r||Po.isScalar(n.key)&&n.key.value===r))return n}var EE=class extends dle.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Po.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(wg.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Po.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new wg.Pair(e,e?.value):n=new wg.Pair(e.key,e.value);let i=hd(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Po.isScalar(i.value)&&fle.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=hd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=hd(this.items,e)?.value;return(!r&&Po.isScalar(i)?i.value:i)??void 0}has(e){return!!hd(this.items,e)}set(e,r){this.add(new wg.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)ule.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Po.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),lle.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};AE.YAMLMap=EE;AE.findPair=hd});var uc=v(zU=>{"use strict";var ple=Pe(),FU=Ro(),mle={collection:"map",default:!0,nodeClass:FU.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ple.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>FU.YAMLMap.from(t,e,r)};zU.map=mle});var Co=v(LU=>{"use strict";var hle=cd(),gle=kE(),yle=ag(),$g=Pe(),_le=Pt(),ble=Eo(),TE=class extends yle.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super($g.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=xg(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=xg(e);if(typeof n!="number")return;let i=this.items[n];return!r&&$g.isScalar(i)?i.value:i}has(e){let r=xg(e);return typeof r=="number"&&r=0?e:null}LU.YAMLSeq=TE});var dc=v(qU=>{"use strict";var vle=Pe(),UU=Co(),Sle={collection:"seq",default:!0,nodeClass:UU.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return vle.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>UU.YAMLSeq.from(t,e,r)};qU.seq=Sle});var gd=v(BU=>{"use strict";var wle=fd(),xle={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),wle.stringifyString(t,e,r,n)}};BU.string=xle});var kg=v(GU=>{"use strict";var HU=Pt(),ZU={identify:t=>t==null,createNode:()=>new HU.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new HU.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&ZU.test.test(t)?t:e.options.nullStr};GU.nullTag=ZU});var OE=v(WU=>{"use strict";var $le=Pt(),VU={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new $le.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&VU.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};WU.boolTag=VU});var fc=v(KU=>{"use strict";function kle({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}KU.stringifyNumber=kle});var PE=v(Eg=>{"use strict";var Ele=Pt(),IE=fc(),Ale={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:IE.stringifyNumber},Tle={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():IE.stringifyNumber(t)}},Ole={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Ele.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:IE.stringifyNumber};Eg.float=Ole;Eg.floatExp=Tle;Eg.floatNaN=Ale});var CE=v(Tg=>{"use strict";var JU=fc(),Ag=t=>typeof t=="bigint"||Number.isInteger(t),RE=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function YU(t,e,r){let{value:n}=t;return Ag(n)&&n>=0?r+n.toString(e):JU.stringifyNumber(t)}var Ile={identify:t=>Ag(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>RE(t,2,8,r),stringify:t=>YU(t,8,"0o")},Ple={identify:Ag,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>RE(t,0,10,r),stringify:JU.stringifyNumber},Rle={identify:t=>Ag(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>RE(t,2,16,r),stringify:t=>YU(t,16,"0x")};Tg.int=Ple;Tg.intHex=Rle;Tg.intOct=Ile});var QU=v(XU=>{"use strict";var Cle=uc(),Dle=kg(),Nle=dc(),jle=gd(),Mle=OE(),DE=PE(),NE=CE(),Fle=[Cle.map,Nle.seq,jle.string,Dle.nullTag,Mle.boolTag,NE.intOct,NE.int,NE.intHex,DE.floatNaN,DE.floatExp,DE.float];XU.schema=Fle});var rq=v(tq=>{"use strict";var zle=Pt(),Lle=uc(),Ule=dc();function eq(t){return typeof t=="bigint"||Number.isInteger(t)}var Og=({value:t})=>JSON.stringify(t),qle=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Og},{identify:t=>t==null,createNode:()=>new zle.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Og},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Og},{identify:eq,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>eq(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Og}],Ble={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Hle=[Lle.map,Ule.seq].concat(qle,Ble);tq.schema=Hle});var ME=v(nq=>{"use strict";var yd=Be("buffer"),jE=Pt(),Zle=fd(),Gle={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof yd.Buffer=="function")return yd.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var Ig=Pe(),FE=Io(),Vle=Pt(),Wle=Co();function iq(t,e){if(Ig.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new FE.Pair(new Vle.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function xg({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=wg.indentComment(e(n),t);r.push(o.trimStart())}}MU.stringifyCollection=sle});var Ro=v(OE=>{"use strict";var lle=AE(),ule=kE(),dle=lg(),Po=Pe(),$g=Io(),fle=Pt();function gd(t,e){let r=Po.isScalar(e)?e.value:e;for(let n of t)if(Po.isPair(n)&&(n.key===e||n.key===r||Po.isScalar(n.key)&&n.key.value===r))return n}var TE=class extends dle.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Po.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push($g.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Po.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new $g.Pair(e,e?.value):n=new $g.Pair(e.key,e.value);let i=gd(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Po.isScalar(i.value)&&fle.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=gd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=gd(this.items,e)?.value;return(!r&&Po.isScalar(i)?i.value:i)??void 0}has(e){return!!gd(this.items,e)}set(e,r){this.add(new $g.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)ule.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Po.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),lle.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};OE.YAMLMap=TE;OE.findPair=gd});var fc=v(zU=>{"use strict";var ple=Pe(),FU=Ro(),mle={collection:"map",default:!0,nodeClass:FU.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ple.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>FU.YAMLMap.from(t,e,r)};zU.map=mle});var Co=v(LU=>{"use strict";var hle=ld(),gle=AE(),yle=lg(),Eg=Pe(),_le=Pt(),ble=Eo(),IE=class extends yle.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Eg.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=kg(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=kg(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Eg.isScalar(i)?i.value:i}has(e){let r=kg(e);return typeof r=="number"&&r=0?e:null}LU.YAMLSeq=IE});var pc=v(qU=>{"use strict";var vle=Pe(),UU=Co(),Sle={collection:"seq",default:!0,nodeClass:UU.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return vle.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>UU.YAMLSeq.from(t,e,r)};qU.seq=Sle});var yd=v(BU=>{"use strict";var wle=pd(),xle={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),wle.stringifyString(t,e,r,n)}};BU.string=xle});var Ag=v(GU=>{"use strict";var HU=Pt(),ZU={identify:t=>t==null,createNode:()=>new HU.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new HU.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&ZU.test.test(t)?t:e.options.nullStr};GU.nullTag=ZU});var PE=v(WU=>{"use strict";var $le=Pt(),VU={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new $le.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&VU.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};WU.boolTag=VU});var mc=v(KU=>{"use strict";function kle({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}KU.stringifyNumber=kle});var CE=v(Tg=>{"use strict";var Ele=Pt(),RE=mc(),Ale={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:RE.stringifyNumber},Tle={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():RE.stringifyNumber(t)}},Ole={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Ele.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:RE.stringifyNumber};Tg.float=Ole;Tg.floatExp=Tle;Tg.floatNaN=Ale});var NE=v(Ig=>{"use strict";var JU=mc(),Og=t=>typeof t=="bigint"||Number.isInteger(t),DE=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function YU(t,e,r){let{value:n}=t;return Og(n)&&n>=0?r+n.toString(e):JU.stringifyNumber(t)}var Ile={identify:t=>Og(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>DE(t,2,8,r),stringify:t=>YU(t,8,"0o")},Ple={identify:Og,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>DE(t,0,10,r),stringify:JU.stringifyNumber},Rle={identify:t=>Og(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>DE(t,2,16,r),stringify:t=>YU(t,16,"0x")};Ig.int=Ple;Ig.intHex=Rle;Ig.intOct=Ile});var QU=v(XU=>{"use strict";var Cle=fc(),Dle=Ag(),Nle=pc(),jle=yd(),Mle=PE(),jE=CE(),ME=NE(),Fle=[Cle.map,Nle.seq,jle.string,Dle.nullTag,Mle.boolTag,ME.intOct,ME.int,ME.intHex,jE.floatNaN,jE.floatExp,jE.float];XU.schema=Fle});var rq=v(tq=>{"use strict";var zle=Pt(),Lle=fc(),Ule=pc();function eq(t){return typeof t=="bigint"||Number.isInteger(t)}var Pg=({value:t})=>JSON.stringify(t),qle=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Pg},{identify:t=>t==null,createNode:()=>new zle.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Pg},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Pg},{identify:eq,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>eq(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Pg}],Ble={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Hle=[Lle.map,Ule.seq].concat(qle,Ble);tq.schema=Hle});var zE=v(nq=>{"use strict";var _d=Be("buffer"),FE=Pt(),Zle=pd(),Gle={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof _d.Buffer=="function")return _d.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var Rg=Pe(),LE=Io(),Vle=Pt(),Wle=Co();function iq(t,e){if(Rg.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new LE.Pair(new Vle.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} ${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment} -${o.comment}`:n.comment}n=i}t.items[r]=Ig.isPair(n)?n:new FE.Pair(n)}}else e("Expected a sequence for this tag");return t}function oq(t,e,r){let{replacer:n}=r,i=new Wle.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(FE.createPair(a,c,r))}return i}var Kle={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:iq,createNode:oq};Pg.createPairs=oq;Pg.pairs=Kle;Pg.resolvePairs=iq});var UE=v(LE=>{"use strict";var sq=Pe(),zE=Eo(),_d=Ro(),Jle=Co(),aq=Rg(),qs=class t extends Jle.YAMLSeq{constructor(){super(),this.add=_d.YAMLMap.prototype.add.bind(this),this.delete=_d.YAMLMap.prototype.delete.bind(this),this.get=_d.YAMLMap.prototype.get.bind(this),this.has=_d.YAMLMap.prototype.has.bind(this),this.set=_d.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(sq.isPair(i)?(o=zE.toJS(i.key,"",r),s=zE.toJS(i.value,o,r)):o=zE.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=aq.createPairs(e,r,n),o=new this;return o.items=i.items,o}};qs.tag="tag:yaml.org,2002:omap";var Yle={collection:"seq",identify:t=>t instanceof Map,nodeClass:qs,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=aq.resolvePairs(t,e),n=[];for(let{key:i}of r.items)sq.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new qs,r)},createNode:(t,e,r)=>qs.from(t,e,r)};LE.YAMLOMap=qs;LE.omap=Yle});var fq=v(qE=>{"use strict";var cq=Pt();function lq({value:t,source:e},r){return e&&(t?uq:dq).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var uq={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new cq.Scalar(!0),stringify:lq},dq={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new cq.Scalar(!1),stringify:lq};qE.falseTag=dq;qE.trueTag=uq});var pq=v(Cg=>{"use strict";var Xle=Pt(),BE=fc(),Qle={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:BE.stringifyNumber},eue={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():BE.stringifyNumber(t)}},tue={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Xle.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:BE.stringifyNumber};Cg.float=tue;Cg.floatExp=eue;Cg.floatNaN=Qle});var hq=v(vd=>{"use strict";var mq=fc(),bd=t=>typeof t=="bigint"||Number.isInteger(t);function Dg(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function HE(t,e,r){let{value:n}=t;if(bd(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return mq.stringifyNumber(t)}var rue={identify:bd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Dg(t,2,2,r),stringify:t=>HE(t,2,"0b")},nue={identify:bd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Dg(t,1,8,r),stringify:t=>HE(t,8,"0")},iue={identify:bd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Dg(t,0,10,r),stringify:mq.stringifyNumber},oue={identify:bd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Dg(t,2,16,r),stringify:t=>HE(t,16,"0x")};vd.int=iue;vd.intBin=rue;vd.intHex=oue;vd.intOct=nue});var GE=v(ZE=>{"use strict";var Mg=Pe(),Ng=Io(),jg=Ro(),Bs=class t extends jg.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Mg.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Ng.Pair(e.key,null):r=new Ng.Pair(e,null),jg.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=jg.findPair(this.items,e);return!r&&Mg.isPair(n)?Mg.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=jg.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Ng.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(Ng.createPair(s,null,n));return o}};Bs.tag="tag:yaml.org,2002:set";var sue={collection:"map",identify:t=>t instanceof Set,nodeClass:Bs,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Bs.from(t,e,r),resolve(t,e){if(Mg.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Bs,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};ZE.YAMLSet=Bs;ZE.set=sue});var WE=v(Fg=>{"use strict";var aue=fc();function VE(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function gq(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return aue.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var cue={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>VE(t,r),stringify:gq},lue={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>VE(t,!1),stringify:gq},yq={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(yq.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=VE(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Fg.floatTime=lue;Fg.intTime=cue;Fg.timestamp=yq});var vq=v(bq=>{"use strict";var uue=uc(),due=kg(),fue=dc(),pue=gd(),mue=ME(),_q=fq(),KE=pq(),zg=hq(),hue=yg(),gue=UE(),yue=Rg(),_ue=GE(),JE=WE(),bue=[uue.map,fue.seq,pue.string,due.nullTag,_q.trueTag,_q.falseTag,zg.intBin,zg.intOct,zg.int,zg.intHex,KE.floatNaN,KE.floatExp,KE.float,mue.binary,hue.merge,gue.omap,yue.pairs,_ue.set,JE.intTime,JE.floatTime,JE.timestamp];bq.schema=bue});var Iq=v(QE=>{"use strict";var $q=uc(),vue=kg(),kq=dc(),Sue=gd(),wue=OE(),YE=PE(),XE=CE(),xue=QU(),$ue=rq(),Eq=ME(),Sd=yg(),Aq=UE(),Tq=Rg(),Sq=vq(),Oq=GE(),Lg=WE(),wq=new Map([["core",xue.schema],["failsafe",[$q.map,kq.seq,Sue.string]],["json",$ue.schema],["yaml11",Sq.schema],["yaml-1.1",Sq.schema]]),xq={binary:Eq.binary,bool:wue.boolTag,float:YE.float,floatExp:YE.floatExp,floatNaN:YE.floatNaN,floatTime:Lg.floatTime,int:XE.int,intHex:XE.intHex,intOct:XE.intOct,intTime:Lg.intTime,map:$q.map,merge:Sd.merge,null:vue.nullTag,omap:Aq.omap,pairs:Tq.pairs,seq:kq.seq,set:Oq.set,timestamp:Lg.timestamp},kue={"tag:yaml.org,2002:binary":Eq.binary,"tag:yaml.org,2002:merge":Sd.merge,"tag:yaml.org,2002:omap":Aq.omap,"tag:yaml.org,2002:pairs":Tq.pairs,"tag:yaml.org,2002:set":Oq.set,"tag:yaml.org,2002:timestamp":Lg.timestamp};function Eue(t,e,r){let n=wq.get(e);if(n&&!t)return r&&!n.includes(Sd.merge)?n.concat(Sd.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(wq.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Sd.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?xq[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(xq).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}QE.coreKnownTags=kue;QE.getTags=Eue});var rA=v(Pq=>{"use strict";var eA=Pe(),Aue=uc(),Tue=dc(),Oue=gd(),Ug=Iq(),Iue=(t,e)=>t.keye.key?1:0,tA=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Ug.getTags(e,"compat"):e?Ug.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Ug.coreKnownTags:{},this.tags=Ug.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,eA.MAP,{value:Aue.map}),Object.defineProperty(this,eA.SCALAR,{value:Oue.string}),Object.defineProperty(this,eA.SEQ,{value:Tue.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Iue:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Pq.Schema=tA});var Cq=v(Rq=>{"use strict";var Pue=Pe(),nA=pd(),wd=ld();function Rue(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=nA.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(wd.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Pue.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(wd.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=nA.stringify(t.contents,i,()=>a=null,c);a&&(l+=wd.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(nA.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(wd.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(wd.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=Rg.isPair(n)?n:new LE.Pair(n)}}else e("Expected a sequence for this tag");return t}function oq(t,e,r){let{replacer:n}=r,i=new Wle.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(LE.createPair(a,c,r))}return i}var Kle={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:iq,createNode:oq};Cg.createPairs=oq;Cg.pairs=Kle;Cg.resolvePairs=iq});var BE=v(qE=>{"use strict";var sq=Pe(),UE=Eo(),bd=Ro(),Jle=Co(),aq=Dg(),Bs=class t extends Jle.YAMLSeq{constructor(){super(),this.add=bd.YAMLMap.prototype.add.bind(this),this.delete=bd.YAMLMap.prototype.delete.bind(this),this.get=bd.YAMLMap.prototype.get.bind(this),this.has=bd.YAMLMap.prototype.has.bind(this),this.set=bd.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(sq.isPair(i)?(o=UE.toJS(i.key,"",r),s=UE.toJS(i.value,o,r)):o=UE.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=aq.createPairs(e,r,n),o=new this;return o.items=i.items,o}};Bs.tag="tag:yaml.org,2002:omap";var Yle={collection:"seq",identify:t=>t instanceof Map,nodeClass:Bs,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=aq.resolvePairs(t,e),n=[];for(let{key:i}of r.items)sq.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Bs,r)},createNode:(t,e,r)=>Bs.from(t,e,r)};qE.YAMLOMap=Bs;qE.omap=Yle});var fq=v(HE=>{"use strict";var cq=Pt();function lq({value:t,source:e},r){return e&&(t?uq:dq).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var uq={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new cq.Scalar(!0),stringify:lq},dq={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new cq.Scalar(!1),stringify:lq};HE.falseTag=dq;HE.trueTag=uq});var pq=v(Ng=>{"use strict";var Xle=Pt(),ZE=mc(),Qle={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ZE.stringifyNumber},eue={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():ZE.stringifyNumber(t)}},tue={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Xle.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:ZE.stringifyNumber};Ng.float=tue;Ng.floatExp=eue;Ng.floatNaN=Qle});var hq=v(Sd=>{"use strict";var mq=mc(),vd=t=>typeof t=="bigint"||Number.isInteger(t);function jg(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function GE(t,e,r){let{value:n}=t;if(vd(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return mq.stringifyNumber(t)}var rue={identify:vd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>jg(t,2,2,r),stringify:t=>GE(t,2,"0b")},nue={identify:vd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>jg(t,1,8,r),stringify:t=>GE(t,8,"0")},iue={identify:vd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>jg(t,0,10,r),stringify:mq.stringifyNumber},oue={identify:vd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>jg(t,2,16,r),stringify:t=>GE(t,16,"0x")};Sd.int=iue;Sd.intBin=rue;Sd.intHex=oue;Sd.intOct=nue});var WE=v(VE=>{"use strict";var zg=Pe(),Mg=Io(),Fg=Ro(),Hs=class t extends Fg.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;zg.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Mg.Pair(e.key,null):r=new Mg.Pair(e,null),Fg.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Fg.findPair(this.items,e);return!r&&zg.isPair(n)?zg.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=Fg.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Mg.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(Mg.createPair(s,null,n));return o}};Hs.tag="tag:yaml.org,2002:set";var sue={collection:"map",identify:t=>t instanceof Set,nodeClass:Hs,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Hs.from(t,e,r),resolve(t,e){if(zg.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Hs,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};VE.YAMLSet=Hs;VE.set=sue});var JE=v(Lg=>{"use strict";var aue=mc();function KE(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function gq(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return aue.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var cue={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>KE(t,r),stringify:gq},lue={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>KE(t,!1),stringify:gq},yq={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(yq.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=KE(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Lg.floatTime=lue;Lg.intTime=cue;Lg.timestamp=yq});var vq=v(bq=>{"use strict";var uue=fc(),due=Ag(),fue=pc(),pue=yd(),mue=zE(),_q=fq(),YE=pq(),Ug=hq(),hue=bg(),gue=BE(),yue=Dg(),_ue=WE(),XE=JE(),bue=[uue.map,fue.seq,pue.string,due.nullTag,_q.trueTag,_q.falseTag,Ug.intBin,Ug.intOct,Ug.int,Ug.intHex,YE.floatNaN,YE.floatExp,YE.float,mue.binary,hue.merge,gue.omap,yue.pairs,_ue.set,XE.intTime,XE.floatTime,XE.timestamp];bq.schema=bue});var Iq=v(tA=>{"use strict";var $q=fc(),vue=Ag(),kq=pc(),Sue=yd(),wue=PE(),QE=CE(),eA=NE(),xue=QU(),$ue=rq(),Eq=zE(),wd=bg(),Aq=BE(),Tq=Dg(),Sq=vq(),Oq=WE(),qg=JE(),wq=new Map([["core",xue.schema],["failsafe",[$q.map,kq.seq,Sue.string]],["json",$ue.schema],["yaml11",Sq.schema],["yaml-1.1",Sq.schema]]),xq={binary:Eq.binary,bool:wue.boolTag,float:QE.float,floatExp:QE.floatExp,floatNaN:QE.floatNaN,floatTime:qg.floatTime,int:eA.int,intHex:eA.intHex,intOct:eA.intOct,intTime:qg.intTime,map:$q.map,merge:wd.merge,null:vue.nullTag,omap:Aq.omap,pairs:Tq.pairs,seq:kq.seq,set:Oq.set,timestamp:qg.timestamp},kue={"tag:yaml.org,2002:binary":Eq.binary,"tag:yaml.org,2002:merge":wd.merge,"tag:yaml.org,2002:omap":Aq.omap,"tag:yaml.org,2002:pairs":Tq.pairs,"tag:yaml.org,2002:set":Oq.set,"tag:yaml.org,2002:timestamp":qg.timestamp};function Eue(t,e,r){let n=wq.get(e);if(n&&!t)return r&&!n.includes(wd.merge)?n.concat(wd.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(wq.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(wd.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?xq[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(xq).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}tA.coreKnownTags=kue;tA.getTags=Eue});var iA=v(Pq=>{"use strict";var rA=Pe(),Aue=fc(),Tue=pc(),Oue=yd(),Bg=Iq(),Iue=(t,e)=>t.keye.key?1:0,nA=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Bg.getTags(e,"compat"):e?Bg.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Bg.coreKnownTags:{},this.tags=Bg.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,rA.MAP,{value:Aue.map}),Object.defineProperty(this,rA.SCALAR,{value:Oue.string}),Object.defineProperty(this,rA.SEQ,{value:Tue.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Iue:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Pq.Schema=nA});var Cq=v(Rq=>{"use strict";var Pue=Pe(),oA=md(),xd=ud();function Rue(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=oA.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(xd.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Pue.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(xd.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=oA.stringify(t.contents,i,()=>a=null,c);a&&(l+=xd.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(oA.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(xd.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(xd.indentComment(o(c),"")))}return r.join(` `)+` -`}Rq.stringifyDocument=Rue});var xd=v(Dq=>{"use strict";var Cue=ad(),pc=ag(),pn=Pe(),Due=Io(),Nue=Eo(),jue=rA(),Mue=Cq(),iA=ng(),Fue=cE(),zue=cd(),oA=aE(),sA=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,pn.NODE_TYPE,{value:pn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new oA.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[pn.NODE_TYPE]:{value:pn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=pn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){mc(this.contents)&&this.contents.add(e)}addIn(e,r){mc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=iA.anchorNames(this);e.anchor=!r||n.has(r)?iA.findNewAnchor(r||"a",n):r}return new Cue.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=iA.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=zue.createNode(e,u,m);return a&&pn.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Due.Pair(i,o)}delete(e){return mc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return pc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):mc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return pn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return pc.isEmptyPath(e)?!r&&pn.isScalar(this.contents)?this.contents.value:this.contents:pn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return pn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return pc.isEmptyPath(e)?this.contents!==void 0:pn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=pc.collectionFromPath(this.schema,[e],r):mc(this.contents)&&this.contents.set(e,r)}setIn(e,r){pc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=pc.collectionFromPath(this.schema,Array.from(e),r):mc(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new oA.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new oA.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new jue.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Nue.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?Fue.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Mue.stringifyDocument(this,e)}};function mc(t){if(pn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Dq.Document=sA});var Ed=v(kd=>{"use strict";var $d=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},aA=class extends $d{constructor(e,r,n){super("YAMLParseError",e,r,n)}},cA=class extends $d{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Lue=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 +`}Rq.stringifyDocument=Rue});var $d=v(Dq=>{"use strict";var Cue=cd(),hc=lg(),mn=Pe(),Due=Io(),Nue=Eo(),jue=iA(),Mue=Cq(),sA=og(),Fue=uE(),zue=ld(),aA=lE(),cA=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,mn.NODE_TYPE,{value:mn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new aA.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[mn.NODE_TYPE]:{value:mn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=mn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){gc(this.contents)&&this.contents.add(e)}addIn(e,r){gc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=sA.anchorNames(this);e.anchor=!r||n.has(r)?sA.findNewAnchor(r||"a",n):r}return new Cue.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=sA.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=zue.createNode(e,u,m);return a&&mn.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Due.Pair(i,o)}delete(e){return gc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return hc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):gc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return mn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return hc.isEmptyPath(e)?!r&&mn.isScalar(this.contents)?this.contents.value:this.contents:mn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return mn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return hc.isEmptyPath(e)?this.contents!==void 0:mn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=hc.collectionFromPath(this.schema,[e],r):gc(this.contents)&&this.contents.set(e,r)}setIn(e,r){hc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=hc.collectionFromPath(this.schema,Array.from(e),r):gc(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new aA.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new aA.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new jue.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Nue.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?Fue.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Mue.stringifyDocument(this,e)}};function gc(t){if(mn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Dq.Document=cA});var Ad=v(Ed=>{"use strict";var kd=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},lA=class extends kd{constructor(e,r,n){super("YAMLParseError",e,r,n)}},uA=class extends kd{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Lue=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`: ${s} ${l} -`}};kd.YAMLError=$d;kd.YAMLParseError=aA;kd.YAMLWarning=cA;kd.prettifyError=Lue});var Ad=v(Nq=>{"use strict";function Uue(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let E of t)switch(m&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&o(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&E.type!=="comment"&&E.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),E.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&E.source.includes(" ")&&(h=E),u=!0;break;case"comment":{u||o(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=E.source.substring(1)||" ";d?d+=f+C:d=C,f="",l=!1;break}case"newline":l?d?d+=E.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=E.source,l=!0,p=!0,(g||b)&&(_=E),u=!0;break;case"anchor":g&&o(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&o(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=E,w??(w=E.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(E,"MULTIPLE_TAGS","A node can have at most one tag"),b=E,w??(w=E.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),x&&o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),x=E,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=E,l=!1,u=!1;break}default:o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),l=!1,u=!1}let R=t[t.length-1],A=R?R.offset+R.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:A,start:w??A}}Nq.resolveProps=Uue});var qg=v(jq=>{"use strict";function lA(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` -`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(lA(e.key)||lA(e.value))return!0}return!1;default:return!0}}jq.containsNewline=lA});var uA=v(Mq=>{"use strict";var que=qg();function Bue(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&que.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Mq.flowIndentCheck=Bue});var dA=v(zq=>{"use strict";var Fq=Pe();function Hue(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||Fq.isScalar(o)&&Fq.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}zq.mapIncludes=Hue});var Zq=v(Hq=>{"use strict";var Lq=Io(),Zue=Ro(),Uq=Ad(),Gue=qg(),qq=uA(),Vue=dA(),Bq="All mapping items must start at the same column";function Wue({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Zue.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=Uq.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",Bq)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`}};Ed.YAMLError=kd;Ed.YAMLParseError=lA;Ed.YAMLWarning=uA;Ed.prettifyError=Lue});var Td=v(Nq=>{"use strict";function Uue(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let E of t)switch(m&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&o(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&E.type!=="comment"&&E.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),E.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&E.source.includes(" ")&&(h=E),u=!0;break;case"comment":{u||o(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=E.source.substring(1)||" ";d?d+=f+C:d=C,f="",l=!1;break}case"newline":l?d?d+=E.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=E.source,l=!0,p=!0,(g||b)&&(_=E),u=!0;break;case"anchor":g&&o(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&o(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=E,w??(w=E.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(E,"MULTIPLE_TAGS","A node can have at most one tag"),b=E,w??(w=E.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),x&&o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),x=E,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=E,l=!1,u=!1;break}default:o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),l=!1,u=!1}let R=t[t.length-1],A=R?R.offset+R.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:A,start:w??A}}Nq.resolveProps=Uue});var Hg=v(jq=>{"use strict";function dA(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` +`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(dA(e.key)||dA(e.value))return!0}return!1;default:return!0}}jq.containsNewline=dA});var fA=v(Mq=>{"use strict";var que=Hg();function Bue(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&que.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Mq.flowIndentCheck=Bue});var pA=v(zq=>{"use strict";var Fq=Pe();function Hue(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||Fq.isScalar(o)&&Fq.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}zq.mapIncludes=Hue});var Zq=v(Hq=>{"use strict";var Lq=Io(),Zue=Ro(),Uq=Td(),Gue=Hg(),qq=fA(),Vue=pA(),Bq="All mapping items must start at the same column";function Wue({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Zue.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=Uq.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",Bq)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` `+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Gue.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",Bq);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&qq.flowIndentCheck(n.indent,f,i),r.atKey=!1,Vue.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=Uq.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var Kue=Co(),Jue=Ad(),Yue=uA();function Xue({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Kue.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=Jue.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&Yue.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}Gq.resolveBlockSeq=Xue});var hc=v(Wq=>{"use strict";function Que(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}Wq.resolveEnd=Que});var Xq=v(Yq=>{"use strict";var ede=Pe(),tde=Io(),Kq=Ro(),rde=Co(),nde=hc(),Jq=Ad(),ide=qg(),ode=dA(),fA="Block collections are not allowed within flow collections",pA=t=>t&&(t.type==="block-map"||t.type==="block-seq");function sde({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Kq.YAMLMap:rde.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g{"use strict";var Kue=Co(),Jue=Td(),Yue=fA();function Xue({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Kue.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=Jue.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&Yue.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}Gq.resolveBlockSeq=Xue});var yc=v(Wq=>{"use strict";function Que(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}Wq.resolveEnd=Que});var Xq=v(Yq=>{"use strict";var ede=Pe(),tde=Io(),Kq=Ro(),rde=Co(),nde=yc(),Jq=Td(),ide=Hg(),ode=pA(),mA="Block collections are not allowed within flow collections",hA=t=>t&&(t.type==="block-map"||t.type==="block-seq");function sde({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Kq.YAMLMap:rde.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=nde.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` -`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}Yq.resolveFlowCollection=sde});var e4=v(Qq=>{"use strict";var ade=Pe(),cde=Pt(),lde=Ro(),ude=Co(),dde=Zq(),fde=Vq(),pde=Xq();function mA(t,e,r,n,i,o){let s=r.type==="block-map"?dde.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?fde.resolveBlockSeq(t,e,r,n,o):pde.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function mde(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),mA(t,e,r,i,s)}let l=mA(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=ade.isNode(u)?u:new cde.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}Qq.composeCollection=mde});var gA=v(t4=>{"use strict";var hA=Pt();function hde(t,e,r){let n=e.offset,i=gde(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?hA.Scalar.BLOCK_FOLDED:hA.Scalar.BLOCK_LITERAL,s=e.source?yde(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` +`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}Yq.resolveFlowCollection=sde});var e4=v(Qq=>{"use strict";var ade=Pe(),cde=Pt(),lde=Ro(),ude=Co(),dde=Zq(),fde=Vq(),pde=Xq();function gA(t,e,r,n,i,o){let s=r.type==="block-map"?dde.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?fde.resolveBlockSeq(t,e,r,n,o):pde.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function mde(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),gA(t,e,r,i,s)}let l=gA(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=ade.isNode(u)?u:new cde.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}Qq.composeCollection=mde});var _A=v(t4=>{"use strict";var yA=Pt();function hde(t,e,r){let n=e.offset,i=gde(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?yA.Scalar.BLOCK_FOLDED:yA.Scalar.BLOCK_LITERAL,s=e.source?yde(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` `.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` `:!p&&f===` `&&(f=` @@ -112,7 +112,7 @@ ${l} `+s[h][0].slice(c);d[d.length-1]!==` `&&(d+=` `);break;default:d+=` -`}let m=n+i.length+e.source.length;return{value:d,type:o,comment:i.comment,range:[n,m,m]}}function gde({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let f=1;f{"use strict";var yA=Pt(),_de=hc();function bde(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=yA.Scalar.PLAIN,c=vde(o,l);break;case"single-quoted-scalar":a=yA.Scalar.QUOTE_SINGLE,c=Sde(o,l);break;case"double-quoted-scalar":a=yA.Scalar.QUOTE_DOUBLE,c=wde(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=_de.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function vde(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),r4(t)}function Sde(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),r4(t.slice(1,-1)).replace(/''/g,"'")}function r4(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var bA=Pt(),_de=yc();function bde(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=bA.Scalar.PLAIN,c=vde(o,l);break;case"single-quoted-scalar":a=bA.Scalar.QUOTE_SINGLE,c=Sde(o,l);break;case"double-quoted-scalar":a=bA.Scalar.QUOTE_DOUBLE,c=wde(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=_de.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function vde(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),r4(t)}function Sde(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),r4(t.slice(1,-1)).replace(/''/g,"'")}function r4(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var Hs=Pe(),i4=Pt(),Ede=gA(),Ade=_A();function Tde(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Ede.resolveBlockScalar(t,e,n):Ade.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Hs.SCALAR]:c?l=Ode(t.schema,i,c,r,n):e.type==="scalar"?l=Ide(t,i,e,n):l=t.schema[Hs.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=Hs.isScalar(d)?d:new i4.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new i4.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Ode(t,e,r,n,i){if(r==="!")return t[Hs.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[Hs.SCALAR])}function Ide({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[Hs.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[Hs.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}o4.composeScalar=Tde});var c4=v(a4=>{"use strict";function Pde(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}a4.emptyScalarPosition=Pde});var d4=v(vA=>{"use strict";var Rde=ad(),Cde=Pe(),Dde=e4(),l4=s4(),Nde=hc(),jde=c4(),Mde={composeNode:u4,composeEmptyNode:bA};function u4(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=Fde(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=l4.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Dde.composeCollection(Mde,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=bA(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Cde.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function bA(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:jde.emptyScalarPosition(e,r,n),indent:-1,source:""},d=l4.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function Fde({options:t},{offset:e,source:r,end:n},i){let o=new Rde.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Nde.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}vA.composeEmptyNode=bA;vA.composeNode=u4});var m4=v(p4=>{"use strict";var zde=xd(),f4=d4(),Lde=hc(),Ude=Ad();function qde(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new zde.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Ude.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?f4.composeNode(l,i,u,s):f4.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Lde.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}p4.composeDoc=qde});var wA=v(y4=>{"use strict";var Bde=Be("process"),Hde=aE(),Zde=xd(),Td=Ed(),h4=Pe(),Gde=m4(),Vde=hc();function Od(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function g4(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var Zs=Pe(),i4=Pt(),Ede=_A(),Ade=vA();function Tde(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Ede.resolveBlockScalar(t,e,n):Ade.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Zs.SCALAR]:c?l=Ode(t.schema,i,c,r,n):e.type==="scalar"?l=Ide(t,i,e,n):l=t.schema[Zs.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=Zs.isScalar(d)?d:new i4.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new i4.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Ode(t,e,r,n,i){if(r==="!")return t[Zs.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[Zs.SCALAR])}function Ide({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[Zs.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[Zs.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}o4.composeScalar=Tde});var c4=v(a4=>{"use strict";function Pde(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}a4.emptyScalarPosition=Pde});var d4=v(wA=>{"use strict";var Rde=cd(),Cde=Pe(),Dde=e4(),l4=s4(),Nde=yc(),jde=c4(),Mde={composeNode:u4,composeEmptyNode:SA};function u4(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=Fde(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=l4.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Dde.composeCollection(Mde,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=SA(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Cde.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function SA(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:jde.emptyScalarPosition(e,r,n),indent:-1,source:""},d=l4.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function Fde({options:t},{offset:e,source:r,end:n},i){let o=new Rde.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Nde.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}wA.composeEmptyNode=SA;wA.composeNode=u4});var m4=v(p4=>{"use strict";var zde=$d(),f4=d4(),Lde=yc(),Ude=Td();function qde(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new zde.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Ude.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?f4.composeNode(l,i,u,s):f4.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Lde.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}p4.composeDoc=qde});var $A=v(y4=>{"use strict";var Bde=Be("process"),Hde=lE(),Zde=$d(),Od=Ad(),h4=Pe(),Gde=m4(),Vde=yc();function Id(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function g4(t){let e="",r=!1,n=!1;for(let i=0;i{let s=Od(r);o?this.warnings.push(new Td.YAMLWarning(s,n,i)):this.errors.push(new Td.YAMLParseError(s,n,i))},this.directives=new Hde.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=g4(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} +`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var xA=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=Id(r);o?this.warnings.push(new Od.YAMLWarning(s,n,i)):this.errors.push(new Od.YAMLParseError(s,n,i))},this.directives=new Hde.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=g4(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} ${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(h4.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];h4.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} ${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n} -${s}`:n}}if(r){for(let o=0;o{let o=Od(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Gde.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Td.YAMLParseError(Od(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Td.YAMLParseError(Od(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Vde.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} -${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Td.YAMLParseError(Od(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new Zde.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};y4.Composer=SA});var v4=v(Bg=>{"use strict";var Wde=gA(),Kde=_A(),Jde=Ed(),_4=fd();function Yde(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new Jde.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Kde.resolveFlowScalar(t,e,n);case"block-scalar":return Wde.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Xde(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=_4.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` +${s}`:n}}if(r){for(let o=0;o{let o=Id(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Gde.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Od.YAMLParseError(Id(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Od.YAMLParseError(Id(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Vde.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} +${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Od.YAMLParseError(Id(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new Zde.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};y4.Composer=xA});var v4=v(Zg=>{"use strict";var Wde=_A(),Kde=vA(),Jde=Ad(),_4=pd();function Yde(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new Jde.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Kde.resolveFlowScalar(t,e,n);case"block-scalar":return Wde.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Xde(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=_4.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` `}];switch(a[0]){case"|":case">":{let l=a.indexOf(` `),u=a.substring(0,l),d=a.substring(l+1)+` `,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return b4(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` -`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function Qde(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=_4.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":efe(t,c);break;case'"':xA(t,c,"double-quoted-scalar");break;case"'":xA(t,c,"single-quoted-scalar");break;default:xA(t,c,"scalar")}}function efe(t,e){let r=e.indexOf(` +`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function Qde(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=_4.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":efe(t,c);break;case'"':kA(t,c,"double-quoted-scalar");break;case"'":kA(t,c,"single-quoted-scalar");break;default:kA(t,c,"scalar")}}function efe(t,e){let r=e.indexOf(` `),n=e.substring(0,r),i=e.substring(r+1)+` `;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];b4(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` -`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function b4(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function xA(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` -`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}Bg.createScalarToken=Xde;Bg.resolveAsScalar=Yde;Bg.setScalarValue=Qde});var w4=v(S4=>{"use strict";var tfe=t=>"type"in t?Zg(t):Hg(t);function Zg(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Zg(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Hg(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Hg(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Hg(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function Hg({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Zg(e)),r)for(let o of r)i+=o.source;return n&&(i+=Zg(n)),i}S4.stringify=tfe});var E4=v(k4=>{"use strict";var $A=Symbol("break visit"),rfe=Symbol("skip children"),x4=Symbol("remove item");function Zs(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),$4(Object.freeze([]),t,e)}Zs.BREAK=$A;Zs.SKIP=rfe;Zs.REMOVE=x4;Zs.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};Zs.parentCollection=(t,e)=>{let r=Zs.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function $4(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var kA=v4(),nfe=w4(),ife=E4(),EA="\uFEFF",AA="",TA="",OA="",ofe=t=>!!t&&"items"in t,sfe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function afe(t){switch(t){case EA:return"";case AA:return"";case TA:return"";case OA:return"";default:return JSON.stringify(t)}}function cfe(t){switch(t){case EA:return"byte-order-mark";case AA:return"doc-mode";case TA:return"flow-error-end";case OA:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function b4(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function kA(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` +`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}Zg.createScalarToken=Xde;Zg.resolveAsScalar=Yde;Zg.setScalarValue=Qde});var w4=v(S4=>{"use strict";var tfe=t=>"type"in t?Vg(t):Gg(t);function Vg(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Vg(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Gg(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Gg(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Gg(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function Gg({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Vg(e)),r)for(let o of r)i+=o.source;return n&&(i+=Vg(n)),i}S4.stringify=tfe});var E4=v(k4=>{"use strict";var EA=Symbol("break visit"),rfe=Symbol("skip children"),x4=Symbol("remove item");function Gs(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),$4(Object.freeze([]),t,e)}Gs.BREAK=EA;Gs.SKIP=rfe;Gs.REMOVE=x4;Gs.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};Gs.parentCollection=(t,e)=>{let r=Gs.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function $4(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var AA=v4(),nfe=w4(),ife=E4(),TA="\uFEFF",OA="",IA="",PA="",ofe=t=>!!t&&"items"in t,sfe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function afe(t){switch(t){case TA:return"";case OA:return"";case IA:return"";case PA:return"";default:return JSON.stringify(t)}}function cfe(t){switch(t){case TA:return"byte-order-mark";case OA:return"doc-mode";case IA:return"flow-error-end";case PA:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r -`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Tr.createScalarToken=kA.createScalarToken;Tr.resolveAsScalar=kA.resolveAsScalar;Tr.setScalarValue=kA.setScalarValue;Tr.stringify=nfe.stringify;Tr.visit=ife.visit;Tr.BOM=EA;Tr.DOCUMENT=AA;Tr.FLOW_END=TA;Tr.SCALAR=OA;Tr.isCollection=ofe;Tr.isScalar=sfe;Tr.prettyToken=afe;Tr.tokenType=cfe});var RA=v(T4=>{"use strict";var Id=Gg();function Fn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var A4=new Set("0123456789ABCDEFabcdef"),lfe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Vg=new Set(",[]{}"),ufe=new Set(` ,[]{} -\r `),IA=t=>!t||ufe.has(t),PA=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Tr.createScalarToken=AA.createScalarToken;Tr.resolveAsScalar=AA.resolveAsScalar;Tr.setScalarValue=AA.setScalarValue;Tr.stringify=nfe.stringify;Tr.visit=ife.visit;Tr.BOM=TA;Tr.DOCUMENT=OA;Tr.FLOW_END=IA;Tr.SCALAR=PA;Tr.isCollection=ofe;Tr.isScalar=sfe;Tr.prettyToken=afe;Tr.tokenType=cfe});var DA=v(T4=>{"use strict";var Pd=Wg();function Fn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var A4=new Set("0123456789ABCDEFabcdef"),lfe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Kg=new Set(",[]{}"),ufe=new Set(` ,[]{} +\r `),RA=t=>!t||ufe.has(t),CA=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` `?!0:r==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===` `||!i&&!this.atEnd)return e+n+1}return r===` `||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Fn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Fn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Fn(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(IA),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&nthis.indentValue&&!Fn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Fn(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(RA),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Fn(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case` `:e=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===` `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(` `,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===` `;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===` -`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Id.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Fn(o)||e&&Vg.has(o))break;r=n}else if(Fn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` +`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Pd.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Fn(o)||e&&Kg.has(o))break;r=n}else if(Fn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&Vg.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Vg.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Id.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(IA),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Fn(n)||r&&Vg.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Fn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(lfe.has(r))r=this.buffer[++e];else if(r==="%"&&A4.has(this.buffer[e+1])&&A4.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` +`,o=this.buffer[n+1]):r=n),o==="#"||e&&Kg.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Kg.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Pd.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(RA),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Fn(n)||r&&Kg.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Fn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(lfe.has(r))r=this.buffer[++e];else if(r==="%"&&A4.has(this.buffer[e+1])&&A4.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};T4.Lexer=PA});var DA=v(O4=>{"use strict";var CA=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var dfe=Be("process"),I4=Gg(),ffe=RA();function Do(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Kg(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&R4(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&P4(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};T4.Lexer=CA});var jA=v(O4=>{"use strict";var NA=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var dfe=Be("process"),I4=Wg(),ffe=DA();function Do(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Yg(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&R4(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&P4(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Do(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(C4(r.key)&&!Do(r.sep,"newline")){let s=gc(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Do(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=gc(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Do(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Do(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Kg(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Do(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Wg(n),o=gc(i);R4(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` +`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Yg(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Do(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(C4(r.key)&&!Do(r.sep,"newline")){let s=_c(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Do(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=_c(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Do(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Do(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Yg(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Do(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Jg(n),o=_c(i);R4(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(` -`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Wg(e),n=gc(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Wg(e),n=gc(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};D4.Parser=NA});var z4=v(Rd=>{"use strict";var N4=wA(),pfe=xd(),Pd=Ed(),mfe=vE(),hfe=Pe(),gfe=DA(),j4=jA();function M4(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new gfe.LineCounter||null,prettyErrors:e}}function yfe(t,e={}){let{lineCounter:r,prettyErrors:n}=M4(e),i=new j4.Parser(r?.addNewLine),o=new N4.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Pd.prettifyError(t,r)),a.warnings.forEach(Pd.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function F4(t,e={}){let{lineCounter:r,prettyErrors:n}=M4(e),i=new j4.Parser(r?.addNewLine),o=new N4.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Pd.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Pd.prettifyError(t,r)),s.warnings.forEach(Pd.prettifyError(t,r))),s}function _fe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=F4(t,r);if(!i)return null;if(i.warnings.forEach(o=>mfe.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function bfe(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return hfe.isDocument(t)&&!n?t.toString(r):new pfe.Document(t,n,r).toString(r)}Rd.parse=_fe;Rd.parseAllDocuments=yfe;Rd.parseDocument=F4;Rd.stringify=bfe});var or=v(He=>{"use strict";var vfe=wA(),Sfe=xd(),wfe=rA(),MA=Ed(),xfe=ad(),No=Pe(),$fe=Io(),kfe=Pt(),Efe=Ro(),Afe=Co(),Tfe=Gg(),Ofe=RA(),Ife=DA(),Pfe=jA(),Jg=z4(),L4=nd();He.Composer=vfe.Composer;He.Document=Sfe.Document;He.Schema=wfe.Schema;He.YAMLError=MA.YAMLError;He.YAMLParseError=MA.YAMLParseError;He.YAMLWarning=MA.YAMLWarning;He.Alias=xfe.Alias;He.isAlias=No.isAlias;He.isCollection=No.isCollection;He.isDocument=No.isDocument;He.isMap=No.isMap;He.isNode=No.isNode;He.isPair=No.isPair;He.isScalar=No.isScalar;He.isSeq=No.isSeq;He.Pair=$fe.Pair;He.Scalar=kfe.Scalar;He.YAMLMap=Efe.YAMLMap;He.YAMLSeq=Afe.YAMLSeq;He.CST=Tfe;He.Lexer=Ofe.Lexer;He.LineCounter=Ife.LineCounter;He.Parser=Pfe.Parser;He.parse=Jg.parse;He.parseAllDocuments=Jg.parseAllDocuments;He.parseDocument=Jg.parseDocument;He.stringify=Jg.stringify;He.visit=L4.visit;He.visitAsync=L4.visitAsync});import{execFileSync as Rfe}from"node:child_process";import{existsSync as Cfe,readFileSync as Dfe}from"node:fs";import{join as B4}from"node:path";function _c(t,e){return Rfe("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ey(t){try{let e=_c(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function ty(t,e){Nfe(t,e);let r=_c(t,["rev-parse","HEAD"]).trim(),n=jfe(t,e);return{groups:Mfe(t,n),head:r,inventory:{after:q4(Xg(t,"spec.yaml")),before:q4(FA(t,e,"spec.yaml"))},since:e,unsharded_commits:Ufe(t,e)}}function zA(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function Nfe(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");try{_c(t,["rev-parse","--verify","--quiet",`${r}^{commit}`])}catch{throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}}function jfe(t,e){let r=_c(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!U4(c)&&!U4(a)))if(s.startsWith("A")){let l=Yg(Xg(t,c));if(!l)continue;l.status==="done"?n.push(yc(l,"added-as-done")):l.status==="archived"&&n.push(yc(l,"archived"))}else if(s.startsWith("D")){let l=Yg(FA(t,e,a));l&&n.push(yc(l,"archived"))}else{let l=Yg(Xg(t,c));if(!l)continue;let d=Yg(FA(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(yc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(yc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(yc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function U4(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function yc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>zA(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function Yg(t){if(t===null)return null;let e;try{e=(0,Qg.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function Xg(t,e){let r=B4(t,e);if(!Cfe(r))return null;try{return Dfe(r,"utf8")}catch{return null}}function FA(t,e,r){try{return _c(t,["show",`${e}:${r}`])}catch{return null}}function Mfe(t,e){let r=Ffe(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function Ffe(t){let e=Xg(t,B4("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,Qg.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function q4(t){let e={};if(t!==null)try{let n=(0,Qg.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function Ufe(t,e){let r=_c(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);zfe.test(a)&&(Lfe.test(a)||n.push({hash:s,subject:a}))}return n}var Qg,zfe,Lfe,ry=y(()=>{"use strict";Qg=kt(or(),1);zfe=/^(feat|fix)(\([^)]*\))?!?:/,Lfe=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{existsSync as qfe}from"node:fs";import{join as Bfe}from"node:path";function ny(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${Hfe[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` -`)}function iy(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${Gfe(l,r)} |`)}return n.join(` -`)}function Gfe(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of Zfe)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${qfe(Bfe(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function oy(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),H4(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)H4(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function H4(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=zA(r);n&&t.push(`- ${n}`)}t.push("")}var Hfe,Zfe,LA=y(()=>{"use strict";ry();Hfe={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Zfe=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Vfe}from"node:fs";function di(t="./spec.yaml"){let e=Vfe(t,"utf8");return(0,Z4.parse)(e)}var Z4,sy=y(()=>{"use strict";Z4=kt(or(),1)});var jo=v((Or,HA)=>{"use strict";var UA=Or.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+V4(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};UA.prototype.toString=function(){return this.property+" "+this.message};var ay=Or.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};ay.prototype.addError=function(e){var r;if(typeof e=="string")r=new UA(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new UA(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new Gs(this);if(this.throwError)throw r;return r};ay.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Wfe(t,e){return e+": "+t.toString()+` -`}ay.prototype.toString=function(e){return this.errors.map(Wfe).join("")};Object.defineProperty(ay.prototype,"valid",{get:function(){return!this.errors.length}});HA.exports.ValidatorResultError=Gs;function Gs(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Gs),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}Gs.prototype=new Error;Gs.prototype.constructor=Gs;Gs.prototype.name="Validation Error";var G4=Or.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};G4.prototype=Object.create(Error.prototype,{constructor:{value:G4,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var qA=Or.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+V4(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};qA.prototype.resolve=function(e){return W4(this.base,e)};qA.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=W4(this.base,i||"");var s=new qA(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var zn=Or.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};zn.regexp=zn.regex;zn.pattern=zn.regex;zn.ipv4=zn["ip-address"];Or.isFormat=function(e,r,n){if(typeof e=="string"&&zn[r]!==void 0){if(zn[r]instanceof RegExp)return zn[r].test(e);if(typeof zn[r]=="function")return zn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var V4=Or.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Or.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function Kfe(t,e,r,n){typeof r=="object"?e[n]=BA(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Jfe(t,e,r){e[r]=t[r]}function Yfe(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=BA(t[n],e[n]):r[n]=e[n]}function BA(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Kfe.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Jfe.bind(null,t,n)),Object.keys(e).forEach(Yfe.bind(null,t,e,n))),n}HA.exports.deepMerge=BA;Or.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function Xfe(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Or.encodePath=function(e){return e.map(Xfe).join("")};Or.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Or.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var W4=Or.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var X4=v((aVe,Y4)=>{"use strict";var Hr=jo(),Fe=Hr.ValidatorResult,Mo=Hr.SchemaError,ZA={};ZA.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=ZA.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function GA(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new Mo("anyOf must be an array");if(!r.anyOf.some(GA.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new Mo("allOf must be an array");var o=new Fe(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new Mo("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(GA.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!Hr.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=GA.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!Hr.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!Hr.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function VA(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!Hr.isSchema(s))throw new Mo('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(VA(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new Mo('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=VA(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function K4(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new Mo('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&K4.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)K4.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!Hr.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function Qfe(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var WA=jo();KA.exports.SchemaScanResult=Q4;function Q4(t,e){this.id=t,this.ref=e}KA.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=WA.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=WA.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!WA.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var e6=X4(),Fo=jo(),t6=cy().scan,r6=Fo.ValidatorResult,epe=Fo.ValidatorResultError,Cd=Fo.SchemaError,n6=Fo.SchemaContext,tpe="/",Vt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(fi),this.attributes=Object.create(e6.validators)};Vt.prototype.customFormats={};Vt.prototype.schemas=null;Vt.prototype.types=null;Vt.prototype.attributes=null;Vt.prototype.unresolvedRefs=null;Vt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=t6(r||tpe,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Vt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=Fo.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Cd("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Vt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Cd('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var fi=Vt.prototype.types={};fi.string=function(e){return typeof e=="string"};fi.number=function(e){return typeof e=="number"&&isFinite(e)};fi.integer=function(e){return typeof e=="number"&&e%1===0};fi.boolean=function(e){return typeof e=="boolean"};fi.array=function(e){return Array.isArray(e)};fi.null=function(e){return e===null};fi.date=function(e){return e instanceof Date};fi.any=function(e){return!0};fi.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};o6.exports=Vt});var a6=v((uVe,Vi)=>{"use strict";var rpe=Vi.exports.Validator=s6();Vi.exports.ValidatorResult=jo().ValidatorResult;Vi.exports.ValidatorResultError=jo().ValidatorResultError;Vi.exports.ValidationError=jo().ValidationError;Vi.exports.SchemaError=jo().SchemaError;Vi.exports.SchemaScanResult=cy().SchemaScanResult;Vi.exports.scan=cy().scan;Vi.exports.validate=function(t,e,r){var n=new rpe;return n.validate(t,e,r)}});import{readFileSync as npe}from"node:fs";import{dirname as ipe,join as ope}from"node:path";import{fileURLToPath as spe}from"node:url";function dpe(t){let e=upe.validate(t,lpe);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function l6(t){let e=dpe(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Jg(e),n=_c(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Jg(e),n=_c(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};D4.Parser=MA});var z4=v(Cd=>{"use strict";var N4=$A(),pfe=$d(),Rd=Ad(),mfe=wE(),hfe=Pe(),gfe=jA(),j4=FA();function M4(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new gfe.LineCounter||null,prettyErrors:e}}function yfe(t,e={}){let{lineCounter:r,prettyErrors:n}=M4(e),i=new j4.Parser(r?.addNewLine),o=new N4.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Rd.prettifyError(t,r)),a.warnings.forEach(Rd.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function F4(t,e={}){let{lineCounter:r,prettyErrors:n}=M4(e),i=new j4.Parser(r?.addNewLine),o=new N4.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Rd.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Rd.prettifyError(t,r)),s.warnings.forEach(Rd.prettifyError(t,r))),s}function _fe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=F4(t,r);if(!i)return null;if(i.warnings.forEach(o=>mfe.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function bfe(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return hfe.isDocument(t)&&!n?t.toString(r):new pfe.Document(t,n,r).toString(r)}Cd.parse=_fe;Cd.parseAllDocuments=yfe;Cd.parseDocument=F4;Cd.stringify=bfe});var or=v(He=>{"use strict";var vfe=$A(),Sfe=$d(),wfe=iA(),zA=Ad(),xfe=cd(),No=Pe(),$fe=Io(),kfe=Pt(),Efe=Ro(),Afe=Co(),Tfe=Wg(),Ofe=DA(),Ife=jA(),Pfe=FA(),Xg=z4(),L4=id();He.Composer=vfe.Composer;He.Document=Sfe.Document;He.Schema=wfe.Schema;He.YAMLError=zA.YAMLError;He.YAMLParseError=zA.YAMLParseError;He.YAMLWarning=zA.YAMLWarning;He.Alias=xfe.Alias;He.isAlias=No.isAlias;He.isCollection=No.isCollection;He.isDocument=No.isDocument;He.isMap=No.isMap;He.isNode=No.isNode;He.isPair=No.isPair;He.isScalar=No.isScalar;He.isSeq=No.isSeq;He.Pair=$fe.Pair;He.Scalar=kfe.Scalar;He.YAMLMap=Efe.YAMLMap;He.YAMLSeq=Afe.YAMLSeq;He.CST=Tfe;He.Lexer=Ofe.Lexer;He.LineCounter=Ife.LineCounter;He.Parser=Pfe.Parser;He.parse=Xg.parse;He.parseAllDocuments=Xg.parseAllDocuments;He.parseDocument=Xg.parseDocument;He.stringify=Xg.stringify;He.visit=L4.visit;He.visitAsync=L4.visitAsync});import{execFileSync as Rfe}from"node:child_process";import{existsSync as Cfe,readFileSync as Dfe}from"node:fs";import{join as B4}from"node:path";function vc(t,e){return Rfe("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ry(t){try{let e=vc(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function ny(t,e){Nfe(t,e);let r=vc(t,["rev-parse","HEAD"]).trim(),n=jfe(t,e);return{groups:Mfe(t,n),head:r,inventory:{after:q4(ey(t,"spec.yaml")),before:q4(LA(t,e,"spec.yaml"))},since:e,unsharded_commits:Ufe(t,e)}}function UA(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function Nfe(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");try{vc(t,["rev-parse","--verify","--quiet",`${r}^{commit}`])}catch{throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}}function jfe(t,e){let r=vc(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!U4(c)&&!U4(a)))if(s.startsWith("A")){let l=Qg(ey(t,c));if(!l)continue;l.status==="done"?n.push(bc(l,"added-as-done")):l.status==="archived"&&n.push(bc(l,"archived"))}else if(s.startsWith("D")){let l=Qg(LA(t,e,a));l&&n.push(bc(l,"archived"))}else{let l=Qg(ey(t,c));if(!l)continue;let d=Qg(LA(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(bc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(bc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(bc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function U4(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function bc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>UA(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function Qg(t){if(t===null)return null;let e;try{e=(0,ty.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function ey(t,e){let r=B4(t,e);if(!Cfe(r))return null;try{return Dfe(r,"utf8")}catch{return null}}function LA(t,e,r){try{return vc(t,["show",`${e}:${r}`])}catch{return null}}function Mfe(t,e){let r=Ffe(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function Ffe(t){let e=ey(t,B4("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,ty.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function q4(t){let e={};if(t!==null)try{let n=(0,ty.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function Ufe(t,e){let r=vc(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);zfe.test(a)&&(Lfe.test(a)||n.push({hash:s,subject:a}))}return n}var ty,zfe,Lfe,iy=y(()=>{"use strict";ty=kt(or(),1);zfe=/^(feat|fix)(\([^)]*\))?!?:/,Lfe=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{existsSync as qfe}from"node:fs";import{join as Bfe}from"node:path";function oy(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${Hfe[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` +`)}function sy(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${Gfe(l,r)} |`)}return n.join(` +`)}function Gfe(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of Zfe)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${qfe(Bfe(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function ay(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),H4(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)H4(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function H4(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=UA(r);n&&t.push(`- ${n}`)}t.push("")}var Hfe,Zfe,qA=y(()=>{"use strict";iy();Hfe={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Zfe=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Vfe}from"node:fs";function di(t="./spec.yaml"){let e=Vfe(t,"utf8");return(0,Z4.parse)(e)}var Z4,cy=y(()=>{"use strict";Z4=kt(or(),1)});var jo=v((Or,GA)=>{"use strict";var BA=Or.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+V4(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};BA.prototype.toString=function(){return this.property+" "+this.message};var ly=Or.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};ly.prototype.addError=function(e){var r;if(typeof e=="string")r=new BA(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new BA(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new Vs(this);if(this.throwError)throw r;return r};ly.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Wfe(t,e){return e+": "+t.toString()+` +`}ly.prototype.toString=function(e){return this.errors.map(Wfe).join("")};Object.defineProperty(ly.prototype,"valid",{get:function(){return!this.errors.length}});GA.exports.ValidatorResultError=Vs;function Vs(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Vs),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}Vs.prototype=new Error;Vs.prototype.constructor=Vs;Vs.prototype.name="Validation Error";var G4=Or.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};G4.prototype=Object.create(Error.prototype,{constructor:{value:G4,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var HA=Or.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+V4(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};HA.prototype.resolve=function(e){return W4(this.base,e)};HA.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=W4(this.base,i||"");var s=new HA(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var zn=Or.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};zn.regexp=zn.regex;zn.pattern=zn.regex;zn.ipv4=zn["ip-address"];Or.isFormat=function(e,r,n){if(typeof e=="string"&&zn[r]!==void 0){if(zn[r]instanceof RegExp)return zn[r].test(e);if(typeof zn[r]=="function")return zn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var V4=Or.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Or.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function Kfe(t,e,r,n){typeof r=="object"?e[n]=ZA(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Jfe(t,e,r){e[r]=t[r]}function Yfe(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=ZA(t[n],e[n]):r[n]=e[n]}function ZA(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Kfe.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Jfe.bind(null,t,n)),Object.keys(e).forEach(Yfe.bind(null,t,e,n))),n}GA.exports.deepMerge=ZA;Or.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function Xfe(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Or.encodePath=function(e){return e.map(Xfe).join("")};Or.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Or.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var W4=Or.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var X4=v((cVe,Y4)=>{"use strict";var Hr=jo(),Fe=Hr.ValidatorResult,Mo=Hr.SchemaError,VA={};VA.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=VA.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function WA(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new Mo("anyOf must be an array");if(!r.anyOf.some(WA.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new Mo("allOf must be an array");var o=new Fe(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new Mo("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(WA.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!Hr.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=WA.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!Hr.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!Hr.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function KA(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!Hr.isSchema(s))throw new Mo('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(KA(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new Mo('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=KA(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function K4(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new Mo('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&K4.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)K4.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!Hr.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function Qfe(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var JA=jo();YA.exports.SchemaScanResult=Q4;function Q4(t,e){this.id=t,this.ref=e}YA.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=JA.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=JA.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!JA.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var e6=X4(),Fo=jo(),t6=uy().scan,r6=Fo.ValidatorResult,epe=Fo.ValidatorResultError,Dd=Fo.SchemaError,n6=Fo.SchemaContext,tpe="/",Vt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(fi),this.attributes=Object.create(e6.validators)};Vt.prototype.customFormats={};Vt.prototype.schemas=null;Vt.prototype.types=null;Vt.prototype.attributes=null;Vt.prototype.unresolvedRefs=null;Vt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=t6(r||tpe,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Vt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=Fo.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Dd("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Vt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Dd('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var fi=Vt.prototype.types={};fi.string=function(e){return typeof e=="string"};fi.number=function(e){return typeof e=="number"&&isFinite(e)};fi.integer=function(e){return typeof e=="number"&&e%1===0};fi.boolean=function(e){return typeof e=="boolean"};fi.array=function(e){return Array.isArray(e)};fi.null=function(e){return e===null};fi.date=function(e){return e instanceof Date};fi.any=function(e){return!0};fi.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};o6.exports=Vt});var a6=v((dVe,Vi)=>{"use strict";var rpe=Vi.exports.Validator=s6();Vi.exports.ValidatorResult=jo().ValidatorResult;Vi.exports.ValidatorResultError=jo().ValidatorResultError;Vi.exports.ValidationError=jo().ValidationError;Vi.exports.SchemaError=jo().SchemaError;Vi.exports.SchemaScanResult=uy().SchemaScanResult;Vi.exports.scan=uy().scan;Vi.exports.validate=function(t,e,r){var n=new rpe;return n.validate(t,e,r)}});import{readFileSync as npe}from"node:fs";import{dirname as ipe,join as ope}from"node:path";import{fileURLToPath as spe}from"node:url";function dpe(t){let e=upe.validate(t,lpe);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function l6(t){let e=dpe(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var c6,ape,cpe,lpe,upe,u6=y(()=>{"use strict";c6=kt(a6(),1),ape=ipe(spe(import.meta.url)),cpe=ope(ape,"schema.json"),lpe=JSON.parse(npe(cpe,"utf8")),upe=new c6.Validator});import{existsSync as JA,readdirSync as fpe}from"node:fs";import{dirname as ppe,join as Vs,resolve as f6}from"node:path";function d6(t){return JA(t)?fpe(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>di(Vs(t,r))):[]}function Ws(t,e){ly=e?{cwd:f6(t),spec:e}:null}function J(t=".",e="spec.yaml"){return ly&&e==="spec.yaml"&&f6(t)===ly.cwd?ly.spec:mpe(t,e)}function mpe(t,e){let r=Vs(t,e),n=di(r),i=Vs(t,ppe(e),"spec");if(!n.features||n.features.length===0){let o=d6(Vs(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=d6(Vs(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Vs(i,"architecture.yaml");JA(o)&&(n.architecture=di(o))}if(!n.capabilities||n.capabilities.length===0){let o=Vs(i,"capabilities.yaml");if(JA(o)){let s=di(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return l6(n),n}var ly,at=y(()=>{"use strict";sy();u6();ly=null});import bc from"node:process";function QA(){return!!bc.stdout.isTTY}function B(t,e,r=""){let n=p6[t],i=r?` ${r}`:"";QA()?bc.stdout.write(`${YA[t]}${n}${XA} ${e}${i} -`):bc.stdout.write(`${n} ${e}${i} -`)}function Dd(t,e,r=""){if(!QA())return;let n=r?` ${r}`:"";bc.stdout.write(`${m6}${YA.start}\xB7${XA} ${t} \xB7 ${e}${n}`)}function Ks(t,e,r=""){let n=p6[t],i=r?` ${r}`:"";QA()?bc.stdout.write(`${m6}${YA[t]}${n}${XA} ${e}${i} -`):bc.stdout.write(`${n} ${e}${i} -`)}var p6,YA,XA,m6,zo=y(()=>{"use strict";p6={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},YA={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},XA="\x1B[0m",m6="\r\x1B[K"});import{execFileSync as g6}from"node:child_process";import{appendFileSync as hpe,existsSync as eT,mkdirSync as gpe,readFileSync as ype,renameSync as _pe,statSync as bpe}from"node:fs";import{userInfo as vpe}from"node:os";import{dirname as Spe,join as y6}from"node:path";function _6(t){return y6(t,wpe,xpe)}function Zr(t,e){let r=_6(t),n=Spe(r);eT(n)||gpe(n,{recursive:!0});try{eT(r)&&bpe(r).size>kpe&&_pe(r,y6(n,$pe))}catch{}hpe(r,`${JSON.stringify(e)} -`,"utf8")}function Nd(t){let e=_6(t);if(!eT(e))return[];let r=ype(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}function Gr(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function Epe(t){let e;try{e=g6("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=vpe().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Ape(t){try{return g6("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function tT(t,e){try{let r=Nd(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function Ki(t,e,r){try{let n=Ape(t),i=Epe(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=tT(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Zr(t,Gr(e,o))}catch{}}var wpe,xpe,$pe,kpe,pi=y(()=>{"use strict";wpe=".cladding",xpe="events.log.jsonl",$pe="events.log.1.jsonl",kpe=5*1024*1024});import{createHash as Tpe}from"node:crypto";import{existsSync as Ope,readFileSync as b6,writeFileSync as Ipe}from"node:fs";import{join as rT}from"node:path";function jd(t,e){let r=Tpe("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(b6(rT(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function vc(t){let e=rT(t,...v6);if(!Ope(e))return null;let r=new Map;try{for(let n of b6(e,"utf8").split(` + `)}`)}var c6,ape,cpe,lpe,upe,u6=y(()=>{"use strict";c6=kt(a6(),1),ape=ipe(spe(import.meta.url)),cpe=ope(ape,"schema.json"),lpe=JSON.parse(npe(cpe,"utf8")),upe=new c6.Validator});import{existsSync as XA,readdirSync as fpe}from"node:fs";import{dirname as ppe,join as Ws,resolve as f6}from"node:path";function d6(t){return XA(t)?fpe(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>di(Ws(t,r))):[]}function Ks(t,e){dy=e?{cwd:f6(t),spec:e}:null}function Y(t=".",e="spec.yaml"){return dy&&e==="spec.yaml"&&f6(t)===dy.cwd?dy.spec:mpe(t,e)}function mpe(t,e){let r=Ws(t,e),n=di(r),i=Ws(t,ppe(e),"spec");if(!n.features||n.features.length===0){let o=d6(Ws(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=d6(Ws(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Ws(i,"architecture.yaml");XA(o)&&(n.architecture=di(o))}if(!n.capabilities||n.capabilities.length===0){let o=Ws(i,"capabilities.yaml");if(XA(o)){let s=di(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return l6(n),n}var dy,at=y(()=>{"use strict";cy();u6();dy=null});import Sc from"node:process";function tT(){return!!Sc.stdout.isTTY}function B(t,e,r=""){let n=p6[t],i=r?` ${r}`:"";tT()?Sc.stdout.write(`${QA[t]}${n}${eT} ${e}${i} +`):Sc.stdout.write(`${n} ${e}${i} +`)}function Nd(t,e,r=""){if(!tT())return;let n=r?` ${r}`:"";Sc.stdout.write(`${m6}${QA.start}\xB7${eT} ${t} \xB7 ${e}${n}`)}function Js(t,e,r=""){let n=p6[t],i=r?` ${r}`:"";tT()?Sc.stdout.write(`${m6}${QA[t]}${n}${eT} ${e}${i} +`):Sc.stdout.write(`${n} ${e}${i} +`)}var p6,QA,eT,m6,zo=y(()=>{"use strict";p6={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},QA={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},eT="\x1B[0m",m6="\r\x1B[K"});import{execFileSync as g6}from"node:child_process";import{appendFileSync as hpe,existsSync as rT,mkdirSync as gpe,readFileSync as ype,renameSync as _pe,statSync as bpe}from"node:fs";import{userInfo as vpe}from"node:os";import{dirname as Spe,join as y6}from"node:path";function _6(t){return y6(t,wpe,xpe)}function Zr(t,e){let r=_6(t),n=Spe(r);rT(n)||gpe(n,{recursive:!0});try{rT(r)&&bpe(r).size>kpe&&_pe(r,y6(n,$pe))}catch{}hpe(r,`${JSON.stringify(e)} +`,"utf8")}function jd(t){let e=_6(t);if(!rT(e))return[];let r=ype(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}function Gr(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function Epe(t){let e;try{e=g6("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=vpe().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Ape(t){try{return g6("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function nT(t,e){try{let r=jd(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function Ki(t,e,r){try{let n=Ape(t),i=Epe(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=nT(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Zr(t,Gr(e,o))}catch{}}var wpe,xpe,$pe,kpe,pi=y(()=>{"use strict";wpe=".cladding",xpe="events.log.jsonl",$pe="events.log.1.jsonl",kpe=5*1024*1024});import{createHash as Tpe}from"node:crypto";import{existsSync as Ope,readFileSync as b6,writeFileSync as Ipe}from"node:fs";import{join as iT}from"node:path";function Md(t,e){let r=Tpe("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(b6(iT(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function wc(t){let e=iT(t,...v6);if(!Ope(e))return null;let r=new Map;try{for(let n of b6(e,"utf8").split(` `)){let i=n.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);i&&r.set(i[1],i[2])}}catch{return null}return r}function S6(t,e){let r=(e.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return!1;let i=`# Cladding \xB7 Tier C \u2014 verification attestation (GREEN strict pre-push gate). Do not edit by hand. # One line per done feature: sha256 tree-hash of its modules at the last # attested verification. STALE_ATTESTATION compares; \`clad check # --tier=pre-push --strict\` GREEN refreshes. Content-anchored: survives # fresh clones and squash/rebase (suggested .gitattributes: merge=union). attested: -`+r.map(o=>` ${o.id}: ${jd(t,o.modules??[])}`).sort().join(` +`+r.map(o=>` ${o.id}: ${Md(t,o.modules??[])}`).sort().join(` `)+` -`;return Ipe(rT(t,...v6),i,"utf8"),!0}var v6,Md=y(()=>{"use strict";v6=["spec","attestation.yaml"]});function Et(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var Ji=y(()=>{});import{fileURLToPath as Lpe}from"node:url";var Sc,Upe,oT,sT,wc=y(()=>{Sc=(t,e)=>{let r=sT(Upe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Upe=t=>oT(t)?t.toString():t,oT=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,sT=t=>t instanceof URL?Lpe(t):t});var dy,aT=y(()=>{Ji();wc();dy=(t,e=[],r={})=>{let n=Sc(t,"First argument"),[i,o]=Et(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Et(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as qpe}from"node:string_decoder";var T6,O6,Ft,Yi,Bpe,I6,Hpe,fy,P6,Zpe,Fd,Gpe,cT,Vpe,Vr=y(()=>{({toString:T6}=Object.prototype),O6=t=>T6.call(t)==="[object ArrayBuffer]",Ft=t=>T6.call(t)==="[object Uint8Array]",Yi=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Bpe=new TextEncoder,I6=t=>Bpe.encode(t),Hpe=new TextDecoder,fy=t=>Hpe.decode(t),P6=(t,e)=>Zpe(t,e).join(""),Zpe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new qpe(e),n=t.map(o=>typeof o=="string"?I6(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Fd=t=>t.length===1&&Ft(t[0])?t[0]:cT(Gpe(t)),Gpe=t=>t.map(e=>typeof e=="string"?I6(e):e),cT=t=>{let e=new Uint8Array(Vpe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Vpe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Wpe}from"node:child_process";var N6,j6,Kpe,Jpe,R6,Ype,C6,D6,Xpe,M6=y(()=>{Ji();Vr();N6=t=>Array.isArray(t)&&Array.isArray(t.raw),j6=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Kpe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},Kpe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=Jpe(i,t.raw[n]),c=C6(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>D6(d)):[D6(l)];return C6(c,u,a)},Jpe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=R6.has(e[0]);for(let s=0,a=0;s{"use strict";v6=["spec","attestation.yaml"]});function Et(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var Ji=y(()=>{});import{fileURLToPath as Lpe}from"node:url";var xc,Upe,aT,cT,$c=y(()=>{xc=(t,e)=>{let r=cT(Upe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Upe=t=>aT(t)?t.toString():t,aT=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,cT=t=>t instanceof URL?Lpe(t):t});var py,lT=y(()=>{Ji();$c();py=(t,e=[],r={})=>{let n=xc(t,"First argument"),[i,o]=Et(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Et(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as qpe}from"node:string_decoder";var T6,O6,Ft,Yi,Bpe,I6,Hpe,my,P6,Zpe,zd,Gpe,uT,Vpe,Vr=y(()=>{({toString:T6}=Object.prototype),O6=t=>T6.call(t)==="[object ArrayBuffer]",Ft=t=>T6.call(t)==="[object Uint8Array]",Yi=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Bpe=new TextEncoder,I6=t=>Bpe.encode(t),Hpe=new TextDecoder,my=t=>Hpe.decode(t),P6=(t,e)=>Zpe(t,e).join(""),Zpe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new qpe(e),n=t.map(o=>typeof o=="string"?I6(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},zd=t=>t.length===1&&Ft(t[0])?t[0]:uT(Gpe(t)),Gpe=t=>t.map(e=>typeof e=="string"?I6(e):e),uT=t=>{let e=new Uint8Array(Vpe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Vpe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Wpe}from"node:child_process";var N6,j6,Kpe,Jpe,R6,Ype,C6,D6,Xpe,M6=y(()=>{Ji();Vr();N6=t=>Array.isArray(t)&&Array.isArray(t.raw),j6=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Kpe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},Kpe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=Jpe(i,t.raw[n]),c=C6(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>D6(d)):[D6(l)];return C6(c,u,a)},Jpe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=R6.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],D6=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Et(t)&&("stdout"in t||"isMaxBuffer"in t))return Xpe(t);throw t instanceof Wpe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},Xpe=({stdout:t})=>{if(typeof t=="string")return t;if(Ft(t))return fy(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import lT from"node:process";var Ln,py,mn,my,Xi=y(()=>{Ln=t=>py.includes(t),py=[lT.stdin,lT.stdout,lT.stderr],mn=["stdin","stdout","stderr"],my=t=>mn[t]??`stdio[${t}]`});import{debuglog as Qpe}from"node:util";var z6,uT,eme,tme,rme,nme,F6,ime,dT,ome,sme,ame,cme,fT,Qi,eo=y(()=>{Ji();Xi();z6=t=>{let e={...t};for(let r of fT)e[r]=uT(t,r);return e},uT=(t,e)=>{let r=Array.from({length:eme(t)+1}),n=tme(t[e],r,e);return sme(n,e)},eme=({stdio:t})=>Array.isArray(t)?Math.max(t.length,mn.length):mn.length,tme=(t,e,r)=>Et(t)?rme(t,e,r):e.fill(t),rme=(t,e,r)=>{for(let n of Object.keys(t).sort(nme))for(let i of ime(n,r,e))e[i]=t[n];return e},nme=(t,e)=>F6(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,ime=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=dT(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`]),Ype={x:3,u:5},C6=(t,e,r)=>r||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],D6=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Et(t)&&("stdout"in t||"isMaxBuffer"in t))return Xpe(t);throw t instanceof Wpe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},Xpe=({stdout:t})=>{if(typeof t=="string")return t;if(Ft(t))return my(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import dT from"node:process";var Ln,hy,hn,gy,Xi=y(()=>{Ln=t=>hy.includes(t),hy=[dT.stdin,dT.stdout,dT.stderr],hn=["stdin","stdout","stderr"],gy=t=>hn[t]??`stdio[${t}]`});import{debuglog as Qpe}from"node:util";var z6,fT,eme,tme,rme,nme,F6,ime,pT,ome,sme,ame,cme,mT,Qi,eo=y(()=>{Ji();Xi();z6=t=>{let e={...t};for(let r of mT)e[r]=fT(t,r);return e},fT=(t,e)=>{let r=Array.from({length:eme(t)+1}),n=tme(t[e],r,e);return sme(n,e)},eme=({stdio:t})=>Array.isArray(t)?Math.max(t.length,hn.length):hn.length,tme=(t,e,r)=>Et(t)?rme(t,e,r):e.fill(t),rme=(t,e,r)=>{for(let n of Object.keys(t).sort(nme))for(let i of ime(n,r,e))e[i]=t[n];return e},nme=(t,e)=>F6(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,ime=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=pT(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},dT=t=>{if(t==="all")return t;if(mn.includes(t))return mn.indexOf(t);let e=ome.exec(t);if(e!==null)return Number(e[1])},ome=/^fd(\d+)$/,sme=(t,e)=>t.map(r=>r===void 0?cme[e]:r),ame=Qpe("execa").enabled?"full":"none",cme={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:ame,stripFinalNewline:!0},fT=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Qi=(t,e)=>e==="ipc"?t.at(-1):t[e]});var xc,$c,L6,pT,lme,hy,gy,Lo=y(()=>{eo();xc=({verbose:t},e)=>pT(t,e)!=="none",$c=({verbose:t},e)=>!["none","short"].includes(pT(t,e)),L6=({verbose:t},e)=>{let r=pT(t,e);return hy(r)?r:void 0},pT=(t,e)=>e===void 0?lme(t):Qi(t,e),lme=t=>t.find(e=>hy(e))??gy.findLast(e=>t.includes(e)),hy=t=>typeof t=="function",gy=["none","short","full"]});import{platform as ume}from"node:process";import{stripVTControlCharacters as dme}from"node:util";var U6,zd,q6,fme,pme,mme,hme,gme,yme,_me,yy=y(()=>{U6=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>yme(q6(o))).join(" ");return{command:n,escapedCommand:i}},zd=t=>dme(t).split(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},pT=t=>{if(t==="all")return t;if(hn.includes(t))return hn.indexOf(t);let e=ome.exec(t);if(e!==null)return Number(e[1])},ome=/^fd(\d+)$/,sme=(t,e)=>t.map(r=>r===void 0?cme[e]:r),ame=Qpe("execa").enabled?"full":"none",cme={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:ame,stripFinalNewline:!0},mT=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Qi=(t,e)=>e==="ipc"?t.at(-1):t[e]});var kc,Ec,L6,hT,lme,yy,_y,Lo=y(()=>{eo();kc=({verbose:t},e)=>hT(t,e)!=="none",Ec=({verbose:t},e)=>!["none","short"].includes(hT(t,e)),L6=({verbose:t},e)=>{let r=hT(t,e);return yy(r)?r:void 0},hT=(t,e)=>e===void 0?lme(t):Qi(t,e),lme=t=>t.find(e=>yy(e))??_y.findLast(e=>t.includes(e)),yy=t=>typeof t=="function",_y=["none","short","full"]});import{platform as ume}from"node:process";import{stripVTControlCharacters as dme}from"node:util";var U6,Ld,q6,fme,pme,mme,hme,gme,yme,_me,by=y(()=>{U6=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>yme(q6(o))).join(" ");return{command:n,escapedCommand:i}},Ld=t=>dme(t).split(` `).map(e=>q6(e)).join(` -`),q6=t=>t.replaceAll(mme,e=>fme(e)),fme=t=>{let e=hme[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=gme?`\\u${n.padStart(4,"0")}`:`\\U${n}`},pme=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},mme=pme(),hme={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},gme=65535,yme=t=>_me.test(t)?t:ume==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,_me=/^[\w./-]+$/});import B6 from"node:process";function mT(){let{env:t}=B6,{TERM:e,TERM_PROGRAM:r}=t;return B6.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var H6=y(()=>{});var Z6,G6,bme,vme,Sme,wme,xme,_y,xWe,V6=y(()=>{H6();Z6={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},G6={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},bme={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},vme={...Z6,...G6},Sme={...Z6,...bme},wme=mT(),xme=wme?vme:Sme,_y=xme,xWe=Object.entries(G6)});import $me from"node:tty";var kme,ge,EWe,W6,AWe,TWe,OWe,IWe,PWe,RWe,CWe,DWe,NWe,jWe,MWe,FWe,zWe,LWe,UWe,by,qWe,BWe,HWe,ZWe,GWe,VWe,WWe,KWe,JWe,K6,YWe,J6,XWe,QWe,eKe,tKe,rKe,nKe,iKe,oKe,sKe,aKe,cKe,hT=y(()=>{kme=$me?.WriteStream?.prototype?.hasColors?.()??!1,ge=(t,e)=>{if(!kme)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},EWe=ge(0,0),W6=ge(1,22),AWe=ge(2,22),TWe=ge(3,23),OWe=ge(4,24),IWe=ge(53,55),PWe=ge(7,27),RWe=ge(8,28),CWe=ge(9,29),DWe=ge(30,39),NWe=ge(31,39),jWe=ge(32,39),MWe=ge(33,39),FWe=ge(34,39),zWe=ge(35,39),LWe=ge(36,39),UWe=ge(37,39),by=ge(90,39),qWe=ge(40,49),BWe=ge(41,49),HWe=ge(42,49),ZWe=ge(43,49),GWe=ge(44,49),VWe=ge(45,49),WWe=ge(46,49),KWe=ge(47,49),JWe=ge(100,49),K6=ge(91,39),YWe=ge(92,39),J6=ge(93,39),XWe=ge(94,39),QWe=ge(95,39),eKe=ge(96,39),tKe=ge(97,39),rKe=ge(101,49),nKe=ge(102,49),iKe=ge(103,49),oKe=ge(104,49),sKe=ge(105,49),aKe=ge(106,49),cKe=ge(107,49)});var Y6=y(()=>{hT();hT()});var eB,Ame,vy,X6,Tme,Q6,Ome,tB=y(()=>{V6();Y6();eB=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Ame(r),c=Tme[t]({failed:o,reject:s,piped:n}),l=Ome[t]({reject:s});return`${by(`[${a}]`)} ${by(`[${i}]`)} ${l(c)} ${l(e)}`},Ame=t=>`${vy(t.getHours(),2)}:${vy(t.getMinutes(),2)}:${vy(t.getSeconds(),2)}.${vy(t.getMilliseconds(),3)}`,vy=(t,e)=>String(t).padStart(e,"0"),X6=({failed:t,reject:e})=>t?e?_y.cross:_y.warning:_y.tick,Tme={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:X6,duration:X6},Q6=t=>t,Ome={command:()=>W6,output:()=>Q6,ipc:()=>Q6,error:({reject:t})=>t?K6:J6,duration:()=>by}});var rB,Ime,Pme,nB=y(()=>{Lo();rB=(t,e,r)=>{let n=L6(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Ime(i,o,n)).filter(i=>i!==void 0).map(i=>Pme(i)).join("")},Ime=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Pme=t=>t.endsWith(` +`),q6=t=>t.replaceAll(mme,e=>fme(e)),fme=t=>{let e=hme[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=gme?`\\u${n.padStart(4,"0")}`:`\\U${n}`},pme=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},mme=pme(),hme={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},gme=65535,yme=t=>_me.test(t)?t:ume==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,_me=/^[\w./-]+$/});import B6 from"node:process";function gT(){let{env:t}=B6,{TERM:e,TERM_PROGRAM:r}=t;return B6.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var H6=y(()=>{});var Z6,G6,bme,vme,Sme,wme,xme,vy,$We,V6=y(()=>{H6();Z6={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},G6={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},bme={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},vme={...Z6,...G6},Sme={...Z6,...bme},wme=gT(),xme=wme?vme:Sme,vy=xme,$We=Object.entries(G6)});import $me from"node:tty";var kme,ge,AWe,W6,TWe,OWe,IWe,PWe,RWe,CWe,DWe,NWe,jWe,MWe,FWe,zWe,LWe,UWe,qWe,Sy,BWe,HWe,ZWe,GWe,VWe,WWe,KWe,JWe,YWe,K6,XWe,J6,QWe,eKe,tKe,rKe,nKe,iKe,oKe,sKe,aKe,cKe,lKe,yT=y(()=>{kme=$me?.WriteStream?.prototype?.hasColors?.()??!1,ge=(t,e)=>{if(!kme)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},AWe=ge(0,0),W6=ge(1,22),TWe=ge(2,22),OWe=ge(3,23),IWe=ge(4,24),PWe=ge(53,55),RWe=ge(7,27),CWe=ge(8,28),DWe=ge(9,29),NWe=ge(30,39),jWe=ge(31,39),MWe=ge(32,39),FWe=ge(33,39),zWe=ge(34,39),LWe=ge(35,39),UWe=ge(36,39),qWe=ge(37,39),Sy=ge(90,39),BWe=ge(40,49),HWe=ge(41,49),ZWe=ge(42,49),GWe=ge(43,49),VWe=ge(44,49),WWe=ge(45,49),KWe=ge(46,49),JWe=ge(47,49),YWe=ge(100,49),K6=ge(91,39),XWe=ge(92,39),J6=ge(93,39),QWe=ge(94,39),eKe=ge(95,39),tKe=ge(96,39),rKe=ge(97,39),nKe=ge(101,49),iKe=ge(102,49),oKe=ge(103,49),sKe=ge(104,49),aKe=ge(105,49),cKe=ge(106,49),lKe=ge(107,49)});var Y6=y(()=>{yT();yT()});var eB,Ame,wy,X6,Tme,Q6,Ome,tB=y(()=>{V6();Y6();eB=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Ame(r),c=Tme[t]({failed:o,reject:s,piped:n}),l=Ome[t]({reject:s});return`${Sy(`[${a}]`)} ${Sy(`[${i}]`)} ${l(c)} ${l(e)}`},Ame=t=>`${wy(t.getHours(),2)}:${wy(t.getMinutes(),2)}:${wy(t.getSeconds(),2)}.${wy(t.getMilliseconds(),3)}`,wy=(t,e)=>String(t).padStart(e,"0"),X6=({failed:t,reject:e})=>t?e?vy.cross:vy.warning:vy.tick,Tme={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:X6,duration:X6},Q6=t=>t,Ome={command:()=>W6,output:()=>Q6,ipc:()=>Q6,error:({reject:t})=>t?K6:J6,duration:()=>Sy}});var rB,Ime,Pme,nB=y(()=>{Lo();rB=(t,e,r)=>{let n=L6(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Ime(i,o,n)).filter(i=>i!==void 0).map(i=>Pme(i)).join("")},Ime=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Pme=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as Rme}from"node:util";var mi,Cme,Dme,Nme,Sy,jme,kc=y(()=>{yy();tB();nB();mi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Cme({type:t,result:i,verboseInfo:n}),s=Dme(e,o),a=rB(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Cme=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),Dme=(t,e)=>t.split(` -`).map(r=>Nme({...e,message:r})),Nme=t=>({verboseLine:eB(t),verboseObject:t}),Sy=t=>{let e=typeof t=="string"?t:Rme(t);return zd(e).replaceAll(" "," ".repeat(jme))},jme=2});var iB,oB=y(()=>{Lo();kc();iB=(t,e)=>{xc(e)&&mi({type:"command",verboseMessage:t,verboseInfo:e})}});var sB,Mme,Fme,zme,aB=y(()=>{Lo();sB=(t,e,r)=>{zme(t);let n=Mme(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Mme=t=>xc({verbose:t})?Fme++:void 0,Fme=0n,zme=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!gy.includes(e)&&!hy(e)){let r=gy.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as cB}from"node:process";var wy,gT,xy=y(()=>{wy=()=>cB.bigint(),gT=t=>Number(cB.bigint()-t)/1e6});var $y,yT=y(()=>{oB();aB();xy();yy();eo();$y=(t,e,r)=>{let n=wy(),{command:i,escapedCommand:o}=U6(t,e),s=uT(r,"verbose"),a=sB(s,o,{...r});return iB(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var pB=v((DKe,fB)=>{fB.exports=dB;dB.sync=Ume;var lB=Be("fs");function Lme(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{yB.exports=hB;hB.sync=qme;var mB=Be("fs");function hB(t,e,r){mB.stat(t,function(n,i){r(n,n?!1:gB(i,e))})}function qme(t,e){return gB(mB.statSync(t),e)}function gB(t,e){return t.isFile()&&Bme(t,e)}function Bme(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var vB=v((MKe,bB)=>{var jKe=Be("fs"),ky;process.platform==="win32"||global.TESTING_WINDOWS?ky=pB():ky=_B();bB.exports=_T;_T.sync=Hme;function _T(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){_T(t,e||{},function(o,s){o?i(o):n(s)})})}ky(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Hme(t,e){try{return ky.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var AB=v((FKe,EB)=>{var Ec=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",SB=Be("path"),Zme=Ec?";":":",wB=vB(),xB=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),$B=(t,e)=>{let r=e.colon||Zme,n=t.match(/\//)||Ec&&t.match(/\\/)?[""]:[...Ec?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Ec?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Ec?i.split(r):[""];return Ec&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},kB=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=$B(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(xB(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=SB.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];wB(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},Gme=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=$B(t,e),o=[];for(let s=0;s{"use strict";var TB=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};bT.exports=TB;bT.exports.default=TB});var CB=v((LKe,RB)=>{"use strict";var IB=Be("path"),Vme=AB(),Wme=OB();function PB(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=Vme.sync(t.command,{path:r[Wme({env:r})],pathExt:e?IB.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=IB.resolve(i?t.options.cwd:"",s)),s}function Kme(t){return PB(t)||PB(t,!0)}RB.exports=Kme});var DB=v((UKe,ST)=>{"use strict";var vT=/([()\][%!^"`<>&|;, *?])/g;function Jme(t){return t=t.replace(vT,"^$1"),t}function Yme(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(vT,"^$1"),e&&(t=t.replace(vT,"^$1")),t}ST.exports.command=Jme;ST.exports.argument=Yme});var jB=v((qKe,NB)=>{"use strict";NB.exports=/^#!(.*)/});var FB=v((BKe,MB)=>{"use strict";var Xme=jB();MB.exports=(t="")=>{let e=t.match(Xme);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var LB=v((HKe,zB)=>{"use strict";var wT=Be("fs"),Qme=FB();function ehe(t){let r=Buffer.alloc(150),n;try{n=wT.openSync(t,"r"),wT.readSync(n,r,0,150,0),wT.closeSync(n)}catch{}return Qme(r.toString())}zB.exports=ehe});var HB=v((ZKe,BB)=>{"use strict";var the=Be("path"),UB=CB(),qB=DB(),rhe=LB(),nhe=process.platform==="win32",ihe=/\.(?:com|exe)$/i,ohe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function she(t){t.file=UB(t);let e=t.file&&rhe(t.file);return e?(t.args.unshift(t.file),t.command=e,UB(t)):t.file}function ahe(t){if(!nhe)return t;let e=she(t),r=!ihe.test(e);if(t.options.forceShell||r){let n=ohe.test(e);t.command=the.normalize(t.command),t.command=qB.command(t.command),t.args=t.args.map(o=>qB.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function che(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:ahe(n)}BB.exports=che});var VB=v((GKe,GB)=>{"use strict";var xT=process.platform==="win32";function $T(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function lhe(t,e){if(!xT)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=ZB(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function ZB(t,e){return xT&&t===1&&!e.file?$T(e.original,"spawn"):null}function uhe(t,e){return xT&&t===1&&!e.file?$T(e.original,"spawnSync"):null}GB.exports={hookChildProcess:lhe,verifyENOENT:ZB,verifyENOENTSync:uhe,notFoundError:$T}});var JB=v((VKe,Ac)=>{"use strict";var WB=Be("child_process"),kT=HB(),ET=VB();function KB(t,e,r){let n=kT(t,e,r),i=WB.spawn(n.command,n.args,n.options);return ET.hookChildProcess(i,n),i}function dhe(t,e,r){let n=kT(t,e,r),i=WB.spawnSync(n.command,n.args,n.options);return i.error=i.error||ET.verifyENOENTSync(i.status,n),i}Ac.exports=KB;Ac.exports.spawn=KB;Ac.exports.sync=dhe;Ac.exports._parse=kT;Ac.exports._enoent=ET});function Ey(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var YB=y(()=>{});var XB=y(()=>{});import{promisify as fhe}from"node:util";import{execFile as phe,execFileSync as XKe}from"node:child_process";import QB from"node:path";import{fileURLToPath as mhe}from"node:url";function Ay(t){return t instanceof URL?mhe(t):t}function eH(t){return{*[Symbol.iterator](){let e=QB.resolve(Ay(t)),r;for(;r!==e;)yield e,r=e,e=QB.resolve(e,"..")}}}var t3e,r3e,tH=y(()=>{XB();t3e=fhe(phe);r3e=10*1024*1024});import Ty from"node:process";import Js from"node:path";var hhe,ghe,yhe,rH,nH=y(()=>{YB();tH();hhe=({cwd:t=Ty.cwd(),path:e=Ty.env[Ey()],preferLocal:r=!0,execPath:n=Ty.execPath,addExecPath:i=!0}={})=>{let o=Js.resolve(Ay(t)),s=[],a=e.split(Js.delimiter);return r&&ghe(s,a,o),i&&yhe(s,a,n,o),e===""||e===Js.delimiter?`${s.join(Js.delimiter)}${e}`:[...s,e].join(Js.delimiter)},ghe=(t,e,r)=>{for(let n of eH(r)){let i=Js.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},yhe=(t,e,r,n)=>{let i=Js.resolve(n,Ay(r),"..");e.includes(i)||t.push(i)},rH=({env:t=Ty.env,...e}={})=>{t={...t};let r=Ey({env:t});return e.path=t[r],t[r]=hhe(e),t}});var iH,Un,oH,sH,aH,Oy,Ld,Ud,Ys=y(()=>{iH=(t,e,r)=>{let n=r?Ud:Ld,i=t instanceof Un?{}:{cause:t};return new n(e,i)},Un=class extends Error{},oH=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,aH,{value:!0,writable:!1,enumerable:!1,configurable:!1})},sH=t=>Oy(t)&&aH in t,aH=Symbol("isExecaError"),Oy=t=>Object.prototype.toString.call(t)==="[object Error]",Ld=class extends Error{};oH(Ld,Ld.name);Ud=class extends Error{};oH(Ud,Ud.name)});var cH,_he,lH,uH,dH=y(()=>{cH=()=>{let t=uH-lH+1;return Array.from({length:t},_he)},_he=(t,e)=>({name:`SIGRT${e+1}`,number:lH+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),lH=34,uH=64});var fH,pH=y(()=>{fH=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as bhe}from"node:os";var AT,vhe,mH=y(()=>{pH();dH();AT=()=>{let t=cH();return[...fH,...t].map(vhe)},vhe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=bhe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as She}from"node:os";var whe,xhe,hH,$he,khe,Ehe,b3e,gH=y(()=>{mH();whe=()=>{let t=AT();return Object.fromEntries(t.map(xhe))},xhe=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],hH=whe(),$he=()=>{let t=AT(),e=65,r=Array.from({length:e},(n,i)=>khe(i,t));return Object.assign({},...r)},khe=(t,e)=>{let r=Ehe(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},Ehe=(t,e)=>{let r=e.find(({name:n})=>She.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},b3e=$he()});import{constants as qd}from"node:os";var _H,bH,vH,Ahe,The,yH,Ohe,TT,Ihe,Phe,Iy,Bd=y(()=>{gH();_H=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return vH(t,e)},bH=t=>t===0?t:vH(t,"`subprocess.kill()`'s argument"),vH=(t,e)=>{if(Number.isInteger(t))return Ahe(t,e);if(typeof t=="string")return Ohe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${TT()}`)},Ahe=(t,e)=>{if(yH.has(t))return yH.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${TT()}`)},The=()=>new Map(Object.entries(qd.signals).reverse().map(([t,e])=>[e,t])),yH=The(),Ohe=(t,e)=>{if(t in qd.signals)return t;throw t.toUpperCase()in qd.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${TT()}`)},TT=()=>`Available signal names: ${Ihe()}. -Available signal numbers: ${Phe()}.`,Ihe=()=>Object.keys(qd.signals).sort().map(t=>`'${t}'`).join(", "),Phe=()=>[...new Set(Object.values(qd.signals).sort((t,e)=>t-e))].join(", "),Iy=t=>hH[t].description});import{setTimeout as Rhe}from"node:timers/promises";var SH,Che,wH,Dhe,Nhe,jhe,OT,Py=y(()=>{Ys();Bd();SH=t=>{if(t===!1)return t;if(t===!0)return Che;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},Che=1e3*5,wH=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Dhe(s,a,r);Nhe(l,n);let u=t(c);return jhe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Dhe=(t,e,r)=>{let[n=r,i]=Oy(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!Oy(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:bH(n),error:i}},Nhe=(t,e)=>{t!==void 0&&e.reject(t)},jhe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&OT({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},OT=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Rhe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Mhe}from"node:events";var Ry,IT=y(()=>{Ry=async(t,e)=>{t.aborted||await Mhe(t,"abort",{signal:e})}});var xH,$H,Fhe,PT=y(()=>{IT();xH=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},$H=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Fhe(t,e,n,i)],Fhe=async(t,e,r,{signal:n})=>{throw await Ry(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Tc,zhe,RT,kH,EH,Cy,AH,TH,OH,IH,PH,RH,Lhe,Uhe,qhe,qn,Bhe,Uo,Oc,Ic=y(()=>{Tc=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{zhe(t,e,r),RT(t,e,n)},zhe=(t,e,r)=>{if(!r)throw new Error(`${qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},RT=(t,e,r)=>{if(!r)throw new Error(`${qn(t,e)} cannot be used: the ${Uo(e)} has already exited or disconnected.`)},kH=t=>{throw new Error(`${qn("getOneMessage",t)} could not complete: the ${Uo(t)} exited or disconnected.`)},EH=t=>{throw new Error(`${qn("sendMessage",t)} failed: the ${Uo(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as Rme}from"node:util";var mi,Cme,Dme,Nme,xy,jme,Ac=y(()=>{by();tB();nB();mi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Cme({type:t,result:i,verboseInfo:n}),s=Dme(e,o),a=rB(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Cme=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),Dme=(t,e)=>t.split(` +`).map(r=>Nme({...e,message:r})),Nme=t=>({verboseLine:eB(t),verboseObject:t}),xy=t=>{let e=typeof t=="string"?t:Rme(t);return Ld(e).replaceAll(" "," ".repeat(jme))},jme=2});var iB,oB=y(()=>{Lo();Ac();iB=(t,e)=>{kc(e)&&mi({type:"command",verboseMessage:t,verboseInfo:e})}});var sB,Mme,Fme,zme,aB=y(()=>{Lo();sB=(t,e,r)=>{zme(t);let n=Mme(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Mme=t=>kc({verbose:t})?Fme++:void 0,Fme=0n,zme=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!_y.includes(e)&&!yy(e)){let r=_y.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as cB}from"node:process";var $y,_T,ky=y(()=>{$y=()=>cB.bigint(),_T=t=>Number(cB.bigint()-t)/1e6});var Ey,bT=y(()=>{oB();aB();ky();by();eo();Ey=(t,e,r)=>{let n=$y(),{command:i,escapedCommand:o}=U6(t,e),s=fT(r,"verbose"),a=sB(s,o,{...r});return iB(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var pB=v((NKe,fB)=>{fB.exports=dB;dB.sync=Ume;var lB=Be("fs");function Lme(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{yB.exports=hB;hB.sync=qme;var mB=Be("fs");function hB(t,e,r){mB.stat(t,function(n,i){r(n,n?!1:gB(i,e))})}function qme(t,e){return gB(mB.statSync(t),e)}function gB(t,e){return t.isFile()&&Bme(t,e)}function Bme(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var vB=v((FKe,bB)=>{var MKe=Be("fs"),Ay;process.platform==="win32"||global.TESTING_WINDOWS?Ay=pB():Ay=_B();bB.exports=vT;vT.sync=Hme;function vT(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){vT(t,e||{},function(o,s){o?i(o):n(s)})})}Ay(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Hme(t,e){try{return Ay.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var AB=v((zKe,EB)=>{var Tc=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",SB=Be("path"),Zme=Tc?";":":",wB=vB(),xB=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),$B=(t,e)=>{let r=e.colon||Zme,n=t.match(/\//)||Tc&&t.match(/\\/)?[""]:[...Tc?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Tc?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Tc?i.split(r):[""];return Tc&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},kB=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=$B(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(xB(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=SB.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];wB(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},Gme=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=$B(t,e),o=[];for(let s=0;s{"use strict";var TB=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};ST.exports=TB;ST.exports.default=TB});var CB=v((UKe,RB)=>{"use strict";var IB=Be("path"),Vme=AB(),Wme=OB();function PB(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=Vme.sync(t.command,{path:r[Wme({env:r})],pathExt:e?IB.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=IB.resolve(i?t.options.cwd:"",s)),s}function Kme(t){return PB(t)||PB(t,!0)}RB.exports=Kme});var DB=v((qKe,xT)=>{"use strict";var wT=/([()\][%!^"`<>&|;, *?])/g;function Jme(t){return t=t.replace(wT,"^$1"),t}function Yme(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(wT,"^$1"),e&&(t=t.replace(wT,"^$1")),t}xT.exports.command=Jme;xT.exports.argument=Yme});var jB=v((BKe,NB)=>{"use strict";NB.exports=/^#!(.*)/});var FB=v((HKe,MB)=>{"use strict";var Xme=jB();MB.exports=(t="")=>{let e=t.match(Xme);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var LB=v((ZKe,zB)=>{"use strict";var $T=Be("fs"),Qme=FB();function ehe(t){let r=Buffer.alloc(150),n;try{n=$T.openSync(t,"r"),$T.readSync(n,r,0,150,0),$T.closeSync(n)}catch{}return Qme(r.toString())}zB.exports=ehe});var HB=v((GKe,BB)=>{"use strict";var the=Be("path"),UB=CB(),qB=DB(),rhe=LB(),nhe=process.platform==="win32",ihe=/\.(?:com|exe)$/i,ohe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function she(t){t.file=UB(t);let e=t.file&&rhe(t.file);return e?(t.args.unshift(t.file),t.command=e,UB(t)):t.file}function ahe(t){if(!nhe)return t;let e=she(t),r=!ihe.test(e);if(t.options.forceShell||r){let n=ohe.test(e);t.command=the.normalize(t.command),t.command=qB.command(t.command),t.args=t.args.map(o=>qB.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function che(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:ahe(n)}BB.exports=che});var VB=v((VKe,GB)=>{"use strict";var kT=process.platform==="win32";function ET(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function lhe(t,e){if(!kT)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=ZB(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function ZB(t,e){return kT&&t===1&&!e.file?ET(e.original,"spawn"):null}function uhe(t,e){return kT&&t===1&&!e.file?ET(e.original,"spawnSync"):null}GB.exports={hookChildProcess:lhe,verifyENOENT:ZB,verifyENOENTSync:uhe,notFoundError:ET}});var JB=v((WKe,Oc)=>{"use strict";var WB=Be("child_process"),AT=HB(),TT=VB();function KB(t,e,r){let n=AT(t,e,r),i=WB.spawn(n.command,n.args,n.options);return TT.hookChildProcess(i,n),i}function dhe(t,e,r){let n=AT(t,e,r),i=WB.spawnSync(n.command,n.args,n.options);return i.error=i.error||TT.verifyENOENTSync(i.status,n),i}Oc.exports=KB;Oc.exports.spawn=KB;Oc.exports.sync=dhe;Oc.exports._parse=AT;Oc.exports._enoent=TT});function Ty(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var YB=y(()=>{});var XB=y(()=>{});import{promisify as fhe}from"node:util";import{execFile as phe,execFileSync as QKe}from"node:child_process";import QB from"node:path";import{fileURLToPath as mhe}from"node:url";function Oy(t){return t instanceof URL?mhe(t):t}function eH(t){return{*[Symbol.iterator](){let e=QB.resolve(Oy(t)),r;for(;r!==e;)yield e,r=e,e=QB.resolve(e,"..")}}}var r3e,n3e,tH=y(()=>{XB();r3e=fhe(phe);n3e=10*1024*1024});import Iy from"node:process";import Ys from"node:path";var hhe,ghe,yhe,rH,nH=y(()=>{YB();tH();hhe=({cwd:t=Iy.cwd(),path:e=Iy.env[Ty()],preferLocal:r=!0,execPath:n=Iy.execPath,addExecPath:i=!0}={})=>{let o=Ys.resolve(Oy(t)),s=[],a=e.split(Ys.delimiter);return r&&ghe(s,a,o),i&&yhe(s,a,n,o),e===""||e===Ys.delimiter?`${s.join(Ys.delimiter)}${e}`:[...s,e].join(Ys.delimiter)},ghe=(t,e,r)=>{for(let n of eH(r)){let i=Ys.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},yhe=(t,e,r,n)=>{let i=Ys.resolve(n,Oy(r),"..");e.includes(i)||t.push(i)},rH=({env:t=Iy.env,...e}={})=>{t={...t};let r=Ty({env:t});return e.path=t[r],t[r]=hhe(e),t}});var iH,Un,oH,sH,aH,Py,Ud,qd,Xs=y(()=>{iH=(t,e,r)=>{let n=r?qd:Ud,i=t instanceof Un?{}:{cause:t};return new n(e,i)},Un=class extends Error{},oH=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,aH,{value:!0,writable:!1,enumerable:!1,configurable:!1})},sH=t=>Py(t)&&aH in t,aH=Symbol("isExecaError"),Py=t=>Object.prototype.toString.call(t)==="[object Error]",Ud=class extends Error{};oH(Ud,Ud.name);qd=class extends Error{};oH(qd,qd.name)});var cH,_he,lH,uH,dH=y(()=>{cH=()=>{let t=uH-lH+1;return Array.from({length:t},_he)},_he=(t,e)=>({name:`SIGRT${e+1}`,number:lH+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),lH=34,uH=64});var fH,pH=y(()=>{fH=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as bhe}from"node:os";var OT,vhe,mH=y(()=>{pH();dH();OT=()=>{let t=cH();return[...fH,...t].map(vhe)},vhe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=bhe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as She}from"node:os";var whe,xhe,hH,$he,khe,Ehe,v3e,gH=y(()=>{mH();whe=()=>{let t=OT();return Object.fromEntries(t.map(xhe))},xhe=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],hH=whe(),$he=()=>{let t=OT(),e=65,r=Array.from({length:e},(n,i)=>khe(i,t));return Object.assign({},...r)},khe=(t,e)=>{let r=Ehe(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},Ehe=(t,e)=>{let r=e.find(({name:n})=>She.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},v3e=$he()});import{constants as Bd}from"node:os";var _H,bH,vH,Ahe,The,yH,Ohe,IT,Ihe,Phe,Ry,Hd=y(()=>{gH();_H=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return vH(t,e)},bH=t=>t===0?t:vH(t,"`subprocess.kill()`'s argument"),vH=(t,e)=>{if(Number.isInteger(t))return Ahe(t,e);if(typeof t=="string")return Ohe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${IT()}`)},Ahe=(t,e)=>{if(yH.has(t))return yH.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${IT()}`)},The=()=>new Map(Object.entries(Bd.signals).reverse().map(([t,e])=>[e,t])),yH=The(),Ohe=(t,e)=>{if(t in Bd.signals)return t;throw t.toUpperCase()in Bd.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${IT()}`)},IT=()=>`Available signal names: ${Ihe()}. +Available signal numbers: ${Phe()}.`,Ihe=()=>Object.keys(Bd.signals).sort().map(t=>`'${t}'`).join(", "),Phe=()=>[...new Set(Object.values(Bd.signals).sort((t,e)=>t-e))].join(", "),Ry=t=>hH[t].description});import{setTimeout as Rhe}from"node:timers/promises";var SH,Che,wH,Dhe,Nhe,jhe,PT,Cy=y(()=>{Xs();Hd();SH=t=>{if(t===!1)return t;if(t===!0)return Che;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},Che=1e3*5,wH=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Dhe(s,a,r);Nhe(l,n);let u=t(c);return jhe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Dhe=(t,e,r)=>{let[n=r,i]=Py(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!Py(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:bH(n),error:i}},Nhe=(t,e)=>{t!==void 0&&e.reject(t)},jhe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&PT({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},PT=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Rhe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Mhe}from"node:events";var Dy,RT=y(()=>{Dy=async(t,e)=>{t.aborted||await Mhe(t,"abort",{signal:e})}});var xH,$H,Fhe,CT=y(()=>{RT();xH=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},$H=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Fhe(t,e,n,i)],Fhe=async(t,e,r,{signal:n})=>{throw await Dy(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Ic,zhe,DT,kH,EH,Ny,AH,TH,OH,IH,PH,RH,Lhe,Uhe,qhe,qn,Bhe,Uo,Pc,Rc=y(()=>{Ic=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{zhe(t,e,r),DT(t,e,n)},zhe=(t,e,r)=>{if(!r)throw new Error(`${qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},DT=(t,e,r)=>{if(!r)throw new Error(`${qn(t,e)} cannot be used: the ${Uo(e)} has already exited or disconnected.`)},kH=t=>{throw new Error(`${qn("getOneMessage",t)} could not complete: the ${Uo(t)} exited or disconnected.`)},EH=t=>{throw new Error(`${qn("sendMessage",t)} failed: the ${Uo(t)} is sending a message too, instead of listening to incoming messages. This can be fixed by both sending a message and listening to incoming messages at the same time: const [receivedMessage] = await Promise.all([ ${qn("getOneMessage",t)}, ${qn("sendMessage",t,"message, {strict: true}")}, -]);`)},Cy=(t,e)=>new Error(`${qn("sendMessage",e)} failed when sending an acknowledgment response to the ${Uo(e)}.`,{cause:t}),AH=t=>{throw new Error(`${qn("sendMessage",t)} failed: the ${Uo(t)} is not listening to incoming messages.`)},TH=t=>{throw new Error(`${qn("sendMessage",t)} failed: the ${Uo(t)} exited without listening to incoming messages.`)},OH=()=>new Error(`\`cancelSignal\` aborted: the ${Uo(!0)} disconnected.`),IH=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},PH=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${qn(e,r)} cannot be used: the ${Uo(r)} is disconnecting.`,{cause:t})},RH=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Lhe(t))throw new Error(`${qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Lhe=({code:t,message:e})=>Uhe.has(t)||qhe.some(r=>e.includes(r)),Uhe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),qhe=["could not be cloned","circular structure","call stack size exceeded"],qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Bhe(e)}${t}(${r})`,Bhe=t=>t?"":"subprocess.",Uo=t=>t?"parent process":"subprocess",Oc=t=>{t.connected&&t.disconnect()}});var hi,Pc=y(()=>{hi=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var Ny,Rc,gi,CH,Hhe,Zhe,DH,Ghe,NH,Hd,Dy,qo=y(()=>{eo();Ny=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=gi.get(t),o=CH(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(DH(o,e,n,!0));return s},Rc=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=gi.get(t),o=CH(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(DH(o,e,n,!1));return s},gi=new WeakMap,CH=(t,e,r)=>{let n=Hhe(e,r);return Zhe(n,e,r,t),n},Hhe=(t,e)=>{let r=dT(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Hd(e)}" must not be "${t}". +]);`)},Ny=(t,e)=>new Error(`${qn("sendMessage",e)} failed when sending an acknowledgment response to the ${Uo(e)}.`,{cause:t}),AH=t=>{throw new Error(`${qn("sendMessage",t)} failed: the ${Uo(t)} is not listening to incoming messages.`)},TH=t=>{throw new Error(`${qn("sendMessage",t)} failed: the ${Uo(t)} exited without listening to incoming messages.`)},OH=()=>new Error(`\`cancelSignal\` aborted: the ${Uo(!0)} disconnected.`),IH=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},PH=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${qn(e,r)} cannot be used: the ${Uo(r)} is disconnecting.`,{cause:t})},RH=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Lhe(t))throw new Error(`${qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Lhe=({code:t,message:e})=>Uhe.has(t)||qhe.some(r=>e.includes(r)),Uhe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),qhe=["could not be cloned","circular structure","call stack size exceeded"],qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Bhe(e)}${t}(${r})`,Bhe=t=>t?"":"subprocess.",Uo=t=>t?"parent process":"subprocess",Pc=t=>{t.connected&&t.disconnect()}});var hi,Cc=y(()=>{hi=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var My,Dc,gi,CH,Hhe,Zhe,DH,Ghe,NH,Zd,jy,qo=y(()=>{eo();My=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=gi.get(t),o=CH(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(DH(o,e,n,!0));return s},Dc=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=gi.get(t),o=CH(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(DH(o,e,n,!1));return s},gi=new WeakMap,CH=(t,e,r)=>{let n=Hhe(e,r);return Zhe(n,e,r,t),n},Hhe=(t,e)=>{let r=pT(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Zd(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},Zhe=(t,e,r,n)=>{let i=n[NH(t)];if(i===void 0)throw new TypeError(`"${Hd(r)}" must not be ${e}. That file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${Hd(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Hd(r)}" must not be ${e}. It must be a writable stream, not readable.`)},DH=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=Ghe(t,r);return`The "${i}: ${Dy(o)}" option is incompatible with using "${Hd(n)}: ${Dy(e)}". -Please set this option with "pipe" instead.`},Ghe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=NH(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},NH=t=>t==="all"?1:t,Hd=t=>t?"to":"from",Dy=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Vhe}from"node:events";var Xs,jy=y(()=>{Xs=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Vhe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var My,CT,Fy,DT,jH,MH,Zd=y(()=>{My=(t,e)=>{e&&CT(t)},CT=t=>{t.refCounted()},Fy=(t,e)=>{e&&DT(t)},DT=t=>{t.unrefCounted()},jH=(t,e)=>{e&&(DT(t),DT(t))},MH=(t,e)=>{e&&(CT(t),CT(t))}});import{once as Whe}from"node:events";import{scheduler as Khe}from"node:timers/promises";var FH,zH,zy,LH=y(()=>{Uy();Zd();Ly();qy();FH=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(qH(i)||HH(i))return;zy.has(t)||zy.set(t,[]);let o=zy.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await BH(t,n,i),await Khe.yield();let s=await UH({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},zH=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{NT();let o=zy.get(t);for(;o?.length>0;)await Whe(n,"message:done");t.removeListener("message",i),MH(e,r),n.connected=!1,n.emit("disconnect")},zy=new WeakMap});import{EventEmitter as Jhe}from"node:events";var Bo,By,Yhe,Hy,Gd=y(()=>{LH();Zd();Bo=(t,e,r)=>{if(By.has(t))return By.get(t);let n=new Jhe;return n.connected=!0,By.set(t,n),Yhe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},By=new WeakMap,Yhe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=FH.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",zH.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),jH(r,n)},Hy=t=>{let e=By.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Xhe}from"node:events";var ZH,Qhe,GH,UH,qH,VH,Zy,ege,Gy,WH,Ly=y(()=>{Pc();jy();Ky();Ic();Gd();Uy();ZH=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=Bo(t,e,r),s=Vy(t,o);return{id:Qhe++,type:Gy,message:n,hasListeners:s}},Qhe=0n,GH=(t,e)=>{if(!(e?.type!==Gy||e.hasListeners))for(let{id:r}of t)r!==void 0&&Zy[r].resolve({isDeadlock:!0,hasListeners:!1})},UH=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Gy||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:WH,message:Vy(e,i)};try{await Wy({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},qH=t=>{if(t?.type!==WH)return!1;let{id:e,message:r}=t;return Zy[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},VH=async(t,e,r)=>{if(t?.type!==Gy)return;let n=hi();Zy[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,ege(e,r,i)]);o&&EH(r),s||AH(r)}finally{i.abort(),delete Zy[t.id]}},Zy={},ege=async(t,e,{signal:r})=>{Xs(t,1,r),await Xhe(t,"disconnect",{signal:r}),TH(e)},Gy="execa:ipc:request",WH="execa:ipc:response"});var KH,JH,BH,Vd,Vy,tge,Uy=y(()=>{Pc();eo();qo();Ly();KH=(t,e,r)=>{Vd.has(t)||Vd.set(t,new Set);let n=Vd.get(t),i=hi(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},JH=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},BH=async(t,e,r)=>{for(;!Vy(t,e)&&Vd.get(t)?.size>0;){let n=[...Vd.get(t)];GH(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Vd=new WeakMap,Vy=(t,e)=>e.listenerCount("message")>tge(t),tge=t=>gi.has(t)&&!Qi(gi.get(t).options.buffer,"ipc")?1:0});import{promisify as rge}from"node:util";var Wy,nge,MT,ige,jT,Ky=y(()=>{Ic();Uy();Ly();Wy=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Tc({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),nge({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},nge=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=ZH({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=KH(t,s,o);try{await MT({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Oc(t),c}finally{JH(a)}},MT=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=ige(t);try{await Promise.all([VH(n,t,r),o(n)])}catch(s){throw PH({error:s,methodName:e,isSubprocess:r}),RH({error:s,methodName:e,isSubprocess:r,message:i}),s}},ige=t=>{if(jT.has(t))return jT.get(t);let e=rge(t.send.bind(t));return jT.set(t,e),e},jT=new WeakMap});import{scheduler as oge}from"node:timers/promises";var XH,QH,sge,YH,HH,eZ,NT,FT,qy=y(()=>{Ky();Gd();Ic();XH=(t,e)=>{let r="cancelSignal";return RT(r,!1,t.connected),MT({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:eZ,message:e},message:e})},QH=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await sge({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),FT.signal),sge=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!YH){if(YH=!0,!n){IH();return}if(e===null){NT();return}Bo(t,e,r),await oge.yield()}},YH=!1,HH=t=>t?.type!==eZ?!1:(FT.abort(t.message),!0),eZ="execa:ipc:cancel",NT=()=>{FT.abort(OH())},FT=new AbortController});var tZ,rZ,age,cge,zT=y(()=>{IT();qy();Py();tZ=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},rZ=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[age({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],age=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await Ry(e,i);let o=cge(e);throw await XH(t,o),OT({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},cge=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as lge}from"node:timers/promises";var nZ,iZ,uge,LT=y(()=>{Ys();nZ=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},iZ=(t,e,r,n)=>e===0||e===void 0?[]:[uge(t,e,r,n)],uge=async(t,e,r,{signal:n})=>{throw await lge(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Un}});import{execPath as dge,execArgv as fge}from"node:process";import oZ from"node:path";var sZ,aZ,UT=y(()=>{wc();sZ=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},aZ=(t,e,{node:r=!1,nodePath:n=dge,nodeOptions:i=fge.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=Sc(n,'The "nodePath" option'),l=oZ.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(oZ.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as pge}from"node:v8";var cZ,mge,hge,gge,lZ,qT=y(()=>{cZ=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");gge[r](t)}},mge=t=>{try{pge(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},hge=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},gge={advanced:mge,json:hge},lZ=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var dZ,yge,Wr,BT,_ge,uZ,Jy,Qs=y(()=>{dZ=({encoding:t})=>{if(BT.has(t))return;let e=_ge(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Jy(t)}\`. -Please rename it to ${Jy(e)}.`);let r=[...BT].map(n=>Jy(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Jy(t)}\`. -Please rename it to one of: ${r}.`)},yge=new Set(["utf8","utf16le"]),Wr=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),BT=new Set([...yge,...Wr]),_ge=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in uZ)return uZ[e];if(BT.has(e))return e},uZ={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Jy=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as bge}from"node:fs";import vge from"node:path";import Sge from"node:process";var fZ,pZ,mZ,HT=y(()=>{wc();fZ=(t=pZ())=>{let e=Sc(t,'The "cwd" option');return vge.resolve(e)},pZ=()=>{try{return Sge.cwd()}catch(t){throw t.message=`The current directory does not exist. +It is optional and defaults to "${i}".`)},Zhe=(t,e,r,n)=>{let i=n[NH(t)];if(i===void 0)throw new TypeError(`"${Zd(r)}" must not be ${e}. That file descriptor does not exist. +Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${Zd(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Zd(r)}" must not be ${e}. It must be a writable stream, not readable.`)},DH=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=Ghe(t,r);return`The "${i}: ${jy(o)}" option is incompatible with using "${Zd(n)}: ${jy(e)}". +Please set this option with "pipe" instead.`},Ghe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=NH(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},NH=t=>t==="all"?1:t,Zd=t=>t?"to":"from",jy=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Vhe}from"node:events";var Qs,Fy=y(()=>{Qs=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Vhe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var zy,NT,Ly,jT,jH,MH,Gd=y(()=>{zy=(t,e)=>{e&&NT(t)},NT=t=>{t.refCounted()},Ly=(t,e)=>{e&&jT(t)},jT=t=>{t.unrefCounted()},jH=(t,e)=>{e&&(jT(t),jT(t))},MH=(t,e)=>{e&&(NT(t),NT(t))}});import{once as Whe}from"node:events";import{scheduler as Khe}from"node:timers/promises";var FH,zH,Uy,LH=y(()=>{By();Gd();qy();Hy();FH=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(qH(i)||HH(i))return;Uy.has(t)||Uy.set(t,[]);let o=Uy.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await BH(t,n,i),await Khe.yield();let s=await UH({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},zH=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{MT();let o=Uy.get(t);for(;o?.length>0;)await Whe(n,"message:done");t.removeListener("message",i),MH(e,r),n.connected=!1,n.emit("disconnect")},Uy=new WeakMap});import{EventEmitter as Jhe}from"node:events";var Bo,Zy,Yhe,Gy,Vd=y(()=>{LH();Gd();Bo=(t,e,r)=>{if(Zy.has(t))return Zy.get(t);let n=new Jhe;return n.connected=!0,Zy.set(t,n),Yhe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Zy=new WeakMap,Yhe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=FH.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",zH.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),jH(r,n)},Gy=t=>{let e=Zy.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Xhe}from"node:events";var ZH,Qhe,GH,UH,qH,VH,Vy,ege,Wy,WH,qy=y(()=>{Cc();Fy();Yy();Rc();Vd();By();ZH=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=Bo(t,e,r),s=Ky(t,o);return{id:Qhe++,type:Wy,message:n,hasListeners:s}},Qhe=0n,GH=(t,e)=>{if(!(e?.type!==Wy||e.hasListeners))for(let{id:r}of t)r!==void 0&&Vy[r].resolve({isDeadlock:!0,hasListeners:!1})},UH=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Wy||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:WH,message:Ky(e,i)};try{await Jy({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},qH=t=>{if(t?.type!==WH)return!1;let{id:e,message:r}=t;return Vy[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},VH=async(t,e,r)=>{if(t?.type!==Wy)return;let n=hi();Vy[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,ege(e,r,i)]);o&&EH(r),s||AH(r)}finally{i.abort(),delete Vy[t.id]}},Vy={},ege=async(t,e,{signal:r})=>{Qs(t,1,r),await Xhe(t,"disconnect",{signal:r}),TH(e)},Wy="execa:ipc:request",WH="execa:ipc:response"});var KH,JH,BH,Wd,Ky,tge,By=y(()=>{Cc();eo();qo();qy();KH=(t,e,r)=>{Wd.has(t)||Wd.set(t,new Set);let n=Wd.get(t),i=hi(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},JH=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},BH=async(t,e,r)=>{for(;!Ky(t,e)&&Wd.get(t)?.size>0;){let n=[...Wd.get(t)];GH(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Wd=new WeakMap,Ky=(t,e)=>e.listenerCount("message")>tge(t),tge=t=>gi.has(t)&&!Qi(gi.get(t).options.buffer,"ipc")?1:0});import{promisify as rge}from"node:util";var Jy,nge,zT,ige,FT,Yy=y(()=>{Rc();By();qy();Jy=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Ic({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),nge({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},nge=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=ZH({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=KH(t,s,o);try{await zT({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Pc(t),c}finally{JH(a)}},zT=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=ige(t);try{await Promise.all([VH(n,t,r),o(n)])}catch(s){throw PH({error:s,methodName:e,isSubprocess:r}),RH({error:s,methodName:e,isSubprocess:r,message:i}),s}},ige=t=>{if(FT.has(t))return FT.get(t);let e=rge(t.send.bind(t));return FT.set(t,e),e},FT=new WeakMap});import{scheduler as oge}from"node:timers/promises";var XH,QH,sge,YH,HH,eZ,MT,LT,Hy=y(()=>{Yy();Vd();Rc();XH=(t,e)=>{let r="cancelSignal";return DT(r,!1,t.connected),zT({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:eZ,message:e},message:e})},QH=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await sge({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),LT.signal),sge=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!YH){if(YH=!0,!n){IH();return}if(e===null){MT();return}Bo(t,e,r),await oge.yield()}},YH=!1,HH=t=>t?.type!==eZ?!1:(LT.abort(t.message),!0),eZ="execa:ipc:cancel",MT=()=>{LT.abort(OH())},LT=new AbortController});var tZ,rZ,age,cge,UT=y(()=>{RT();Hy();Cy();tZ=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},rZ=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[age({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],age=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await Dy(e,i);let o=cge(e);throw await XH(t,o),PT({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},cge=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as lge}from"node:timers/promises";var nZ,iZ,uge,qT=y(()=>{Xs();nZ=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},iZ=(t,e,r,n)=>e===0||e===void 0?[]:[uge(t,e,r,n)],uge=async(t,e,r,{signal:n})=>{throw await lge(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Un}});import{execPath as dge,execArgv as fge}from"node:process";import oZ from"node:path";var sZ,aZ,BT=y(()=>{$c();sZ=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},aZ=(t,e,{node:r=!1,nodePath:n=dge,nodeOptions:i=fge.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=xc(n,'The "nodePath" option'),l=oZ.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(oZ.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as pge}from"node:v8";var cZ,mge,hge,gge,lZ,HT=y(()=>{cZ=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");gge[r](t)}},mge=t=>{try{pge(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},hge=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},gge={advanced:mge,json:hge},lZ=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var dZ,yge,Wr,ZT,_ge,uZ,Xy,ea=y(()=>{dZ=({encoding:t})=>{if(ZT.has(t))return;let e=_ge(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Xy(t)}\`. +Please rename it to ${Xy(e)}.`);let r=[...ZT].map(n=>Xy(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Xy(t)}\`. +Please rename it to one of: ${r}.`)},yge=new Set(["utf8","utf16le"]),Wr=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),ZT=new Set([...yge,...Wr]),_ge=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in uZ)return uZ[e];if(ZT.has(e))return e},uZ={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Xy=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as bge}from"node:fs";import vge from"node:path";import Sge from"node:process";var fZ,pZ,mZ,GT=y(()=>{$c();fZ=(t=pZ())=>{let e=xc(t,'The "cwd" option');return vge.resolve(e)},pZ=()=>{try{return Sge.cwd()}catch(t){throw t.message=`The current directory does not exist. ${t.message}`,t}},mZ=(t,e)=>{if(e===pZ())return t;let r;try{r=bge(e)}catch(n){return`The "cwd" option is invalid: ${e}. ${n.message} ${t}`}return r.isDirectory()?t:`The "cwd" option is not a directory: ${e}. -${t}`}});import wge from"node:path";import hZ from"node:process";var gZ,Yy,xge,$ge,ZT=y(()=>{gZ=kt(JB(),1);nH();Py();Bd();PT();zT();LT();UT();qT();Qs();HT();wc();eo();Yy=(t,e,r)=>{r.cwd=fZ(r.cwd);let[n,i,o]=aZ(t,e,r),{command:s,args:a,options:c}=gZ.default._parse(n,i,o),l=z6(c),u=xge(l);return nZ(u),dZ(u),cZ(u),xH(u),tZ(u),u.shell=sT(u.shell),u.env=$ge(u),u.killSignal=_H(u.killSignal),u.forceKillAfterDelay=SH(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!Wr.has(u.encoding)&&u.buffer[f]),hZ.platform==="win32"&&wge.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},xge=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),$ge=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...hZ.env,...t}:t;return r||n?rH({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Xy,GT=y(()=>{Xy=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Cc(t){if(typeof t=="string")return kge(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Ege(t)}var kge,Ege,yZ,Age,_Z,Tge,VT=y(()=>{kge=t=>t.at(-1)===yZ?t.slice(0,t.at(-2)===_Z?-2:-1):t,Ege=t=>t.at(-1)===Age?t.subarray(0,t.at(-2)===Tge?-2:-1):t,yZ=` -`,Age=yZ.codePointAt(0),_Z="\r",Tge=_Z.codePointAt(0)});function Bn(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function WT(t,{checkOpen:e=!0}={}){return Bn(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function ea(t,{checkOpen:e=!0}={}){return Bn(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function KT(t,e){return WT(t,e)&&ea(t,e)}var ta=y(()=>{});function bZ(){return this[YT].next()}function vZ(t){return this[YT].return(t)}function XT({preventCancel:t=!1}={}){let e=this.getReader(),r=new JT(e,t),n=Object.create(Ige);return n[YT]=r,n}var Oge,JT,YT,Ige,SZ=y(()=>{Oge=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),JT=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},YT=Symbol();Object.defineProperty(bZ,"name",{value:"next"});Object.defineProperty(vZ,"name",{value:"return"});Ige=Object.create(Oge,{next:{enumerable:!0,configurable:!0,writable:!0,value:bZ},return:{enumerable:!0,configurable:!0,writable:!0,value:vZ}})});var wZ=y(()=>{});var xZ=y(()=>{SZ();wZ()});var $Z,Pge,Rge,Cge,Wd,QT=y(()=>{ta();xZ();$Z=t=>{if(ea(t,{checkOpen:!1})&&Wd.on!==void 0)return Rge(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Pge.call(t)==="[object ReadableStream]")return XT.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Pge}=Object.prototype,Rge=async function*(t){let e=new AbortController,r={};Cge(t,e,r);try{for await(let[n]of Wd.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},Cge=async(t,e,r)=>{try{await Wd.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Wd={}});var Dc,Dge,AZ,kZ,Nge,EZ,yi,Kd=y(()=>{QT();Dc=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=$Z(t),u=e();u.length=0;try{for await(let d of l){let f=Nge(d),p=r[f](d,u);AZ({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Dge({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},Dge=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&AZ({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},AZ=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){kZ(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&kZ(c,e,i,o),new yi},kZ=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Nge=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=EZ.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&EZ.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:EZ}=Object.prototype,yi=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var to,Jd,Qy,e_,t_,r_=y(()=>{to=t=>t,Jd=()=>{},Qy=({contents:t})=>t,e_=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},t_=t=>t.length});async function n_(t,e){return Dc(t,zge,e)}var jge,Mge,Fge,zge,TZ=y(()=>{Kd();r_();jge=()=>({contents:[]}),Mge=()=>1,Fge=(t,{contents:e})=>(e.push(t),e),zge={init:jge,convertChunk:{string:to,buffer:to,arrayBuffer:to,dataView:to,typedArray:to,others:to},getSize:Mge,truncateChunk:Jd,addChunk:Fge,getFinalChunk:Jd,finalize:Qy}});async function i_(t,e){return Dc(t,Wge,e)}var Lge,Uge,qge,OZ,IZ,Bge,Hge,Zge,Gge,RZ,PZ,Vge,CZ,Wge,DZ=y(()=>{Kd();r_();Lge=()=>({contents:new ArrayBuffer(0)}),Uge=t=>qge.encode(t),qge=new TextEncoder,OZ=t=>new Uint8Array(t),IZ=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Bge=(t,e)=>t.slice(0,e),Hge=(t,{contents:e,length:r},n)=>{let i=CZ()?Gge(e,n):Zge(e,n);return new Uint8Array(i).set(t,r),i},Zge=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(RZ(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Gge=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:RZ(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},RZ=t=>PZ**Math.ceil(Math.log(t)/Math.log(PZ)),PZ=2,Vge=({contents:t,length:e})=>CZ()?t:t.slice(0,e),CZ=()=>"resize"in ArrayBuffer.prototype,Wge={init:Lge,convertChunk:{string:Uge,buffer:OZ,arrayBuffer:OZ,dataView:IZ,typedArray:IZ,others:e_},getSize:t_,truncateChunk:Bge,addChunk:Hge,getFinalChunk:Jd,finalize:Vge}});async function s_(t,e){return Dc(t,Qge,e)}var Kge,o_,Jge,Yge,Xge,Qge,NZ=y(()=>{Kd();r_();Kge=()=>({contents:"",textDecoder:new TextDecoder}),o_=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Jge=(t,{contents:e})=>e+t,Yge=(t,e)=>t.slice(0,e),Xge=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Qge={init:Kge,convertChunk:{string:to,buffer:o_,arrayBuffer:o_,dataView:o_,typedArray:o_,others:e_},getSize:t_,truncateChunk:Yge,addChunk:Jge,getFinalChunk:Xge,finalize:Qy}});var jZ=y(()=>{TZ();DZ();NZ();Kd()});import{on as eye}from"node:events";import{finished as tye}from"node:stream/promises";var a_=y(()=>{QT();jZ();Object.assign(Wd,{on:eye,finished:tye})});var MZ,rye,FZ,zZ,nye,LZ,UZ,c_,ra=y(()=>{a_();Xi();eo();MZ=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof yi))throw t;if(o==="all")return t;let s=rye(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},rye=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",FZ=(t,e,r)=>{if(e.length!==r)return;let n=new yi;throw n.maxBufferInfo={fdNumber:"ipc"},n},zZ=(t,e)=>{let{streamName:r,threshold:n,unit:i}=nye(t,e);return`Command's ${r} was larger than ${n} ${i}`},nye=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=Qi(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:my(r),threshold:i,unit:n}},LZ=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>c_(r)),UZ=(t,e,r)=>{if(!e)return t;let n=c_(r);return t.length>n?t.slice(0,n):t},c_=([,t])=>t});import{inspect as iye}from"node:util";var BZ,oye,sye,aye,cye,lye,qZ,HZ=y(()=>{VT();Vr();HT();yy();ra();Bd();Ys();BZ=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=oye({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=aye(n,b),w=x===void 0?"":` +${t}`}});import wge from"node:path";import hZ from"node:process";var gZ,Qy,xge,$ge,VT=y(()=>{gZ=kt(JB(),1);nH();Cy();Hd();CT();UT();qT();BT();HT();ea();GT();$c();eo();Qy=(t,e,r)=>{r.cwd=fZ(r.cwd);let[n,i,o]=aZ(t,e,r),{command:s,args:a,options:c}=gZ.default._parse(n,i,o),l=z6(c),u=xge(l);return nZ(u),dZ(u),cZ(u),xH(u),tZ(u),u.shell=cT(u.shell),u.env=$ge(u),u.killSignal=_H(u.killSignal),u.forceKillAfterDelay=SH(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!Wr.has(u.encoding)&&u.buffer[f]),hZ.platform==="win32"&&wge.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},xge=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),$ge=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...hZ.env,...t}:t;return r||n?rH({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var e_,WT=y(()=>{e_=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Nc(t){if(typeof t=="string")return kge(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Ege(t)}var kge,Ege,yZ,Age,_Z,Tge,KT=y(()=>{kge=t=>t.at(-1)===yZ?t.slice(0,t.at(-2)===_Z?-2:-1):t,Ege=t=>t.at(-1)===Age?t.subarray(0,t.at(-2)===Tge?-2:-1):t,yZ=` +`,Age=yZ.codePointAt(0),_Z="\r",Tge=_Z.codePointAt(0)});function Bn(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function JT(t,{checkOpen:e=!0}={}){return Bn(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function ta(t,{checkOpen:e=!0}={}){return Bn(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function YT(t,e){return JT(t,e)&&ta(t,e)}var ra=y(()=>{});function bZ(){return this[QT].next()}function vZ(t){return this[QT].return(t)}function eO({preventCancel:t=!1}={}){let e=this.getReader(),r=new XT(e,t),n=Object.create(Ige);return n[QT]=r,n}var Oge,XT,QT,Ige,SZ=y(()=>{Oge=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),XT=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},QT=Symbol();Object.defineProperty(bZ,"name",{value:"next"});Object.defineProperty(vZ,"name",{value:"return"});Ige=Object.create(Oge,{next:{enumerable:!0,configurable:!0,writable:!0,value:bZ},return:{enumerable:!0,configurable:!0,writable:!0,value:vZ}})});var wZ=y(()=>{});var xZ=y(()=>{SZ();wZ()});var $Z,Pge,Rge,Cge,Kd,tO=y(()=>{ra();xZ();$Z=t=>{if(ta(t,{checkOpen:!1})&&Kd.on!==void 0)return Rge(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Pge.call(t)==="[object ReadableStream]")return eO.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Pge}=Object.prototype,Rge=async function*(t){let e=new AbortController,r={};Cge(t,e,r);try{for await(let[n]of Kd.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},Cge=async(t,e,r)=>{try{await Kd.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Kd={}});var jc,Dge,AZ,kZ,Nge,EZ,yi,Jd=y(()=>{tO();jc=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=$Z(t),u=e();u.length=0;try{for await(let d of l){let f=Nge(d),p=r[f](d,u);AZ({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Dge({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},Dge=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&AZ({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},AZ=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){kZ(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&kZ(c,e,i,o),new yi},kZ=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Nge=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=EZ.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&EZ.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:EZ}=Object.prototype,yi=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var to,Yd,t_,r_,n_,i_=y(()=>{to=t=>t,Yd=()=>{},t_=({contents:t})=>t,r_=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},n_=t=>t.length});async function o_(t,e){return jc(t,zge,e)}var jge,Mge,Fge,zge,TZ=y(()=>{Jd();i_();jge=()=>({contents:[]}),Mge=()=>1,Fge=(t,{contents:e})=>(e.push(t),e),zge={init:jge,convertChunk:{string:to,buffer:to,arrayBuffer:to,dataView:to,typedArray:to,others:to},getSize:Mge,truncateChunk:Yd,addChunk:Fge,getFinalChunk:Yd,finalize:t_}});async function s_(t,e){return jc(t,Wge,e)}var Lge,Uge,qge,OZ,IZ,Bge,Hge,Zge,Gge,RZ,PZ,Vge,CZ,Wge,DZ=y(()=>{Jd();i_();Lge=()=>({contents:new ArrayBuffer(0)}),Uge=t=>qge.encode(t),qge=new TextEncoder,OZ=t=>new Uint8Array(t),IZ=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Bge=(t,e)=>t.slice(0,e),Hge=(t,{contents:e,length:r},n)=>{let i=CZ()?Gge(e,n):Zge(e,n);return new Uint8Array(i).set(t,r),i},Zge=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(RZ(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Gge=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:RZ(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},RZ=t=>PZ**Math.ceil(Math.log(t)/Math.log(PZ)),PZ=2,Vge=({contents:t,length:e})=>CZ()?t:t.slice(0,e),CZ=()=>"resize"in ArrayBuffer.prototype,Wge={init:Lge,convertChunk:{string:Uge,buffer:OZ,arrayBuffer:OZ,dataView:IZ,typedArray:IZ,others:r_},getSize:n_,truncateChunk:Bge,addChunk:Hge,getFinalChunk:Yd,finalize:Vge}});async function c_(t,e){return jc(t,Qge,e)}var Kge,a_,Jge,Yge,Xge,Qge,NZ=y(()=>{Jd();i_();Kge=()=>({contents:"",textDecoder:new TextDecoder}),a_=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Jge=(t,{contents:e})=>e+t,Yge=(t,e)=>t.slice(0,e),Xge=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Qge={init:Kge,convertChunk:{string:to,buffer:a_,arrayBuffer:a_,dataView:a_,typedArray:a_,others:r_},getSize:n_,truncateChunk:Yge,addChunk:Jge,getFinalChunk:Xge,finalize:t_}});var jZ=y(()=>{TZ();DZ();NZ();Jd()});import{on as eye}from"node:events";import{finished as tye}from"node:stream/promises";var l_=y(()=>{tO();jZ();Object.assign(Kd,{on:eye,finished:tye})});var MZ,rye,FZ,zZ,nye,LZ,UZ,u_,na=y(()=>{l_();Xi();eo();MZ=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof yi))throw t;if(o==="all")return t;let s=rye(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},rye=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",FZ=(t,e,r)=>{if(e.length!==r)return;let n=new yi;throw n.maxBufferInfo={fdNumber:"ipc"},n},zZ=(t,e)=>{let{streamName:r,threshold:n,unit:i}=nye(t,e);return`Command's ${r} was larger than ${n} ${i}`},nye=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=Qi(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:gy(r),threshold:i,unit:n}},LZ=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>u_(r)),UZ=(t,e,r)=>{if(!e)return t;let n=u_(r);return t.length>n?t.slice(0,n):t},u_=([,t])=>t});import{inspect as iye}from"node:util";var BZ,oye,sye,aye,cye,lye,qZ,HZ=y(()=>{KT();Vr();GT();by();na();Hd();Xs();BZ=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=oye({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=aye(n,b),w=x===void 0?"":` ${x}`,R=`${S}: ${a}${w}`,A=e===void 0?[t[2],t[1]]:[e],E=[R,...A,...t.slice(3),r.map(C=>cye(C)).join(` -`)].map(C=>zd(Cc(lye(C)))).filter(Boolean).join(` +`)].map(C=>Ld(Nc(lye(C)))).filter(Boolean).join(` -`);return{originalMessage:x,shortMessage:R,message:E}},oye=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=sye(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${zZ(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${Iy(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},sye=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",aye=(t,e)=>{if(t instanceof Un)return;let r=sH(t)?t.originalMessage:String(t?.message??t),n=zd(mZ(r,e));return n===""?void 0:n},cye=t=>typeof t=="string"?t:iye(t),lye=t=>Array.isArray(t)?t.map(e=>Cc(qZ(e))).filter(Boolean).join(` -`):qZ(t),qZ=t=>typeof t=="string"?t:Ft(t)?fy(t):""});var l_,Nc,Yd,uye,ZZ,dye,Xd=y(()=>{Bd();xy();Ys();HZ();l_=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>ZZ({command:t,escapedCommand:e,cwd:o,durationMs:gT(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Nc=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Yd({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),Yd=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:R,signalDescription:A}=dye(l,u),{originalMessage:E,shortMessage:C,message:k}=BZ({stdio:d,all:f,ipcOutput:p,originalError:t,signal:R,signalDescription:A,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),L=iH(t,k,x);return Object.assign(L,uye({error:L,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:R,signalDescription:A,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:E,shortMessage:C})),L},uye=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>ZZ({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:gT(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),ZZ=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),dye=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:Iy(e);return{exitCode:r,signal:n,signalDescription:i}}});function fye(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(GZ(t*1e3)%1e3),nanoseconds:Math.trunc(GZ(t*1e6)%1e3)}}function pye(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function eO(t){switch(typeof t){case"number":{if(Number.isFinite(t))return fye(t);break}case"bigint":return pye(t)}throw new TypeError("Expected a finite number or bigint")}var GZ,VZ=y(()=>{GZ=t=>Number.isFinite(t)?t:0});function tO(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+gye);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&mye(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+hye(d,u):f;i.push(p)}},a=eO(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%yye):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var mye,hye,gye,yye,WZ=y(()=>{VZ();mye=t=>t===0||t===0n,hye=(t,e)=>e===1||e===1n?t:`${t}s`,gye=1e-7,yye=24n*60n*60n*1000n});var KZ,JZ=y(()=>{kc();KZ=(t,e)=>{t.failed&&mi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var YZ,_ye,XZ=y(()=>{WZ();Lo();kc();JZ();YZ=(t,e)=>{xc(e)&&(KZ(t,e),_ye(t,e))},_ye=(t,e)=>{let r=`(done in ${tO(t.durationMs)})`;mi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var jc,u_=y(()=>{XZ();jc=(t,e,{reject:r})=>{if(YZ(t,e),t.failed&&r)throw t;return t}});var tG,bye,vye,rG,nG,QZ,Sye,rO,eG,na,iG,wye,d_,oG,xye,$ye,nO,sG,kye,aG,f_,Eye,iO,Aye,Tye,cG,hn,p_,oO,lG,uG,Ho,hr=y(()=>{ta();Ji();Vr();tG=(t,e)=>na(t)?"asyncGenerator":iG(t)?"generator":d_(t)?"fileUrl":xye(t)?"filePath":Eye(t)?"webStream":Bn(t,{checkOpen:!1})?"native":Ft(t)?"uint8Array":Aye(t)?"asyncIterable":Tye(t)?"iterable":iO(t)?rG({transform:t},e):wye(t)?bye(t,e):"native",bye=(t,e)=>KT(t.transform,{checkOpen:!1})?vye(t,e):iO(t.transform)?rG(t,e):Sye(t,e),vye=(t,e)=>(nG(t,e,"Duplex stream"),"duplex"),rG=(t,e)=>(nG(t,e,"web TransformStream"),"webTransform"),nG=({final:t,binary:e,objectMode:r},n,i)=>{QZ(t,`${n}.final`,i),QZ(e,`${n}.binary`,i),rO(r,`${n}.objectMode`)},QZ=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Sye=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!eG(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(KT(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(iO(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!eG(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return rO(r,`${i}.binary`),rO(n,`${i}.objectMode`),na(t)||na(e)?"asyncGenerator":"generator"},rO=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},eG=t=>na(t)||iG(t),na=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",iG=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",wye=t=>Et(t)&&(t.transform!==void 0||t.final!==void 0),d_=t=>Object.prototype.toString.call(t)==="[object URL]",oG=t=>d_(t)&&t.protocol!=="file:",xye=t=>Et(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>$ye.has(e))&&nO(t.file),$ye=new Set(["file","append"]),nO=t=>typeof t=="string",sG=(t,e)=>t==="native"&&typeof e=="string"&&!kye.has(e),kye=new Set(["ipc","ignore","inherit","overlapped","pipe"]),aG=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",f_=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Eye=t=>aG(t)||f_(t),iO=t=>aG(t?.readable)&&f_(t?.writable),Aye=t=>cG(t)&&typeof t[Symbol.asyncIterator]=="function",Tye=t=>cG(t)&&typeof t[Symbol.iterator]=="function",cG=t=>typeof t=="object"&&t!==null,hn=new Set(["generator","asyncGenerator","duplex","webTransform"]),p_=new Set(["fileUrl","filePath","fileNumber"]),oO=new Set(["fileUrl","filePath"]),lG=new Set([...oO,"webStream","nodeStream"]),uG=new Set(["webTransform","duplex"]),Ho={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var sO,Oye,Iye,dG,aO=y(()=>{hr();sO=(t,e,r,n)=>n==="output"?Oye(t,e,r):Iye(t,e,r),Oye=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Iye=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},dG=(t,e)=>{let r=t.findLast(({type:n})=>hn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var fG,Pye,Rye,Cye,Dye,Nye,jye,pG=y(()=>{Ji();Qs();hr();aO();fG=(t,e,r,n)=>[...t.filter(({type:i})=>!hn.has(i)),...Pye(t,e,r,n)],Pye=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>hn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Rye({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return jye(o,r)},Rye=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Cye({stdioItem:t,optionName:i}):e==="webTransform"?Dye({stdioItem:t,index:r,newTransforms:n,direction:o}):Nye({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Cye=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},Dye=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Et(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=sO(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Nye=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Et(e)?e:{transform:e},d=c||Wr.has(o),{writableObjectMode:f,readableObjectMode:p}=sO(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},jye=(t,e)=>e==="input"?t.reverse():t});import cO from"node:process";var mG,Mye,Fye,Mc,lO,hG,zye,Lye,gG=y(()=>{ta();hr();mG=(t,e,r)=>{let n=t.map(i=>Mye(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??Lye},Mye=({type:t,value:e},r)=>Fye[r]??hG[t](e),Fye=["input","output","output"],Mc=()=>{},lO=()=>"input",hG={generator:Mc,asyncGenerator:Mc,fileUrl:Mc,filePath:Mc,iterable:lO,asyncIterable:lO,uint8Array:lO,webStream:t=>f_(t)?"output":"input",nodeStream(t){return ea(t,{checkOpen:!1})?WT(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Mc,duplex:Mc,native(t){let e=zye(t);if(e!==void 0)return e;if(Bn(t,{checkOpen:!1}))return hG.nodeStream(t)}},zye=t=>{if([0,cO.stdin].includes(t))return"input";if([1,2,cO.stdout,cO.stderr].includes(t))return"output"},Lye="output"});var yG,_G=y(()=>{yG=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var bG,Uye,qye,vG,Bye,Hye,SG=y(()=>{Xi();_G();Lo();bG=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Uye(t,n).map((a,c)=>vG(a,c));return o?Bye(s,r,i):yG(s,e)},Uye=(t,e)=>{if(t===void 0)return mn.map(n=>e[n]);if(qye(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${mn.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,mn.length);return Array.from({length:r},(n,i)=>t[i])},qye=t=>mn.some(e=>t[e]!==void 0),vG=(t,e)=>Array.isArray(t)?t.map(r=>vG(r,e)):t??(e>=mn.length?"ignore":"pipe"),Bye=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!$c(r,i)&&Hye(n)?"ignore":n),Hye=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Zye}from"node:fs";import Gye from"node:tty";var xG,Vye,Wye,Kye,Jye,wG,$G=y(()=>{ta();Xi();Vr();qo();xG=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Vye({stdioItem:t,fdNumber:n,direction:i}):Jye({stdioItem:t,fdNumber:n}),Vye=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Wye({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(Bn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Wye=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Kye(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Gye.isatty(i))throw new TypeError(`The \`${e}: ${Dy(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Yi(Zye(i)),optionName:e}}},Kye=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=py.indexOf(t);if(r!==-1)return r},Jye=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:wG(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:wG(e,e,r),optionName:r}:Bn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,wG=(t,e,r)=>{let n=py[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var kG,Yye,Xye,Qye,e_e,EG=y(()=>{ta();Vr();hr();kG=({input:t,inputFile:e},r)=>r===0?[...Yye(t),...Qye(e)]:[],Yye=t=>t===void 0?[]:[{type:Xye(t),value:t,optionName:"input"}],Xye=t=>{if(ea(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ft(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Qye=t=>t===void 0?[]:[{...e_e(t),optionName:"inputFile"}],e_e=t=>{if(d_(t))return{type:"fileUrl",value:t};if(nO(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var AG,TG,t_e,r_e,OG,n_e,i_e,IG,PG=y(()=>{hr();AG=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),TG=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=t_e(i,t);if(s.length!==0){if(o){r_e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(lG.has(t))return OG({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});uG.has(t)&&i_e({otherStdioItems:s,type:t,value:e,optionName:r})}},t_e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),r_e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{oO.has(e)&&OG({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},OG=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>n_e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return IG(s,n,e),i==="output"?o[0].stream:void 0},n_e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,i_e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);IG(i,n,e)},IG=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${Ho[r]} that is the same.`)}});var m_,o_e,s_e,a_e,c_e,l_e,u_e,d_e,f_e,p_e,m_e,h_e,uO,g_e,h_=y(()=>{Xi();pG();aO();hr();gG();SG();$G();EG();PG();m_=(t,e,r,n)=>{let o=bG(e,r,n).map((a,c)=>o_e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=p_e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>g_e(a)),s},o_e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=my(e),{stdioItems:o,isStdioArray:s}=s_e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=mG(o,e,i),c=o.map(d=>xG({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=fG(c,i,a,r),u=dG(l,a);return f_e(l,u),{direction:a,objectMode:u,stdioItems:l}},s_e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>a_e(c,n)),...kG(r,e)],s=AG(o),a=s.length>1;return c_e(s,a,n),u_e(s),{stdioItems:s,isStdioArray:a}},a_e=(t,e)=>({type:tG(t,e),value:t,optionName:e}),c_e=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(l_e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},l_e=new Set(["ignore","ipc"]),u_e=t=>{for(let e of t)d_e(e)},d_e=({type:t,value:e,optionName:r})=>{if(oG(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. -For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(sG(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},f_e=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>p_.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},p_e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(m_e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw uO(i),o}},m_e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>h_e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},h_e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=TG({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},uO=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Ln(r)&&r.destroy()},g_e=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as RG}from"node:fs";var DG,_i,y_e,NG,CG,__e,jG=y(()=>{Vr();h_();hr();DG=(t,e)=>m_(__e,t,e,!0),_i=({type:t,optionName:e})=>{NG(e,Ho[t])},y_e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&NG(t,`"${e}"`),{}),NG=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},CG={generator(){},asyncGenerator:_i,webStream:_i,nodeStream:_i,webTransform:_i,duplex:_i,asyncIterable:_i,native:y_e},__e={input:{...CG,fileUrl:({value:t})=>({contents:[Yi(RG(t))]}),filePath:({value:{file:t}})=>({contents:[Yi(RG(t))]}),fileNumber:_i,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...CG,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:_i,string:_i,uint8Array:_i}}});var ro,dO,Qd=y(()=>{VT();ro=(t,{stripFinalNewline:e},r)=>dO(e,r)&&t!==void 0&&!Array.isArray(t)?Cc(t):t,dO=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var g_,pO,MG,FG,b_e,v_e,S_e,zG,w_e,fO,x_e,$_e,k_e,y_=y(()=>{g_=(t,e,r,n)=>t||r?void 0:FG(e,n),pO=(t,e,r)=>r?t.flatMap(n=>MG(n,e)):MG(t,e),MG=(t,e)=>{let{transform:r,final:n}=FG(e,{});return[...r(t),...n()]},FG=(t,e)=>(e.previousChunks="",{transform:b_e.bind(void 0,e,t),final:S_e.bind(void 0,e)}),b_e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=fO(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=fO(n,r.slice(i+1))),t.previousChunks=n},v_e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),S_e=function*({previousChunks:t}){t.length>0&&(yield t)},zG=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:w_e.bind(void 0,n)},w_e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?x_e:k_e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},fO=(t,e)=>`${t}${e}`,x_e={windowsNewline:`\r +`);return{originalMessage:x,shortMessage:R,message:E}},oye=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=sye(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${zZ(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${Ry(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},sye=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",aye=(t,e)=>{if(t instanceof Un)return;let r=sH(t)?t.originalMessage:String(t?.message??t),n=Ld(mZ(r,e));return n===""?void 0:n},cye=t=>typeof t=="string"?t:iye(t),lye=t=>Array.isArray(t)?t.map(e=>Nc(qZ(e))).filter(Boolean).join(` +`):qZ(t),qZ=t=>typeof t=="string"?t:Ft(t)?my(t):""});var d_,Mc,Xd,uye,ZZ,dye,Qd=y(()=>{Hd();ky();Xs();HZ();d_=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>ZZ({command:t,escapedCommand:e,cwd:o,durationMs:_T(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Mc=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Xd({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),Xd=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:R,signalDescription:A}=dye(l,u),{originalMessage:E,shortMessage:C,message:k}=BZ({stdio:d,all:f,ipcOutput:p,originalError:t,signal:R,signalDescription:A,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),L=iH(t,k,x);return Object.assign(L,uye({error:L,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:R,signalDescription:A,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:E,shortMessage:C})),L},uye=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>ZZ({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:_T(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),ZZ=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),dye=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:Ry(e);return{exitCode:r,signal:n,signalDescription:i}}});function fye(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(GZ(t*1e3)%1e3),nanoseconds:Math.trunc(GZ(t*1e6)%1e3)}}function pye(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function rO(t){switch(typeof t){case"number":{if(Number.isFinite(t))return fye(t);break}case"bigint":return pye(t)}throw new TypeError("Expected a finite number or bigint")}var GZ,VZ=y(()=>{GZ=t=>Number.isFinite(t)?t:0});function nO(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+gye);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&mye(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+hye(d,u):f;i.push(p)}},a=rO(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%yye):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var mye,hye,gye,yye,WZ=y(()=>{VZ();mye=t=>t===0||t===0n,hye=(t,e)=>e===1||e===1n?t:`${t}s`,gye=1e-7,yye=24n*60n*60n*1000n});var KZ,JZ=y(()=>{Ac();KZ=(t,e)=>{t.failed&&mi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var YZ,_ye,XZ=y(()=>{WZ();Lo();Ac();JZ();YZ=(t,e)=>{kc(e)&&(KZ(t,e),_ye(t,e))},_ye=(t,e)=>{let r=`(done in ${nO(t.durationMs)})`;mi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Fc,f_=y(()=>{XZ();Fc=(t,e,{reject:r})=>{if(YZ(t,e),t.failed&&r)throw t;return t}});var tG,bye,vye,rG,nG,QZ,Sye,iO,eG,ia,iG,wye,p_,oG,xye,$ye,oO,sG,kye,aG,m_,Eye,sO,Aye,Tye,cG,gn,h_,aO,lG,uG,Ho,hr=y(()=>{ra();Ji();Vr();tG=(t,e)=>ia(t)?"asyncGenerator":iG(t)?"generator":p_(t)?"fileUrl":xye(t)?"filePath":Eye(t)?"webStream":Bn(t,{checkOpen:!1})?"native":Ft(t)?"uint8Array":Aye(t)?"asyncIterable":Tye(t)?"iterable":sO(t)?rG({transform:t},e):wye(t)?bye(t,e):"native",bye=(t,e)=>YT(t.transform,{checkOpen:!1})?vye(t,e):sO(t.transform)?rG(t,e):Sye(t,e),vye=(t,e)=>(nG(t,e,"Duplex stream"),"duplex"),rG=(t,e)=>(nG(t,e,"web TransformStream"),"webTransform"),nG=({final:t,binary:e,objectMode:r},n,i)=>{QZ(t,`${n}.final`,i),QZ(e,`${n}.binary`,i),iO(r,`${n}.objectMode`)},QZ=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Sye=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!eG(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(YT(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(sO(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!eG(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return iO(r,`${i}.binary`),iO(n,`${i}.objectMode`),ia(t)||ia(e)?"asyncGenerator":"generator"},iO=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},eG=t=>ia(t)||iG(t),ia=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",iG=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",wye=t=>Et(t)&&(t.transform!==void 0||t.final!==void 0),p_=t=>Object.prototype.toString.call(t)==="[object URL]",oG=t=>p_(t)&&t.protocol!=="file:",xye=t=>Et(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>$ye.has(e))&&oO(t.file),$ye=new Set(["file","append"]),oO=t=>typeof t=="string",sG=(t,e)=>t==="native"&&typeof e=="string"&&!kye.has(e),kye=new Set(["ipc","ignore","inherit","overlapped","pipe"]),aG=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",m_=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Eye=t=>aG(t)||m_(t),sO=t=>aG(t?.readable)&&m_(t?.writable),Aye=t=>cG(t)&&typeof t[Symbol.asyncIterator]=="function",Tye=t=>cG(t)&&typeof t[Symbol.iterator]=="function",cG=t=>typeof t=="object"&&t!==null,gn=new Set(["generator","asyncGenerator","duplex","webTransform"]),h_=new Set(["fileUrl","filePath","fileNumber"]),aO=new Set(["fileUrl","filePath"]),lG=new Set([...aO,"webStream","nodeStream"]),uG=new Set(["webTransform","duplex"]),Ho={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var cO,Oye,Iye,dG,lO=y(()=>{hr();cO=(t,e,r,n)=>n==="output"?Oye(t,e,r):Iye(t,e,r),Oye=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Iye=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},dG=(t,e)=>{let r=t.findLast(({type:n})=>gn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var fG,Pye,Rye,Cye,Dye,Nye,jye,pG=y(()=>{Ji();ea();hr();lO();fG=(t,e,r,n)=>[...t.filter(({type:i})=>!gn.has(i)),...Pye(t,e,r,n)],Pye=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>gn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Rye({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return jye(o,r)},Rye=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Cye({stdioItem:t,optionName:i}):e==="webTransform"?Dye({stdioItem:t,index:r,newTransforms:n,direction:o}):Nye({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Cye=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},Dye=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Et(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=cO(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Nye=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Et(e)?e:{transform:e},d=c||Wr.has(o),{writableObjectMode:f,readableObjectMode:p}=cO(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},jye=(t,e)=>e==="input"?t.reverse():t});import uO from"node:process";var mG,Mye,Fye,zc,dO,hG,zye,Lye,gG=y(()=>{ra();hr();mG=(t,e,r)=>{let n=t.map(i=>Mye(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??Lye},Mye=({type:t,value:e},r)=>Fye[r]??hG[t](e),Fye=["input","output","output"],zc=()=>{},dO=()=>"input",hG={generator:zc,asyncGenerator:zc,fileUrl:zc,filePath:zc,iterable:dO,asyncIterable:dO,uint8Array:dO,webStream:t=>m_(t)?"output":"input",nodeStream(t){return ta(t,{checkOpen:!1})?JT(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:zc,duplex:zc,native(t){let e=zye(t);if(e!==void 0)return e;if(Bn(t,{checkOpen:!1}))return hG.nodeStream(t)}},zye=t=>{if([0,uO.stdin].includes(t))return"input";if([1,2,uO.stdout,uO.stderr].includes(t))return"output"},Lye="output"});var yG,_G=y(()=>{yG=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var bG,Uye,qye,vG,Bye,Hye,SG=y(()=>{Xi();_G();Lo();bG=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Uye(t,n).map((a,c)=>vG(a,c));return o?Bye(s,r,i):yG(s,e)},Uye=(t,e)=>{if(t===void 0)return hn.map(n=>e[n]);if(qye(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${hn.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,hn.length);return Array.from({length:r},(n,i)=>t[i])},qye=t=>hn.some(e=>t[e]!==void 0),vG=(t,e)=>Array.isArray(t)?t.map(r=>vG(r,e)):t??(e>=hn.length?"ignore":"pipe"),Bye=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Ec(r,i)&&Hye(n)?"ignore":n),Hye=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Zye}from"node:fs";import Gye from"node:tty";var xG,Vye,Wye,Kye,Jye,wG,$G=y(()=>{ra();Xi();Vr();qo();xG=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Vye({stdioItem:t,fdNumber:n,direction:i}):Jye({stdioItem:t,fdNumber:n}),Vye=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Wye({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(Bn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Wye=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Kye(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Gye.isatty(i))throw new TypeError(`The \`${e}: ${jy(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Yi(Zye(i)),optionName:e}}},Kye=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=hy.indexOf(t);if(r!==-1)return r},Jye=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:wG(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:wG(e,e,r),optionName:r}:Bn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,wG=(t,e,r)=>{let n=hy[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var kG,Yye,Xye,Qye,e_e,EG=y(()=>{ra();Vr();hr();kG=({input:t,inputFile:e},r)=>r===0?[...Yye(t),...Qye(e)]:[],Yye=t=>t===void 0?[]:[{type:Xye(t),value:t,optionName:"input"}],Xye=t=>{if(ta(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ft(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Qye=t=>t===void 0?[]:[{...e_e(t),optionName:"inputFile"}],e_e=t=>{if(p_(t))return{type:"fileUrl",value:t};if(oO(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var AG,TG,t_e,r_e,OG,n_e,i_e,IG,PG=y(()=>{hr();AG=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),TG=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=t_e(i,t);if(s.length!==0){if(o){r_e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(lG.has(t))return OG({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});uG.has(t)&&i_e({otherStdioItems:s,type:t,value:e,optionName:r})}},t_e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),r_e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{aO.has(e)&&OG({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},OG=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>n_e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return IG(s,n,e),i==="output"?o[0].stream:void 0},n_e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,i_e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);IG(i,n,e)},IG=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${Ho[r]} that is the same.`)}});var g_,o_e,s_e,a_e,c_e,l_e,u_e,d_e,f_e,p_e,m_e,h_e,fO,g_e,y_=y(()=>{Xi();pG();lO();hr();gG();SG();$G();EG();PG();g_=(t,e,r,n)=>{let o=bG(e,r,n).map((a,c)=>o_e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=p_e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>g_e(a)),s},o_e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=gy(e),{stdioItems:o,isStdioArray:s}=s_e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=mG(o,e,i),c=o.map(d=>xG({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=fG(c,i,a,r),u=dG(l,a);return f_e(l,u),{direction:a,objectMode:u,stdioItems:l}},s_e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>a_e(c,n)),...kG(r,e)],s=AG(o),a=s.length>1;return c_e(s,a,n),u_e(s),{stdioItems:s,isStdioArray:a}},a_e=(t,e)=>({type:tG(t,e),value:t,optionName:e}),c_e=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(l_e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},l_e=new Set(["ignore","ipc"]),u_e=t=>{for(let e of t)d_e(e)},d_e=({type:t,value:e,optionName:r})=>{if(oG(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. +For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(sG(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},f_e=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>h_.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},p_e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(m_e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw fO(i),o}},m_e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>h_e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},h_e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=TG({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},fO=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Ln(r)&&r.destroy()},g_e=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as RG}from"node:fs";var DG,_i,y_e,NG,CG,__e,jG=y(()=>{Vr();y_();hr();DG=(t,e)=>g_(__e,t,e,!0),_i=({type:t,optionName:e})=>{NG(e,Ho[t])},y_e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&NG(t,`"${e}"`),{}),NG=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},CG={generator(){},asyncGenerator:_i,webStream:_i,nodeStream:_i,webTransform:_i,duplex:_i,asyncIterable:_i,native:y_e},__e={input:{...CG,fileUrl:({value:t})=>({contents:[Yi(RG(t))]}),filePath:({value:{file:t}})=>({contents:[Yi(RG(t))]}),fileNumber:_i,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...CG,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:_i,string:_i,uint8Array:_i}}});var ro,pO,ef=y(()=>{KT();ro=(t,{stripFinalNewline:e},r)=>pO(e,r)&&t!==void 0&&!Array.isArray(t)?Nc(t):t,pO=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var __,hO,MG,FG,b_e,v_e,S_e,zG,w_e,mO,x_e,$_e,k_e,b_=y(()=>{__=(t,e,r,n)=>t||r?void 0:FG(e,n),hO=(t,e,r)=>r?t.flatMap(n=>MG(n,e)):MG(t,e),MG=(t,e)=>{let{transform:r,final:n}=FG(e,{});return[...r(t),...n()]},FG=(t,e)=>(e.previousChunks="",{transform:b_e.bind(void 0,e,t),final:S_e.bind(void 0,e)}),b_e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=mO(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=mO(n,r.slice(i+1))),t.previousChunks=n},v_e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),S_e=function*({previousChunks:t}){t.length>0&&(yield t)},zG=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:w_e.bind(void 0,n)},w_e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?x_e:k_e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},mO=(t,e)=>`${t}${e}`,x_e={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:fO},$_e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},k_e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:$_e}});import{Buffer as E_e}from"node:buffer";var LG,A_e,UG,T_e,O_e,qG,BG=y(()=>{Vr();LG=(t,e)=>t?void 0:A_e.bind(void 0,e),A_e=function*(t,e){if(typeof e!="string"&&!Ft(e)&&!E_e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},UG=(t,e)=>t?T_e.bind(void 0,e):O_e.bind(void 0,e),T_e=function*(t,e){qG(t,e),yield e},O_e=function*(t,e){if(qG(t,e),typeof e!="string"&&!Ft(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},qG=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:mO},$_e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},k_e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:$_e}});import{Buffer as E_e}from"node:buffer";var LG,A_e,UG,T_e,O_e,qG,BG=y(()=>{Vr();LG=(t,e)=>t?void 0:A_e.bind(void 0,e),A_e=function*(t,e){if(typeof e!="string"&&!Ft(e)&&!E_e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},UG=(t,e)=>t?T_e.bind(void 0,e):O_e.bind(void 0,e),T_e=function*(t,e){qG(t,e),yield e},O_e=function*(t,e){if(qG(t,e),typeof e!="string"&&!Ft(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},qG=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. Instead, \`yield\` should either be called with a value, or not be called at all. For example: - if (condition) { yield value; }`)}});import{Buffer as I_e}from"node:buffer";import{StringDecoder as P_e}from"node:string_decoder";var __,R_e,C_e,D_e,mO=y(()=>{Vr();__=(t,e,r)=>{if(r)return;if(t)return{transform:R_e.bind(void 0,new TextEncoder)};let n=new P_e(e);return{transform:C_e.bind(void 0,n),final:D_e.bind(void 0,n)}},R_e=function*(t,e){I_e.isBuffer(e)?yield Yi(e):typeof e=="string"?yield t.encode(e):yield e},C_e=function*(t,e){yield Ft(e)?t.write(e):e},D_e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as HG}from"node:util";var hO,b_,ZG,N_e,GG,j_e,VG=y(()=>{hO=HG(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),b_=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=j_e}=e[r];for await(let i of n(t))yield*b_(i,e,r+1)},ZG=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*N_e(r,Number(e),t)},N_e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*b_(n,r,e+1)},GG=HG(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),j_e=function*(t){yield t}});var gO,WG,ia,ef,M_e,F_e,yO=y(()=>{gO=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},WG=(t,e)=>[...e.flatMap(r=>[...ia(r,t,0)]),...ef(t)],ia=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=F_e}=e[r];for(let i of n(t))yield*ia(i,e,r+1)},ef=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*M_e(r,Number(e),t)},M_e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*ia(n,r,e+1)},F_e=function*(t){yield t}});import{Transform as z_e,getDefaultHighWaterMark as KG}from"node:stream";var _O,v_,JG,S_=y(()=>{hr();y_();BG();mO();VG();yO();_O=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=JG(t,s,o),l=na(e),u=na(r),d=l?hO.bind(void 0,b_,a):gO.bind(void 0,ia),f=l||u?hO.bind(void 0,ZG,a):gO.bind(void 0,ef),p=l||u?GG.bind(void 0,a):void 0;return{stream:new z_e({writableObjectMode:n,writableHighWaterMark:KG(n),readableObjectMode:i,readableHighWaterMark:KG(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},v_=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=JG(s,r,a);t=WG(c,t)}return t},JG=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:LG(n,a)},__(r,s,n),g_(r,o,n,c),{transform:t,final:e},{transform:UG(i,a)},zG({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var YG,L_e,U_e,q_e,B_e,XG=y(()=>{S_();Vr();hr();YG=(t,e)=>{for(let r of L_e(t))U_e(t,r,e)},L_e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),U_e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ho[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>q_e(a,n));r.input=Fd(s)},q_e=(t,e)=>{let r=v_(t,e,"utf8",!0);return B_e(r),Fd(r)},B_e=t=>{let e=t.find(r=>typeof r!="string"&&!Ft(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var w_,H_e,Z_e,QG,e9,G_e,t9,bO=y(()=>{Qs();hr();kc();Lo();w_=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&$c(r,n)&&!Wr.has(e)&&H_e(n)&&(t.some(({type:i,value:o})=>i==="native"&&Z_e.has(o))||t.every(({type:i})=>hn.has(i))),H_e=t=>t===1||t===2,Z_e=new Set(["pipe","overlapped"]),QG=async(t,e,r,n)=>{for await(let i of t)G_e(e)||t9(i,r,n)},e9=(t,e,r)=>{for(let n of t)t9(n,e,r)},G_e=t=>t._readableState.pipes.length>0,t9=(t,e,r)=>{let n=Sy(t);mi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as V_e,appendFileSync as W_e}from"node:fs";var r9,K_e,J_e,Y_e,X_e,Q_e,n9=y(()=>{bO();S_();y_();Vr();hr();ra();r9=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>K_e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},K_e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=UZ(t,o,d),p=Yi(f),{stdioItems:m,objectMode:h}=e[r],g=J_e([p],m,c,n),{serializedResult:b,finalResult:_=b}=Y_e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});X_e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&Q_e(b,m,i),S}catch(x){return n.error=x,S}},J_e=(t,e,r,n)=>{try{return v_(t,e,r,!1)}catch(i){return n.error=i,t}},Y_e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Fd(t)};let s=P6(t,r);return n[o]?{serializedResult:s,finalResult:pO(s,!i[o],e)}:{serializedResult:s}},X_e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!w_({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=pO(t,!1,s);try{e9(a,e,n)}catch(c){r.error??=c}},Q_e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>p_.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?W_e(n,t):(r.add(o),V_e(n,t))}}});var i9,o9=y(()=>{Vr();Qd();i9=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ro(e,r,"all")]:Array.isArray(e)?[ro(t,r,"all"),...e]:Ft(t)&&Ft(e)?cT([t,e]):`${t}${e}`}});import{once as vO}from"node:events";var s9,ebe,a9,c9,tbe,SO,wO=y(()=>{Ys();s9=async(t,e)=>{let[r,n]=await ebe(t);return e.isForcefullyTerminated??=!1,[r,n]},ebe=async t=>{let[e,r]=await Promise.allSettled([vO(t,"spawn"),vO(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?a9(t):r.value},a9=async t=>{try{return await vO(t,"exit")}catch{return a9(t)}},c9=async t=>{let[e,r]=await t;if(!tbe(e,r)&&SO(e,r))throw new Un;return[e,r]},tbe=(t,e)=>t===void 0&&e===void 0,SO=(t,e)=>t!==0||e!==null});var l9,rbe,u9=y(()=>{Ys();ra();wO();l9=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=rbe(t,e,r),s=o?.code==="ETIMEDOUT",a=LZ(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},rbe=(t,e,r)=>t!==void 0?t:SO(e,r)?new Un:void 0});import{spawnSync as nbe}from"node:child_process";var d9,ibe,obe,sbe,x_,abe,cbe,lbe,ube,f9=y(()=>{yT();ZT();GT();Xd();u_();jG();Qd();XG();n9();ra();o9();u9();d9=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=ibe(t,e,r),d=abe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return jc(d,c,l)},ibe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=$y(t,e,r),a=obe(r),{file:c,commandArguments:l,options:u}=Yy(t,e,a);sbe(u);let d=DG(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},obe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,sbe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&x_("ipcInput"),t&&x_("ipc: true"),r&&x_("detached: true"),n&&x_("cancelSignal")},x_=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},abe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=cbe({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=l9(c,r),{output:m,error:h=l}=r9({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ro(_,r,S)),b=ro(i9(m,r),r,"all");return ube({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},cbe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{YG(o,r);let a=lbe(r);return nbe(...Xy(t,e,a))}catch(a){return Nc({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},lbe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:c_(e)}),ube=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?l_({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Yd({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as xO,on as dbe}from"node:events";var p9,fbe,pbe,mbe,hbe,m9=y(()=>{Ic();Gd();Zd();p9=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Tc({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Hy(t)}),fbe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),fbe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{My(e,i);let o=Bo(t,e,r),s=new AbortController;try{return await Promise.race([pbe(o,n,s),mbe(o,r,s),hbe(o,r,s)])}catch(a){throw Oc(t),a}finally{s.abort(),Fy(e,i)}},pbe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await xO(t,"message",{signal:r});return n}for await(let[n]of dbe(t,"message",{signal:r}))if(e(n))return n},mbe=async(t,e,{signal:r})=>{await xO(t,"disconnect",{signal:r}),kH(e)},hbe=async(t,e,{signal:r})=>{let[n]=await xO(t,"strict:error",{signal:r});throw Cy(n,e)}});import{once as g9,on as gbe}from"node:events";var y9,$O,ybe,_be,bbe,h9,kO=y(()=>{Ic();Gd();Zd();y9=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>$O({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),$O=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Tc({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Hy(t)}),My(e,o);let s=Bo(t,e,r),a=new AbortController,c={};return ybe(t,s,a),_be({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),bbe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},ybe=async(t,e,r)=>{try{await g9(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},_be=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await g9(t,"strict:error",{signal:r.signal});n.error=Cy(i,e),r.abort()}catch{}},bbe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of gbe(r,"message",{signal:o.signal}))h9(s),yield c}catch{h9(s)}finally{o.abort(),Fy(e,a),n||Oc(t),i&&await t}},h9=({error:t})=>{if(t)throw t}});import _9 from"node:process";var b9,v9,S9,EO=y(()=>{Ky();m9();kO();qy();b9=(t,{ipc:e})=>{Object.assign(t,S9(t,!1,e))},v9=()=>{let t=_9,e=!0,r=_9.channel!==void 0;return{...S9(t,e,r),getCancelSignal:QH.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},S9=(t,e,r)=>({sendMessage:Wy.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:p9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:y9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as vbe}from"node:child_process";import{PassThrough as Sbe,Readable as wbe,Writable as xbe,Duplex as $be}from"node:stream";var w9,kbe,tf,Ebe,Abe,Tbe,Obe,x9=y(()=>{h_();Xd();u_();w9=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{uO(n);let a=new vbe;kbe(a,n),Object.assign(a,{readable:Ebe,writable:Abe,duplex:Tbe});let c=Nc({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=Obe(c,s,i);return{subprocess:a,promise:l}},kbe=(t,e)=>{let r=tf(),n=tf(),i=tf(),o=Array.from({length:e.length-3},tf),s=tf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},tf=()=>{let t=new Sbe;return t.end(),t},Ebe=()=>new wbe({read(){}}),Abe=()=>new xbe({write(){}}),Tbe=()=>new $be({read(){},write(){}}),Obe=async(t,e,r)=>jc(t,e,r)});import{createReadStream as $9,createWriteStream as k9}from"node:fs";import{Buffer as Ibe}from"node:buffer";import{Readable as rf,Writable as Pbe,Duplex as Rbe}from"node:stream";var A9,nf,E9,Cbe,T9=y(()=>{S_();h_();hr();A9=(t,e)=>m_(Cbe,t,e,!1),nf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ho[t]}.`)},E9={fileNumber:nf,generator:_O,asyncGenerator:_O,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Rbe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Cbe={input:{...E9,fileUrl:({value:t})=>({stream:$9(t)}),filePath:({value:{file:t}})=>({stream:$9(t)}),webStream:({value:t})=>({stream:rf.fromWeb(t)}),iterable:({value:t})=>({stream:rf.from(t)}),asyncIterable:({value:t})=>({stream:rf.from(t)}),string:({value:t})=>({stream:rf.from(t)}),uint8Array:({value:t})=>({stream:rf.from(Ibe.from(t))})},output:{...E9,fileUrl:({value:t})=>({stream:k9(t)}),filePath:({value:{file:t,append:e}})=>({stream:k9(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Pbe.fromWeb(t)}),iterable:nf,asyncIterable:nf,string:nf,uint8Array:nf}}});import{on as Dbe,once as O9}from"node:events";import{PassThrough as Nbe,getDefaultHighWaterMark as jbe}from"node:stream";import{finished as R9}from"node:stream/promises";function oa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)TO(i);let e=t.some(({readableObjectMode:i})=>i),r=Mbe(t,e),n=new AO({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Mbe,AO,Fbe,zbe,Lbe,TO,Ube,qbe,Bbe,Hbe,Zbe,C9,D9,OO,N9,Gbe,$_,I9,P9,k_=y(()=>{Mbe=(t,e)=>{if(t.length===0)return jbe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},AO=class extends Nbe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(TO(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Fbe(this,this.#t,this.#o);let r=Ube({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(TO(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},Fbe=async(t,e,r)=>{$_(t,I9);let n=new AbortController;try{await Promise.race([zbe(t,n),Lbe(t,e,r,n)])}finally{n.abort(),$_(t,-I9)}},zbe=async(t,{signal:e})=>{try{await R9(t,{signal:e,cleanup:!0})}catch(r){throw C9(t,r),r}},Lbe=async(t,e,r,{signal:n})=>{for await(let[i]of Dbe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},TO=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Ube=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{$_(t,P9);let a=new AbortController;try{await Promise.race([qbe(o,e,a),Bbe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Hbe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),$_(t,-P9)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?OO(t):Zbe(t))},qbe=async(t,e,{signal:r})=>{try{await t,r.aborted||OO(e)}catch(n){r.aborted||C9(e,n)}},Bbe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await R9(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;D9(s)?i.add(e):N9(t,s)}},Hbe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await O9(t,i,{signal:o}),!t.readable)return O9(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},Zbe=t=>{t.writable&&t.end()},C9=(t,e)=>{D9(e)?OO(t):N9(t,e)},D9=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",OO=t=>{(t.readable||t.writable)&&t.destroy()},N9=(t,e)=>{t.destroyed||(t.once("error",Gbe),t.destroy(e))},Gbe=()=>{},$_=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},I9=2,P9=1});import{finished as j9}from"node:stream/promises";var Fc,Vbe,IO,Wbe,PO,E_=y(()=>{Xi();Fc=(t,e)=>{t.pipe(e),Vbe(t,e),Wbe(t,e)},Vbe=async(t,e)=>{if(!(Ln(t)||Ln(e))){try{await j9(t,{cleanup:!0,readable:!0,writable:!1})}catch{}IO(e)}},IO=t=>{t.writable&&t.end()},Wbe=async(t,e)=>{if(!(Ln(t)||Ln(e))){try{await j9(e,{cleanup:!0,readable:!1,writable:!0})}catch{}PO(t)}},PO=t=>{t.readable&&t.destroy()}});var M9,Kbe,Jbe,Ybe,Xbe,Qbe,F9=y(()=>{k_();Xi();jy();hr();E_();M9=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>hn.has(c)))Kbe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!hn.has(c)))Ybe({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:oa(o);Fc(s,i)}},Kbe=(t,e,r,n)=>{r==="output"?Fc(t.stdio[n],e):Fc(e,t.stdio[n]);let i=Jbe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Jbe=["stdin","stdout","stderr"],Ybe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Xbe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Xbe=(t,{signal:e})=>{Ln(t)&&Xs(t,Qbe,e)},Qbe=2});var sa,z9=y(()=>{sa=[];sa.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&sa.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&sa.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var A_,RO,CO,eve,DO,T_,tve,NO,jO,MO,L9,r7e,n7e,U9=y(()=>{z9();A_=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",RO=Symbol.for("signal-exit emitter"),CO=globalThis,eve=Object.defineProperty.bind(Object),DO=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(CO[RO])return CO[RO];eve(CO,RO,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},T_=class{},tve=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),NO=class extends T_{onExit(){return()=>{}}load(){}unload(){}},jO=class extends T_{#t=MO.platform==="win32"?"SIGINT":"SIGHUP";#r=new DO;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of sa)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!A_(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of sa)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,sa.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return A_(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&A_(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},MO=globalThis.process,{onExit:L9,load:r7e,unload:n7e}=tve(A_(MO)?new jO(MO):new NO)});import{addAbortListener as rve}from"node:events";var q9,B9=y(()=>{U9();q9=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=L9(()=>{t.kill()});rve(n,()=>{i()})}});var Z9,nve,ive,H9,ove,G9=y(()=>{aT();xy();qo();wc();Z9=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=wy(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=nve(r,n,i),{sourceStream:d,sourceError:f}=ove(t,l),{options:p,fileDescriptors:m}=gi.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},nve=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=ive(t,e,...r),a=Ny(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},ive=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(H9,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||oT(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=dy(r,...n);return{destination:e(H9)(i,o,s),pipeOptions:s}}if(gi.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},H9=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),ove=(t,e)=>{try{return{sourceStream:Rc(t,e)}}catch(r){return{sourceError:r}}}});var W9,sve,FO,V9,zO=y(()=>{Xd();E_();W9=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=sve({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw FO({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},sve=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return PO(t),n;if(e!==void 0)return IO(r),e},FO=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Nc({error:t,command:V9,escapedCommand:V9,fileDescriptors:e,options:r,startTime:n,isSync:!1}),V9="source.pipe(destination)"});var K9,J9=y(()=>{K9=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as ave}from"node:stream/promises";var Y9,cve,lve,uve,O_,dve,fve,X9=y(()=>{k_();jy();E_();Y9=(t,e,r)=>{let n=O_.has(e)?lve(t,e):cve(t,e);return Xs(t,dve,r.signal),Xs(e,fve,r.signal),uve(e),n},cve=(t,e)=>{let r=oa([t]);return Fc(r,e),O_.set(e,r),r},lve=(t,e)=>{let r=O_.get(e);return r.add(t),r},uve=async t=>{try{await ave(t,{cleanup:!0,readable:!1,writable:!0})}catch{}O_.delete(t)},O_=new WeakMap,dve=2,fve=1});import{aborted as pve}from"node:util";var Q9,mve,eV=y(()=>{zO();Q9=(t,e)=>t===void 0?[]:[mve(t,e)],mve=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await pve(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw FO({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var I_,hve,gve,tV=y(()=>{Ji();G9();zO();J9();X9();eV();I_=(t,...e)=>{if(Et(e[0]))return I_.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Z9(t,...e),i=hve({...n,destination:r});return i.pipe=I_.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},hve=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=gve(t,i);W9({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Y9(e,o,d);return await Promise.race([K9(u),...Q9(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},gve=(t,e)=>Promise.allSettled([t,e])});import{on as yve}from"node:events";import{getDefaultHighWaterMark as _ve}from"node:stream";var P_,bve,LO,vve,nV,UO,rV,Sve,wve,R_=y(()=>{mO();y_();yO();P_=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return bve(e,s),nV({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},bve=async(t,e)=>{try{await t}catch{}finally{e.abort()}},LO=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;vve(e,s,t);let a=t.readableObjectMode&&!o;return nV({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},vve=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},nV=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=yve(t,"data",{signal:e.signal,highWaterMark:rV,highWatermark:rV});return Sve({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},UO=_ve(!0),rV=UO,Sve=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=wve({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*ia(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*ef(a)}},wve=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[__(t,r,!e),g_(t,i,!n,{})].filter(Boolean)});import{setImmediate as xve}from"node:timers/promises";var iV,$ve,kve,Eve,qO,oV,BO=y(()=>{a_();Vr();bO();R_();ra();Qd();iV=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=$ve({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([kve(t),d]);return}let f=dO(c,r),p=LO({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Eve({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},$ve=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!w_({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=LO({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await QG(a,t,r,o)},kve=async t=>{await xve(),t.readableFlowing===null&&t.resume()},Eve=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await n_(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await i_(r,{maxBuffer:o})):await s_(r,{maxBuffer:o})}catch(a){return oV(MZ({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},qO=async t=>{try{return await t}catch(e){return oV(e)}},oV=({bufferedData:t})=>O6(t)?new Uint8Array(t):t});import{finished as Ave}from"node:stream/promises";var of,Tve,Ove,Ive,Pve,Rve,HO,C_,sV,D_=y(()=>{of=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Tve(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Ave(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Pve(a,e,r,n)}finally{s.abort()}},Tve=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Ove(t,r,n),n},Ove=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Ive(e,r),n.call(t,...i)}},Ive=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Pve=(t,e,r,n)=>{if(!Rve(t,e,r,n))throw t},Rve=(t,e,r,n=!0)=>r.propagating?sV(t)||C_(t):(r.propagating=!0,HO(r,e)===n?sV(t):C_(t)),HO=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",C_=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",sV=t=>t?.code==="EPIPE"});var aV,ZO,GO=y(()=>{BO();D_();aV=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>ZO({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),ZO=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=of(t,e,l);if(HO(l,e)){await u;return}let[d]=await Promise.all([iV({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var cV,lV,Cve,Dve,VO=y(()=>{k_();GO();cV=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?oa([t,e].filter(Boolean)):void 0,lV=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>ZO({...Cve(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Dve(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Cve=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},Dve=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var uV,dV,fV=y(()=>{kc();Lo();uV=t=>$c(t,"ipc"),dV=(t,e)=>{let r=Sy(t);mi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var pV,mV,hV=y(()=>{ra();fV();eo();kO();pV=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=uV(o),a=Qi(e,"ipc"),c=Qi(r,"ipc");for await(let l of $O({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(FZ(t,i,c),i.push(l)),s&&dV(l,o);return i},mV=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Nve}from"node:events";var gV,jve,Mve,Fve,yV=y(()=>{ta();LT();PT();zT();Xi();hr();BO();hV();qT();VO();GO();wO();D_();gV=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=s9(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=aV({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=lV({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=pV({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),E=jve(h,t,S),C=Mve(m,S);try{return await Promise.race([Promise.all([{},c9(_),Promise.all(x),w,A,lZ(t,d),...E,...C]),g,Fve(t,b),...iZ(t,o,f,b),...$H({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...rZ({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all(x.map(L=>qO(L))),qO(w),mV(A,R),Promise.allSettled(E),Promise.allSettled(C)])}},jve=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:of(n,i,r)),Mve=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Bn(o,{checkOpen:!1})&&!Ln(o)).map(({type:i,value:o,stream:s=o})=>of(s,n,e,{isSameDirection:hn.has(i),stopOnExit:i==="native"}))),Fve=async(t,{signal:e})=>{let[r]=await Nve(t,"error",{signal:e});throw r}});var _V,sf,zc,N_=y(()=>{Pc();_V=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),sf=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=hi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},zc=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as bV}from"node:stream/promises";var WO,vV,KO,JO,j_,M_,YO=y(()=>{D_();WO=async t=>{if(t!==void 0)try{await KO(t)}catch{}},vV=async t=>{if(t!==void 0)try{await JO(t)}catch{}},KO=async t=>{await bV(t,{cleanup:!0,readable:!1,writable:!0})},JO=async t=>{await bV(t,{cleanup:!0,readable:!0,writable:!1})},j_=async(t,e)=>{if(await t,e)throw e},M_=(t,e,r)=>{r&&!C_(r)?t.destroy(r):e&&t.destroy()}});import{Readable as zve}from"node:stream";import{callbackify as Lve}from"node:util";var SV,XO,QO,eI,Uve,tI,rI,wV,nI=y(()=>{Qs();qo();R_();Pc();N_();YO();SV=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||Wr.has(r),{subprocessStdout:a,waitReadableDestroy:c}=XO(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=QO(a,s),{read:f,onStdoutDataDone:p}=eI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new zve({read:f,destroy:Lve(rI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return tI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},XO=(t,e,r)=>{let n=Rc(t,e),i=sf(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},QO=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:UO},eI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=hi(),s=P_({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Uve(this,s,o)},onStdoutDataDone:o}},Uve=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},tI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await JO(t),await n,await WO(i),await e,r.readable&&r.push(null)}catch(o){await WO(i),wV(r,o)}},rI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await zc(r,e)&&(wV(t,n),await j_(e,n))},wV=(t,e)=>{M_(t,t.readable,e)}});import{Writable as qve}from"node:stream";import{callbackify as xV}from"node:util";var $V,iI,oI,Bve,Hve,sI,aI,kV,cI=y(()=>{qo();N_();YO();$V=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=iI(t,r,e),s=new qve({...oI(n,t,i),destroy:xV(aI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return sI(n,s),s},iI=(t,e,r)=>{let n=Ny(t,e),i=sf(r,n,"writableFinal"),o=sf(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},oI=(t,e,r)=>({write:Bve.bind(void 0,t),final:xV(Hve.bind(void 0,t,e,r))}),Bve=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Hve=async(t,e,r)=>{await zc(r,e)&&(t.writable&&t.end(),await e)},sI=async(t,e,r)=>{try{await KO(t),e.writable&&e.end()}catch(n){await vV(r),kV(e,n)}},aI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await zc(r,e),await zc(n,e)&&(kV(t,i),await j_(e,i))},kV=(t,e)=>{M_(t,t.writable,e)}});import{Duplex as Zve}from"node:stream";import{callbackify as Gve}from"node:util";var EV,Vve,AV=y(()=>{Qs();nI();cI();EV=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||Wr.has(r),{subprocessStdout:c,waitReadableDestroy:l}=XO(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=iI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=QO(c,a),{read:g,onStdoutDataDone:b}=eI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new Zve({read:g,...oI(u,t,d),destroy:Gve(Vve.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return tI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),sI(u,_,c),_},Vve=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([rI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),aI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var lI,Wve,TV=y(()=>{Qs();qo();R_();lI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||Wr.has(e),s=Rc(t,r),a=P_({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Wve(a,s,t)},Wve=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var OV,IV=y(()=>{N_();nI();cI();AV();TV();OV=(t,{encoding:e})=>{let r=_V();t.readable=SV.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=$V.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=EV.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=lI.bind(void 0,t,e),t[Symbol.asyncIterator]=lI.bind(void 0,t,e,{})}});var PV,Kve,Jve,RV=y(()=>{PV=(t,e)=>{for(let[r,n]of Jve){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Kve=(async()=>{})().constructor.prototype,Jve=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Kve,t)])});import{setMaxListeners as Yve}from"node:events";import{spawn as Xve}from"node:child_process";var CV,Qve,eSe,tSe,rSe,nSe,DV=y(()=>{a_();yT();ZT();qo();GT();EO();Xd();u_();x9();T9();Qd();F9();Py();B9();tV();VO();yV();IV();Pc();RV();CV=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Qve(t,e,r),{subprocess:f,promise:p}=tSe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=I_.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),PV(f,p),gi.set(f,{options:u,fileDescriptors:d}),f},Qve=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=$y(t,e,r),{file:a,commandArguments:c,options:l}=Yy(t,e,r),u=eSe(l),d=A9(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},eSe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},tSe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Xve(...Xy(t,e,r))}catch(m){return w9({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Yve(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];M9(c,a,l),q9(c,r,l);let d={},f=hi();c.kill=wH.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=cV(c,r),OV(c,r),b9(c,r);let p=rSe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},rSe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await gV({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>ro(x,e,w)),_=ro(h,e,"all"),S=nSe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return jc(S,n,e)},nSe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Yd({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof yi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):l_({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var F_,iSe,oSe,NV=y(()=>{Ji();eo();F_=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,iSe(n,t[n],i)]));return{...t,...r}},iSe=(t,e,r)=>oSe.has(t)&&Et(e)&&Et(r)?{...e,...r}:r,oSe=new Set(["env",...fT])});var Zo,sSe,aSe,jV=y(()=>{Ji();aT();M6();f9();DV();NV();Zo=(t,e,r,n)=>{let i=(s,a,c)=>Zo(s,a,r,c),o=(...s)=>sSe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},sSe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Et(o))return i(t,F_(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=aSe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?d9(a,c,l):CV(a,c,l,i)},aSe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=N6(e)?j6(e,r):[e,...r],[s,a,c]=dy(...o),l=F_(F_(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var MV,FV,zV,cSe,lSe,LV=y(()=>{MV=({file:t,commandArguments:e})=>zV(t,e),FV=({file:t,commandArguments:e})=>({...zV(t,e),isSync:!0}),zV=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=cSe(t);return{file:r,commandArguments:n}},cSe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(lSe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},lSe=/ +/g});var UV,qV,uSe,BV,dSe,HV,ZV=y(()=>{UV=(t,e,r)=>{t.sync=e(uSe,r),t.s=t.sync},qV=({options:t})=>BV(t),uSe=({options:t})=>({...BV(t),isSync:!0}),BV=t=>({options:{...dSe(t),...t}}),dSe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},HV={preferLocal:!0}});var Wet,et,Ket,Jet,Yet,Xet,Qet,ett,ttt,rtt,Ir=y(()=>{jV();LV();UT();ZV();EO();Wet=Zo(()=>({})),et=Zo(()=>({isSync:!0})),Ket=Zo(MV),Jet=Zo(FV),Yet=Zo(sZ),Xet=Zo(qV,{},HV,UV),{sendMessage:Qet,getOneMessage:ett,getEachMessage:ttt,getCancelSignal:rtt}=v9()});import{existsSync as z_,statSync as fSe}from"node:fs";import{dirname as uI,extname as pSe,isAbsolute as GV,join as dI,relative as fI,resolve as L_,sep as mSe}from"node:path";function U_(t){return t==="./gradlew"||t==="gradle"}function hSe(t){return(z_(dI(t,"build.gradle.kts"))||z_(dI(t,"build.gradle")))&&z_(dI(t,"gradle.properties"))}function gSe(t,e){let n=fI(t,e).split(mSe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function Go(t,e){return t===":"?`:${e}`:`${t}:${e}`}function ySe(t,e){let r=L_(t,e),n=r;z_(r)?fSe(r).isFile()&&(n=uI(r)):pSe(r)!==""&&(n=uI(r));let i=fI(t,n);if(i.startsWith("..")||GV(i))return null;let o=n;for(;;){if(hSe(o))return o;if(L_(o)===L_(t))return null;let s=uI(o);if(s===o)return null;let a=fI(t,s);if(a.startsWith("..")||GV(a))return null;o=s}}function q_(t,e){let r=L_(t),n=new Map,i=[];for(let o of e){let s=ySe(r,o);if(!s){i.push(o);continue}let a=gSe(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var B_=y(()=>{"use strict"});import{existsSync as _Se,readFileSync as bSe}from"node:fs";import{join as vSe}from"node:path";function Lc(t="."){let e=vSe(t,".cladding","config.yaml");if(!_Se(e))return pI;try{let n=(0,VV.parse)(bSe(e,"utf8"))?.gate;if(!n)return pI;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of SSe){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return pI}}function WV(t,e){let r=[],n=!1;for(let i of t){let o=wSe.exec(i);if(o){n=!0;for(let s of e)r.push(Go(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var VV,SSe,pI,wSe,H_=y(()=>{"use strict";VV=kt(or(),1);B_();SSe=["type","lint","test","coverage"],pI={scope:"feature"};wSe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as hI,readFileSync as KV,readdirSync as xSe,statSync as $Se}from"node:fs";import{join as Z_}from"node:path";function _I(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Z_(t,e);if(hI(r))try{if(JV.test(KV(r,"utf8")))return!0}catch{}}return!1}function YV(t){try{return hI(t)&&JV.test(KV(t,"utf8"))}catch{return!1}}function XV(t,e=0){if(e>4||!hI(t))return!1;let r;try{r=xSe(t)}catch{return!1}for(let n of r){let i=Z_(t,n),o=!1;try{o=$Se(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(XV(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&YV(i))return!0}return!1}function ASe(t){if(_I(t))return!0;for(let e of kSe)if(YV(Z_(t,e)))return!0;for(let e of ESe)if(XV(Z_(t,e)))return!0;return!1}function QV(t="."){let e=Lc(t).coverage;return e||(ASe(t)?"kover":"jacoco")}function eW(t="."){return gI[QV(t)]}function tW(t="."){return mI[QV(t)]}var gI,mI,yI,JV,kSe,ESe,G_=y(()=>{"use strict";H_();gI={kover:"koverXmlReport",jacoco:"jacocoTestReport"},mI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},yI=[mI.kover,mI.jacoco],JV=/kover/i;kSe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],ESe=["buildSrc","build-logic"]});import{existsSync as bI,readdirSync as rW}from"node:fs";import{join as V_}from"node:path";function vI(t){return bI(V_(t,"gradlew"))?"./gradlew":"gradle"}function TSe(t){let e=vI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[eW(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function ISe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function CSe(t,e){for(let r of e)if(bI(V_(t,r)))return r}function DSe(t,e){try{return rW(t).find(n=>n.endsWith(e))}catch{return}}function jSe(t,e){for(let r of NSe)if(r.configs.some(n=>bI(V_(t,n))))return r.gate;return e}function pt(t="."){for(let e of PSe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=DSe(t,o):r=CSe(t,[o]),r)break;if(!r||e.requiresSource&&!ISe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"&&n.lint?{...n,lint:jSe(t,n.lint)}:n;return{language:e.language,manifest:r,gates:i}}return RSe}var OSe,PSe,RSe,NSe,gn=y(()=>{"use strict";G_();OSe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);PSe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","madge","--circular","--extensions","ts","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:TSe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}],RSe={language:"unknown",manifest:"",gates:{}};NSe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}]});import{existsSync as MSe,readFileSync as FSe}from"node:fs";import{join as zSe}from"node:path";function af(t){return t.code==="ENOENT"}function W_(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return nW.test(o)||nW.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function zt(t,e,r){return af(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function sr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Uc(t,e){let r=zSe(t,"package.json");if(!MSe(r))return!1;try{return!!JSON.parse(FSe(r,"utf8")).scripts?.[e]}catch{return!1}}var nW,yn=y(()=>{"use strict";nW=/config (is |file )?not found|no such file|ENOENT|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function LSe(t){let{cwd:e="."}=t,r=pt(e),n=r.gates.arch;if(!n)return[{detector:K_,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=et(n.cmd,[...n.args],{cwd:e,reject:!1});return af(i)?[{detector:K_,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:W_(i,K_,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var K_,J_,SI=y(()=>{"use strict";Ir();gn();yn();K_="ARCHITECTURE_VIOLATION";J_={name:K_,run:LSe}});import iW from"node:process";function aa(t={}){let r=J_.run(t).filter(o=>o.severity==="error"),n=r.length===0,i={stage:USe,pass:n,exitCode:n?0:1};return n?i:{...i,stderr:r.map(o=>o.message).join(` -`)}}var USe,qSe,Y_=y(()=>{"use strict";SI();USe="stage_1.5";qSe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${iW.argv[1]}`;if(qSe){let t=aa();console.log(JSON.stringify(t)),iW.exit(t.exitCode)}});import{existsSync as wI,readdirSync as oW}from"node:fs";import{join as X_}from"node:path";function HSe(t,e){let r=X_(t,e.path);if(!wI(r))return!0;if(e.isDirectory)try{return oW(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function ZSe(t){let{cwd:e="."}=t,r=[];for(let i of BSe)HSe(e,i)&&r.push({detector:cf,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=X_(e,"spec.yaml");if(wI(n)){let i=WSe(n),o=i?null:GSe(e);if(i)r.push({detector:cf,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:cf,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=VSe(e);s&&r.push({detector:cf,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function GSe(t){for(let e of["spec/features","spec/scenarios"]){let r=X_(t,e);if(!wI(r))continue;let n;try{n=oW(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{di(X_(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function VSe(t){try{return J(t),null}catch(e){return e.message}}function WSe(t){let e;try{e=di(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var cf,BSe,sW,aW=y(()=>{"use strict";at();sy();cf="ABSENCE_OF_GOVERNANCE",BSe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];sW={name:cf,run:ZSe}});function Q_(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function xI(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Q_(r)==="while",o=JSe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Q_(r)}'`}let n=KSe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Q_(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Q_(r)}'`:null}function YSe(t,e){let r=xI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function cW(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...YSe(r,n));return e}var KSe,JSe,$I=y(()=>{"use strict";KSe={event:"when",state:"while",optional:"where",unwanted:"if"},JSe=/\bwhen\b/i});function pe(t,e,r){let n;try{n=J(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var _t=y(()=>{"use strict";at()});function XSe(t){let{cwd:e="."}=t;return pe(e,eb,QSe)}function QSe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:eb,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of cW(t.features))e.push({detector:eb,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var eb,lW,uW=y(()=>{"use strict";$I();_t();eb="AC_DRIFT";lW={name:eb,run:XSe}});function bi(t=".",e){let n=(e??"").trim().toLowerCase()||pt(t).language;return nwe[n]??dW}var ewe,twe,dW,rwe,nwe,qc=y(()=>{"use strict";gn();ewe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,twe=/^[ \t]*import\s+([\w.]+)/gm,dW={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:ewe,importStyle:"relative"},rwe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:twe,importStyle:"dotted"},nwe={typescript:dW,kotlin:rwe}});import{existsSync as iwe,readFileSync as owe,readdirSync as swe,statSync as awe}from"node:fs";import{join as pW,relative as fW}from"node:path";function cwe(t,e){if(!iwe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=swe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=pW(i,s),c;try{c=awe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function lwe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function dwe(t){return uwe.test(t)}function fwe(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=bi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>cwe(pW(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=owe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";at();qc();mW="AI_HINTS_FORBIDDEN_PATTERN";uwe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;hW={name:mW,run:fwe}});function pwe(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:yW,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var yW,_W,bW=y(()=>{"use strict";at();yW="AC_DUPLICATE_WITHIN_FEATURE";_W={name:yW,run:pwe}});import{createRequire as mwe}from"module";import{basename as hwe,dirname as EI,normalize as gwe,relative as ywe,resolve as _we,sep as wW}from"path";import*as bwe from"fs";function vwe(t){let e=gwe(t);return e.length>1&&e[e.length-1]===wW&&(e=e.substring(0,e.length-1)),e}function xW(t,e){return t.replace(Swe,e)}function xwe(t){return t==="/"||wwe.test(t)}function kI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=_we(t)),(n||o)&&(t=vwe(t)),t===".")return"";let s=t[t.length-1]!==i;return xW(s?t+i:t,i)}function $W(t,e){return e+t}function $we(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:xW(ywe(t,n),e.pathSeparator)+e.pathSeparator+r}}function kwe(t){return t}function Ewe(t,e,r){return e+t+r}function Awe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?$we(t,e):n?$W:kwe}function Twe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function Owe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function Cwe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?Owe(t):Twe(t):n&&n.length?Pwe:Iwe:Rwe}function zwe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?Fwe:r&&r.length?n?Dwe:Nwe:n?jwe:Mwe}function qwe(t){return t.group?Uwe:Lwe}function Zwe(t){return t.group?Bwe:Hwe}function Wwe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Vwe:Gwe}function kW(t,e,r){if(r.options.useRealPaths)return Kwe(e,r);let n=EI(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=EI(n)}return r.symlinks.set(t,e),i>1}function Kwe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function tb(t,e,r,n){e(t&&!n?t:null,r)}function ixe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?Jwe:exe:n?e?Ywe:nxe:i?e?Qwe:rxe:e?Xwe:txe}function axe(t){return t?sxe:oxe}function dxe(t,e){return new Promise((r,n)=>{TW(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function TW(t,e,r){new AW(t,e,r).start()}function fxe(t,e){return new AW(t,e).start()}var vW,Swe,wwe,Iwe,Pwe,Rwe,Dwe,Nwe,jwe,Mwe,Fwe,Lwe,Uwe,Bwe,Hwe,Gwe,Vwe,Jwe,Ywe,Xwe,Qwe,exe,txe,rxe,nxe,EW,oxe,sxe,cxe,lxe,uxe,AW,SW,OW,IW,PW=y(()=>{vW=mwe(import.meta.url);Swe=/[\\/]/g;wwe=/^[a-z]:[\\/]$/i;Iwe=(t,e)=>{e.push(t||".")},Pwe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},Rwe=()=>{};Dwe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},Nwe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},jwe=(t,e,r,n)=>{r.files++},Mwe=(t,e)=>{e.push(t)},Fwe=()=>{};Lwe=t=>t,Uwe=()=>[""].slice(0,0);Bwe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},Hwe=()=>{};Gwe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&kW(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},Vwe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&kW(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};Jwe=t=>t.counts,Ywe=t=>t.groups,Xwe=t=>t.paths,Qwe=t=>t.paths.slice(0,t.options.maxFiles),exe=(t,e,r)=>(tb(e,r,t.counts,t.options.suppressErrors),null),txe=(t,e,r)=>(tb(e,r,t.paths,t.options.suppressErrors),null),rxe=(t,e,r)=>(tb(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),nxe=(t,e,r)=>(tb(e,r,t.groups,t.options.suppressErrors),null);EW={withFileTypes:!0},oxe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",EW,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},sxe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",EW)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};cxe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},lxe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},uxe=class{aborted=!1;abort(){this.aborted=!0}},AW=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=ixe(e,this.isSynchronous),this.root=kI(t,e),this.state={root:xwe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new lxe,options:e,queue:new cxe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new uxe,fs:e.fs||bwe},this.joinPath=Awe(this.root,e),this.pushDirectory=Cwe(this.root,e),this.pushFile=zwe(e),this.getArray=qwe(e),this.groupFiles=Zwe(e),this.resolveSymlink=Wwe(e,this.isSynchronous),this.walkDirectory=axe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=kI(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=hwe(_),x=kI(EI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};SW=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return dxe(this.root,this.options)}withCallback(t){TW(this.root,this.options,t)}sync(){return fxe(this.root,this.options)}},OW=null;try{vW.resolve("picomatch"),OW=vW("picomatch")}catch{}IW=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:wW,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new SW(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new SW(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||OW;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var lf=v((irt,jW)=>{"use strict";var RW="[^\\\\/]",pxe="(?=.)",CW="[^/]",AI="(?:\\/|$)",DW="(?:^|\\/)",TI=`\\.{1,2}${AI}`,mxe="(?!\\.)",hxe=`(?!${DW}${TI})`,gxe=`(?!\\.{0,1}${AI})`,yxe=`(?!${TI})`,_xe="[^.\\/]",bxe=`${CW}*?`,vxe="/",NW={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:pxe,QMARK:CW,END_ANCHOR:AI,DOTS_SLASH:TI,NO_DOT:mxe,NO_DOTS:hxe,NO_DOT_SLASH:gxe,NO_DOTS_SLASH:yxe,QMARK_NO_DOT:_xe,STAR:bxe,START_ANCHOR:DW,SEP:vxe},Sxe={...NW,SLASH_LITERAL:"[\\\\/]",QMARK:RW,STAR:`${RW}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},wxe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};jW.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:wxe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Sxe:NW}}});var uf=v(Pr=>{"use strict";var{REGEX_BACKSLASH:xxe,REGEX_REMOVE_BACKSLASH:$xe,REGEX_SPECIAL_CHARS:kxe,REGEX_SPECIAL_CHARS_GLOBAL:Exe}=lf();Pr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Pr.hasRegexChars=t=>kxe.test(t);Pr.isRegexChar=t=>t.length===1&&Pr.hasRegexChars(t);Pr.escapeRegex=t=>t.replace(Exe,"\\$1");Pr.toPosixSlashes=t=>t.replace(xxe,"/");Pr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Pr.removeBackslashes=t=>t.replace($xe,e=>e==="\\"?"":e);Pr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Pr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Pr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Pr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Pr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var HW=v((srt,BW)=>{"use strict";var MW=uf(),{CHAR_ASTERISK:OI,CHAR_AT:Axe,CHAR_BACKWARD_SLASH:df,CHAR_COMMA:Txe,CHAR_DOT:II,CHAR_EXCLAMATION_MARK:PI,CHAR_FORWARD_SLASH:qW,CHAR_LEFT_CURLY_BRACE:RI,CHAR_LEFT_PARENTHESES:CI,CHAR_LEFT_SQUARE_BRACKET:Oxe,CHAR_PLUS:Ixe,CHAR_QUESTION_MARK:FW,CHAR_RIGHT_CURLY_BRACE:Pxe,CHAR_RIGHT_PARENTHESES:zW,CHAR_RIGHT_SQUARE_BRACKET:Rxe}=lf(),LW=t=>t===qW||t===df,UW=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Cxe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,R=0,A,E,C={value:"",depth:0,isGlob:!1},k=()=>l>=n,L=()=>c.charCodeAt(l+1),te=()=>(A=E,c.charCodeAt(++l));for(;l0&&(O=c.slice(0,u),c=c.slice(u),d-=u),be&&m===!0&&d>0?(be=c.slice(0,d),P=c.slice(d)):m===!0?(be="",P=c):be=c,be&&be!==""&&be!=="/"&&be!==c&&LW(be.charCodeAt(be.length-1))&&(be=be.slice(0,-1)),r.unescape===!0&&(P&&(P=MW.removeBackslashes(P)),be&&_===!0&&(be=MW.removeBackslashes(be)));let $t={prefix:O,input:t,start:u,base:be,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&($t.maxDepth=0,LW(E)||s.push(C),$t.tokens=s),r.parts===!0||r.tokens===!0){let je;for(let Me=0;Me{"use strict";var ff=lf(),Kr=uf(),{MAX_LENGTH:rb,POSIX_REGEX_SOURCE:Dxe,REGEX_NON_SPECIAL_CHARS:Nxe,REGEX_SPECIAL_CHARS_BACKREF:jxe,REPLACEMENTS:ZW}=ff,Mxe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Kr.escapeRegex(i)).join("..")}return r},Bc=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,GW=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},Fxe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},VW=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(Fxe(e))return e.replace(/\\(.)/g,"$1")},zxe=t=>{let e=t.map(VW).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},Lxe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=VW(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Kr.escapeRegex(r[0]):`[${r.map(i=>Kr.escapeRegex(i)).join("")}]`}*`},Uxe=t=>{let e=0,r=t.trim(),n=DI(r);for(;n;)e++,r=n.body.trim(),n=DI(r);return e},qxe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:ff.DEFAULT_MAX_EXTGLOB_RECURSION,n=GW(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||zxe(n)))return{risky:!0};for(let i of n){let o=Lxe(i);if(o)return{risky:!0,safeOutput:o};if(Uxe(i)>r)return{risky:!0}}return{risky:!1}},NI=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=ZW[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(rb,r.maxLength):rb,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=ff.globChars(r.windows),l=ff.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,R=q=>`(${a}(?:(?!${w}${q.dot?m:u}).)*?)`,A=r.dot?"":h,E=r.dot?_:S,C=r.bash===!0?R(r):x;r.capture&&(C=`(${C})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=Kr.removePrefix(t,k),i=t.length;let L=[],te=[],be=[],O=o,P,$t=()=>k.index===i-1,je=k.peek=(q=1)=>t[k.index+q],Me=k.advance=()=>t[++k.index]||"",Kt=()=>t.slice(k.index+1),Gt=(q="",ut=0)=>{k.consumed+=q,k.index+=ut},Br=q=>{k.output+=q.output!=null?q.output:q.value,Gt(q.value)},jn=()=>{let q=1;for(;je()==="!"&&(je(2)!=="("||je(3)==="?");)Me(),k.start++,q++;return q%2===0?!1:(k.negated=!0,k.start++,!0)},Bi=q=>{k[q]++,be.push(q)},ko=q=>{k[q]--,be.pop()},Ee=q=>{if(O.type==="globstar"){let ut=k.braces>0&&(q.type==="comma"||q.type==="brace"),U=q.extglob===!0||L.length&&(q.type==="pipe"||q.type==="paren");q.type!=="slash"&&q.type!=="paren"&&!ut&&!U&&(k.output=k.output.slice(0,-O.output.length),O.type="star",O.value="*",O.output=C,k.output+=O.output)}if(L.length&&q.type!=="paren"&&(L[L.length-1].inner+=q.value),(q.value||q.output)&&Br(q),O&&O.type==="text"&&q.type==="text"){O.output=(O.output||O.value)+q.value,O.value+=q.value;return}q.prev=O,s.push(q),O=q},Kh=(q,ut)=>{let U={...l[ut],conditions:1,inner:""};U.prev=O,U.parens=k.parens,U.output=k.output,U.startIndex=k.index,U.tokensIndex=s.length;let Ae=(r.capture?"(":"")+U.open;Bi("parens"),Ee({type:q,value:ut,output:k.output?"":p}),Ee({type:"paren",extglob:!0,value:Me(),output:Ae}),L.push(U)},Rae=q=>{let ut=t.slice(q.startIndex,k.index+1),U=t.slice(q.startIndex+2,k.index),Ae=qxe(U,r);if((q.type==="plus"||q.type==="star")&&Ae.risky){let ot=Ae.safeOutput?(q.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,ai=s[q.tokensIndex];ai.type="text",ai.value=ut,ai.output=ot||Kr.escapeRegex(ut);for(let ci=q.tokensIndex+1;ci1&&q.inner.includes("/")&&(ot=R(r)),(ot!==C||$t()||/^\)+$/.test(Kt()))&&(st=q.close=`)$))${ot}`),q.inner.includes("*")&&(jt=Kt())&&/^\.[^\\/.]+$/.test(jt)){let ai=NI(jt,{...e,fastpaths:!1}).output;st=q.close=`)${ai})${ot})`}q.prev.type==="bos"&&(k.negatedExtglob=!0)}Ee({type:"paren",extglob:!0,value:P,output:st}),ko("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let q=!1,ut=t.replace(jxe,(U,Ae,st,jt,ot,ai)=>jt==="\\"?(q=!0,U):jt==="?"?Ae?Ae+jt+(ot?_.repeat(ot.length):""):ai===0?E+(ot?_.repeat(ot.length):""):_.repeat(st.length):jt==="."?u.repeat(st.length):jt==="*"?Ae?Ae+jt+(ot?C:""):C:Ae?U:`\\${U}`);return q===!0&&(r.unescape===!0?ut=ut.replace(/\\/g,""):ut=ut.replace(/\\+/g,U=>U.length%2===0?"\\\\":U?"\\":"")),ut===t&&r.contains===!0?(k.output=t,k):(k.output=Kr.wrapOutput(ut,k,e),k)}for(;!$t();){if(P=Me(),P==="\0")continue;if(P==="\\"){let U=je();if(U==="/"&&r.bash!==!0||U==="."||U===";")continue;if(!U){P+="\\",Ee({type:"text",value:P});continue}let Ae=/^\\+/.exec(Kt()),st=0;if(Ae&&Ae[0].length>2&&(st=Ae[0].length,k.index+=st,st%2!==0&&(P+="\\")),r.unescape===!0?P=Me():P+=Me(),k.brackets===0){Ee({type:"text",value:P});continue}}if(k.brackets>0&&(P!=="]"||O.value==="["||O.value==="[^")){if(r.posix!==!1&&P===":"){let U=O.value.slice(1);if(U.includes("[")&&(O.posix=!0,U.includes(":"))){let Ae=O.value.lastIndexOf("["),st=O.value.slice(0,Ae),jt=O.value.slice(Ae+2),ot=Dxe[jt];if(ot){O.value=st+ot,k.backtrack=!0,Me(),!o.output&&s.indexOf(O)===1&&(o.output=p);continue}}}(P==="["&&je()!==":"||P==="-"&&je()==="]")&&(P=`\\${P}`),P==="]"&&(O.value==="["||O.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&O.value==="["&&(P="^"),O.value+=P,Br({value:P});continue}if(k.quotes===1&&P!=='"'){P=Kr.escapeRegex(P),O.value+=P,Br({value:P});continue}if(P==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&Ee({type:"text",value:P});continue}if(P==="("){Bi("parens"),Ee({type:"paren",value:P});continue}if(P===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Bc("opening","("));let U=L[L.length-1];if(U&&k.parens===U.parens+1){Rae(L.pop());continue}Ee({type:"paren",value:P,output:k.parens?")":"\\)"}),ko("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Bc("closing","]"));P=`\\${P}`}else Bi("brackets");Ee({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||O&&O.type==="bracket"&&O.value.length===1){Ee({type:"text",value:P,output:`\\${P}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Bc("opening","["));Ee({type:"text",value:P,output:`\\${P}`});continue}ko("brackets");let U=O.value.slice(1);if(O.posix!==!0&&U[0]==="^"&&!U.includes("/")&&(P=`/${P}`),O.value+=P,Br({value:P}),r.literalBrackets===!1||Kr.hasRegexChars(U))continue;let Ae=Kr.escapeRegex(O.value);if(k.output=k.output.slice(0,-O.value.length),r.literalBrackets===!0){k.output+=Ae,O.value=Ae;continue}O.value=`(${a}${Ae}|${O.value})`,k.output+=O.value;continue}if(P==="{"&&r.nobrace!==!0){Bi("braces");let U={type:"brace",value:P,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};te.push(U),Ee(U);continue}if(P==="}"){let U=te[te.length-1];if(r.nobrace===!0||!U){Ee({type:"text",value:P,output:P});continue}let Ae=")";if(U.dots===!0){let st=s.slice(),jt=[];for(let ot=st.length-1;ot>=0&&(s.pop(),st[ot].type!=="brace");ot--)st[ot].type!=="dots"&&jt.unshift(st[ot].value);Ae=Mxe(jt,r),k.backtrack=!0}if(U.comma!==!0&&U.dots!==!0){let st=k.output.slice(0,U.outputIndex),jt=k.tokens.slice(U.tokensIndex);U.value=U.output="\\{",P=Ae="\\}",k.output=st;for(let ot of jt)k.output+=ot.output||ot.value}Ee({type:"brace",value:P,output:Ae}),ko("braces"),te.pop();continue}if(P==="|"){L.length>0&&L[L.length-1].conditions++,Ee({type:"text",value:P});continue}if(P===","){let U=P,Ae=te[te.length-1];Ae&&be[be.length-1]==="braces"&&(Ae.comma=!0,U="|"),Ee({type:"comma",value:P,output:U});continue}if(P==="/"){if(O.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),O=o;continue}Ee({type:"slash",value:P,output:f});continue}if(P==="."){if(k.braces>0&&O.type==="dot"){O.value==="."&&(O.output=u);let U=te[te.length-1];O.type="dots",O.output+=P,O.value+=P,U.dots=!0;continue}if(k.braces+k.parens===0&&O.type!=="bos"&&O.type!=="slash"){Ee({type:"text",value:P,output:u});continue}Ee({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(O&&O.value==="(")&&r.noextglob!==!0&&je()==="("&&je(2)!=="?"){Kh("qmark",P);continue}if(O&&O.type==="paren"){let Ae=je(),st=P;(O.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(st=`\\${P}`),Ee({type:"text",value:P,output:st});continue}if(r.dot!==!0&&(O.type==="slash"||O.type==="bos")){Ee({type:"qmark",value:P,output:S});continue}Ee({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&je()==="("&&(je(2)!=="?"||!/[!=<:]/.test(je(3)))){Kh("negate",P);continue}if(r.nonegate!==!0&&k.index===0){jn();continue}}if(P==="+"){if(r.noextglob!==!0&&je()==="("&&je(2)!=="?"){Kh("plus",P);continue}if(O&&O.value==="("||r.regex===!1){Ee({type:"plus",value:P,output:d});continue}if(O&&(O.type==="bracket"||O.type==="paren"||O.type==="brace")||k.parens>0){Ee({type:"plus",value:P});continue}Ee({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&je()==="("&&je(2)!=="?"){Ee({type:"at",extglob:!0,value:P,output:""});continue}Ee({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let U=Nxe.exec(Kt());U&&(P+=U[0],k.index+=U[0].length),Ee({type:"text",value:P});continue}if(O&&(O.type==="globstar"||O.star===!0)){O.type="star",O.star=!0,O.value+=P,O.output=C,k.backtrack=!0,k.globstar=!0,Gt(P);continue}let q=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(q)){Kh("star",P);continue}if(O.type==="star"){if(r.noglobstar===!0){Gt(P);continue}let U=O.prev,Ae=U.prev,st=U.type==="slash"||U.type==="bos",jt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!st||q[0]&&q[0]!=="/")){Ee({type:"star",value:P,output:""});continue}let ot=k.braces>0&&(U.type==="comma"||U.type==="brace"),ai=L.length&&(U.type==="pipe"||U.type==="paren");if(!st&&U.type!=="paren"&&!ot&&!ai){Ee({type:"star",value:P,output:""});continue}for(;q.slice(0,3)==="/**";){let ci=t[k.index+4];if(ci&&ci!=="/")break;q=q.slice(3),Gt("/**",3)}if(U.type==="bos"&&$t()){O.type="globstar",O.value+=P,O.output=R(r),k.output=O.output,k.globstar=!0,Gt(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&!jt&&$t()){k.output=k.output.slice(0,-(U.output+O.output).length),U.output=`(?:${U.output}`,O.type="globstar",O.output=R(r)+(r.strictSlashes?")":"|$)"),O.value+=P,k.globstar=!0,k.output+=U.output+O.output,Gt(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&q[0]==="/"){let ci=q[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(U.output+O.output).length),U.output=`(?:${U.output}`,O.type="globstar",O.output=`${R(r)}${f}|${f}${ci})`,O.value+=P,k.output+=U.output+O.output,k.globstar=!0,Gt(P+Me()),Ee({type:"slash",value:"/",output:""});continue}if(U.type==="bos"&&q[0]==="/"){O.type="globstar",O.value+=P,O.output=`(?:^|${f}|${R(r)}${f})`,k.output=O.output,k.globstar=!0,Gt(P+Me()),Ee({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-O.output.length),O.type="globstar",O.output=R(r),O.value+=P,k.output+=O.output,k.globstar=!0,Gt(P);continue}let ut={type:"star",value:P,output:C};if(r.bash===!0){ut.output=".*?",(O.type==="bos"||O.type==="slash")&&(ut.output=A+ut.output),Ee(ut);continue}if(O&&(O.type==="bracket"||O.type==="paren")&&r.regex===!0){ut.output=P,Ee(ut);continue}(k.index===k.start||O.type==="slash"||O.type==="dot")&&(O.type==="dot"?(k.output+=g,O.output+=g):r.dot===!0?(k.output+=b,O.output+=b):(k.output+=A,O.output+=A),je()!=="*"&&(k.output+=p,O.output+=p)),Ee(ut)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Bc("closing","]"));k.output=Kr.escapeLast(k.output,"["),ko("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Bc("closing",")"));k.output=Kr.escapeLast(k.output,"("),ko("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Bc("closing","}"));k.output=Kr.escapeLast(k.output,"{"),ko("braces")}if(r.strictSlashes!==!0&&(O.type==="star"||O.type==="bracket")&&Ee({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let q of k.tokens)k.output+=q.output!=null?q.output:q.value,q.suffix&&(k.output+=q.suffix)}return k};NI.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(rb,r.maxLength):rb,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=ZW[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=ff.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=A=>A.noglobstar===!0?_:`(${g}(?:(?!${p}${A.dot?c:o}).)*?)`,x=A=>{switch(A){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let E=/^(.*?)\.(\w+)$/.exec(A);if(!E)return;let C=x(E[1]);return C?C+o+E[2]:void 0}}},w=Kr.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};WW.exports=NI});var XW=v((crt,YW)=>{"use strict";var Bxe=HW(),jI=KW(),JW=uf(),Hxe=lf(),Zxe=t=>t&&typeof t=="object"&&!Array.isArray(t),At=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>At(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=Zxe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?At.compileRe(t,e):At.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=At(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=At.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};At.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?JW.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=At.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};At.matchBase=(t,e,r)=>(e instanceof RegExp?e:At.makeRe(e,r)).test(JW.basename(t));At.isMatch=(t,e,r)=>At(e,r)(t);At.parse=(t,e)=>Array.isArray(t)?t.map(r=>At.parse(r,e)):jI(t,{...e,fastpaths:!1});At.scan=(t,e)=>Bxe(t,e);At.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=At.toRegex(a,e);return n===!0&&(c.state=t),c};At.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=jI.fastpaths(t,e)),i.output||(i=jI(t,e)),At.compileRe(i,e,r,n)};At.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};At.constants=Hxe;YW.exports=At});var rK=v((lrt,tK)=>{"use strict";var QW=XW(),Gxe=uf();function eK(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Gxe.isWindows()}),QW(t,e,r)}Object.assign(eK,QW);tK.exports=eK});import{readdir as Vxe,readdirSync as Wxe,realpath as Kxe,realpathSync as Jxe,stat as Yxe,statSync as Xxe}from"fs";import{isAbsolute as Qxe,posix as ca,resolve as e0e}from"path";import{fileURLToPath as t0e}from"url";function i0e(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&n0e.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>ca.relative(t,n)||".":n=>ca.relative(t,`${e}/${n}`)||"."}function a0e(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=ca.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function sK(t){var e;let r=Hc.default.scan(t,c0e);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function m0e(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Hc.default.scan(t);return r.isGlob||r.negated}function pf(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function aK(t){return typeof t=="string"?[t]:t??[]}function MI(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=p0e(o);s=Qxe(s.replace(g0e,""))?ca.relative(a,s):ca.normalize(s);let c=(i=h0e.exec(s))===null||i===void 0?void 0:i[0],l=sK(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?ca.join(o,...d):o}return s}function y0e(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(MI(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(MI(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(MI(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function _0e(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=y0e(t,e,n);t.debug&&pf("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(iK,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Hc.default)(i.match,f),m=(0,Hc.default)(i.ignore,f),h=i0e(i.match,f),g=nK(r,d,o),b=o?g:nK(r,d,!0),_=(w,R)=>{let A=b(R,!0);return A!=="."&&!h(A)||m(A)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new IW({filters:[a?(w,R)=>{let A=g(w,R),E=p(A)&&!m(A);return E&&pf(`matched ${A}`),E}:(w,R)=>{let A=g(w,R);return p(A)&&!m(A)}],exclude:a?(w,R)=>{let A=_(w,R);return pf(`${A?"skipped":"crawling"} ${R}`),A}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&pf("internal properties:",{...n,root:d}),[x,r!==d&&!o&&a0e(r,d)]}function b0e(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function S0e(t){let e={...v0e,...t};return e.cwd=(e.cwd instanceof URL?t0e(e.cwd):e0e(e.cwd)).replace(iK,"/"),e.ignore=aK(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||Vxe,readdirSync:e.fs.readdirSync||Wxe,realpath:e.fs.realpath||Kxe,realpathSync:e.fs.realpathSync||Jxe,stat:e.fs.stat||Yxe,statSync:e.fs.statSync||Xxe}),e.debug&&pf("globbing with options:",e),e}function w0e(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=r0e(t)||typeof t=="string",i=aK((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=S0e(n?e:t);return i.length>0?_0e(o,i):[]}function Vo(t,e){let[r,n]=w0e(t,e);return r?b0e(r.sync(),n):[]}var Hc,r0e,iK,oK,n0e,o0e,s0e,c0e,l0e,u0e,d0e,f0e,p0e,h0e,g0e,v0e,mf=y(()=>{PW();Hc=kt(rK(),1),r0e=Array.isArray,iK=/\\/g,oK=process.platform==="win32",n0e=/^(\/?\.\.)+$/;o0e=/^[A-Z]:\/$/i,s0e=oK?t=>o0e.test(t):t=>t==="/";c0e={parts:!0};l0e=/(?t.replace(l0e,"\\$&"),f0e=t=>t.replace(u0e,"\\$&"),p0e=oK?f0e:d0e;h0e=/^(\/?\.\.)+/,g0e=/\\(?=[()[\]{}!*+?@|])/g;v0e={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as nb,readFileSync as x0e,readdirSync as $0e,statSync as cK}from"node:fs";import{join as Zc}from"node:path";function k0e(t){let{cwd:e="."}=t,r,n;try{let c=J(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=bi(e,n),o=[],{layers:s,forbiddenImports:a}=FI(r);return s.size>0&&(E0e(e,i,s,o),A0e(e,i,s,o)),a.length>0&&T0e(e,i,a,o),o}function FI(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function E0e(t,e,r,n){let i=e.mainRoot,o=Zc(t,i);if(nb(o))for(let s of $0e(o)){let a=Zc(o,s);cK(a).isDirectory()&&(r.has(s)||n.push({detector:ib,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function A0e(t,e,r,n){let i=e.mainRoot,o=Zc(t,i);if(nb(o))for(let s of r){let a=Zc(o,s);nb(a)&&cK(a).isDirectory()||n.push({detector:ib,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function T0e(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Zc(t,i,s.from);if(!nb(a))continue;let c=Vo([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Zc(a,l),d;try{d=x0e(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];O0e(p,s.to,e.importStyle)&&n.push({detector:ib,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function O0e(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var ib,lK,zI=y(()=>{"use strict";mf();at();qc();ib="ARCHITECTURE_FROM_SPEC";lK={name:ib,run:k0e}});import{existsSync as I0e,readFileSync as P0e}from"node:fs";import{join as R0e}from"node:path";function C0e(t){let{cwd:e="."}=t,r=R0e(e,"spec/capabilities.yaml");if(!I0e(r))return[];let n;try{let c=P0e(r,"utf8"),l=uK.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=J(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:ob,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:ob,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:ob,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var uK,ob,dK,fK=y(()=>{"use strict";uK=kt(or(),1);at();ob="CAPABILITIES_FEATURE_MAPPING";dK={name:ob,run:C0e}});import{existsSync as D0e,readFileSync as N0e}from"node:fs";import{join as j0e}from"node:path";function M0e(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function F0e(t){let{cwd:e="."}=t;return pe(e,LI,r=>z0e(r,e))}function z0e(t,e){let r=bi(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=j0e(e,o);if(!D0e(s))continue;let a=N0e(s,"utf8");M0e(a)||n.push({detector:LI,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var LI,pK,mK=y(()=>{"use strict";qc();_t();LI="CONVENTION_DRIFT";pK={name:LI,run:F0e}});import{existsSync as UI,readFileSync as hK}from"node:fs";import{join as sb}from"node:path";function L0e(t){return JSON.parse(t).total?.lines?.pct??0}function gK(t){let e=/UI(sb(c.dir,d)));if(!l){s.push(c.path);continue}let u=gK(hK(sb(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:no,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=yK(n,i);return a0?[{detector:no,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function B0e(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let s=q0e(e,t.focusModules);if(s)return s}let r=bi(e),n=pt(e).language==="kotlin"?yI.find(s=>UI(sb(e,s)))??tW(e):r.coverageSummary,i=sb(e,n);if(!UI(i))return[{detector:no,severity:"info",message:`${n} not present \u2014 run stage_2.2 first`}];let o;try{let s=hK(i,"utf8");o=r.coverageFormat==="jacoco-xml"?U0e(s):L0e(s)}catch(s){return[{detector:no,severity:"warn",message:`${n} unparseable: ${s.message}`}]}return o===null?[{detector:no,severity:"warn",message:`${n} contained no line-coverage counter`}]:o>=ab?[]:[{detector:no,severity:"warn",message:`line coverage ${o.toFixed(1)}% < floor ${ab}%`}]}var no,ab,_K,bK=y(()=>{"use strict";G_();qc();B_();gn();no="COVERAGE_DROP",ab=70;_K={name:no,run:B0e}});import{existsSync as H0e}from"node:fs";import{join as Z0e}from"node:path";function G0e(t){let{cwd:e="."}=t;return pe(e,cb,r=>V0e(r,e))}function V0e(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?H0e(Z0e(e,r.path))?[]:[{detector:cb,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:cb,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var cb,vK,SK=y(()=>{"use strict";_t();cb="DELIVERABLE_INTEGRITY";vK={name:cb,run:G0e}});function W0e(t){let e=(t.features??[]).filter(i=>i.status==="done");return e.length===0?[]:!t.project?.deliverable?[]:(t.project?.smoke??[]).length>0?[]:[{detector:qI,severity:"warn",path:"spec.yaml",message:`${e.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function K0e(t){let{cwd:e="."}=t;return pe(e,qI,r=>W0e(r))}var qI,wK,xK=y(()=>{"use strict";_t();qI="SMOKE_PROBE_DEMAND";wK={name:qI,run:K0e}});function J0e(t){let{cwd:e="."}=t;return pe(e,lb,r=>Y0e(r,e))}function Y0e(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=vc(e);if(n===null)return[{detector:lb,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=n.get(o.id),a=jd(e,o.modules??[]);s!==a&&i.push({detector:lb,severity:"warn",path:"spec/attestation.yaml",message:s===void 0?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var lb,ub,BI=y(()=>{"use strict";Md();_t();lb="STALE_ATTESTATION";ub={name:lb,run:J0e}});function X0e(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}return Q0e(r)}function Q0e(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:$K,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var $K,db,HI=y(()=>{"use strict";at();$K="DEPENDENCY_CYCLE";db={name:$K,run:X0e}});import{appendFileSync as e$e,existsSync as kK,mkdirSync as t$e,readFileSync as r$e}from"node:fs";import{dirname as n$e,join as i$e}from"node:path";function EK(t){return i$e(t,o$e,s$e)}function AK(t){return ZI.add(t),()=>ZI.delete(t)}function la(t,e){let r=EK(t),n=n$e(r);kK(n)||t$e(n,{recursive:!0}),e$e(r,`${JSON.stringify(e)} -`,"utf8");for(let i of ZI)try{i(t,e)}catch{}}function _n(t){let e=EK(t);if(!kK(e))return[];let r=r$e(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var o$e,s$e,ZI,Hn=y(()=>{"use strict";o$e=".cladding",s$e="audit.log.jsonl";ZI=new Set});import{existsSync as a$e}from"node:fs";import{join as c$e}from"node:path";function l$e(t){let{cwd:e="."}=t,r=_n(e);if(r.length===0)return[{detector:GI,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(a$e(c$e(e,i.artifact))||n.push({detector:GI,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var GI,TK,OK=y(()=>{"use strict";Hn();GI="EVIDENCE_MISMATCH";TK={name:GI,run:l$e}});import{existsSync as u$e,readFileSync as d$e}from"node:fs";import{join as f$e}from"node:path";function p$e(t){let e=f$e(t,CK);if(!u$e(e))return null;try{let n=((0,RK.parse)(d$e(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*PK(t,e){for(let r of t??[])r.startsWith(IK)&&(yield{ref:r,name:r.slice(IK.length),field:e})}function m$e(t){let{cwd:e="."}=t,r=p$e(e);if(r===null)return[];let n;try{n=J(e)}catch(o){return[{detector:VI,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...PK(s.evidence_refs,"evidence_refs"),...PK(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:VI,severity:"warn",path:CK,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var RK,VI,IK,CK,DK,NK=y(()=>{"use strict";RK=kt(or(),1);at();VI="FIXTURE_REFERENCE_INVALID",IK="fixture:",CK="conformance/fixtures.yaml";DK={name:VI,run:m$e}});function h$e(t){let{cwd:e="."}=t,r=pt(e),n=r.gates.secret;if(!n)return[{detector:fb,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=et(n.cmd,[...n.args],{cwd:e,reject:!1});return af(i)?[{detector:fb,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:W_(i,fb,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var fb,pb,WI=y(()=>{"use strict";Ir();gn();yn();fb="HARDCODED_SECRET";pb={name:fb,run:h$e}});import{existsSync as Gc,readFileSync as KI}from"node:fs";import{join as ua}from"node:path";function g$e(t){return Vo(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec)\.ts$/.test(r)).length}function hf(t){if(!Gc(t))return null;try{return JSON.parse(KI(t,"utf8"))}catch{return null}}function y$e(t,e){let r=ua(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(KI(r,"utf8"))}catch(c){e.push({detector:io,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:io,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=g$e(t);s!==a&&e.push({detector:io,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function _$e(t,e){for(let r of jK){let n=ua(t,r.path);if(!Gc(n))continue;let i=hf(n);if(!i){e.push({detector:io,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:io,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function b$e(t,e){let r=hf(ua(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of jK){let s=ua(t,o.path);if(!Gc(s))continue;let a=hf(s);a?.version&&a.version!==n&&e.push({detector:io,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=ua(t,".claude-plugin","marketplace.json");if(Gc(i)){let o=hf(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:io,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function v$e(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function S$e(t,e){let r=ua(t,"src","cli","clad.ts"),n=ua(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Gc(r)||!Gc(n))return;let i=v$e(KI(r,"utf8"));if(i.length===0)return;let s=hf(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:io,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function w$e(t){let{cwd:e="."}=t,r=[];return y$e(e,r),S$e(e,r),_$e(e,r),b$e(e,r),r}var io,jK,MK,FK=y(()=>{"use strict";mf();io="HARNESS_INTEGRITY",jK=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];MK={name:io,run:w$e}});import{existsSync as x$e,readFileSync as $$e}from"node:fs";import{join as k$e}from"node:path";function A$e(t){let{cwd:e="."}=t;return pe(e,mb,r=>I$e(r,e))}function T$e(){return E$e}function O$e(t){let e=k$e(t,"spec/capabilities.yaml");if(!x$e(e))return!1;try{let r=zK.default.parse($$e(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function I$e(t,e){let r=t.features.length;if(r{"use strict";zK=kt(or(),1);_t();mb="HOLLOW_GOVERNANCE",E$e=8;LK={name:mb,run:A$e}});function P$e(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=[];return qK(r.features.map(i=>i.id),"feature","spec/features/",n),qK((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function qK(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:BK,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var BK,HK,ZK=y(()=>{"use strict";at();BK="ID_COLLISION";HK={name:BK,run:P$e}});import{existsSync as gf,readFileSync as JI,readdirSync as YI,statSync as R$e,writeFileSync as VK}from"node:fs";import{join as oo}from"node:path";function GK(t){if(!gf(t))return 0;try{return YI(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function C$e(t){if(!gf(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=YI(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=oo(n,o),a;try{a=R$e(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function D$e(t){let e=oo(t,"spec","capabilities.yaml");if(!gf(e))return 0;try{let r=hb.default.parse(JI(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function Wo(t="."){let e=GK(oo(t,"spec","features")),r=GK(oo(t,"spec","scenarios")),n=D$e(t),i=C$e(oo(t,"tests")),o=new Date().toISOString().slice(0,10);return{features:e,scenarios:r,capabilities:n,test_files:i,last_synced:o}}function Vc(t,e){let r=oo(t,"spec.yaml");if(!gf(r))return;let n=JI(r,"utf8"),i=N$e(n,e);i!==n&&VK(r,i)}function N$e(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as I_e}from"node:buffer";import{StringDecoder as P_e}from"node:string_decoder";var v_,R_e,C_e,D_e,gO=y(()=>{Vr();v_=(t,e,r)=>{if(r)return;if(t)return{transform:R_e.bind(void 0,new TextEncoder)};let n=new P_e(e);return{transform:C_e.bind(void 0,n),final:D_e.bind(void 0,n)}},R_e=function*(t,e){I_e.isBuffer(e)?yield Yi(e):typeof e=="string"?yield t.encode(e):yield e},C_e=function*(t,e){yield Ft(e)?t.write(e):e},D_e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as HG}from"node:util";var yO,S_,ZG,N_e,GG,j_e,VG=y(()=>{yO=HG(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),S_=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=j_e}=e[r];for await(let i of n(t))yield*S_(i,e,r+1)},ZG=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*N_e(r,Number(e),t)},N_e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*S_(n,r,e+1)},GG=HG(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),j_e=function*(t){yield t}});var _O,WG,oa,tf,M_e,F_e,bO=y(()=>{_O=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},WG=(t,e)=>[...e.flatMap(r=>[...oa(r,t,0)]),...tf(t)],oa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=F_e}=e[r];for(let i of n(t))yield*oa(i,e,r+1)},tf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*M_e(r,Number(e),t)},M_e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*oa(n,r,e+1)},F_e=function*(t){yield t}});import{Transform as z_e,getDefaultHighWaterMark as KG}from"node:stream";var vO,w_,JG,x_=y(()=>{hr();b_();BG();gO();VG();bO();vO=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=JG(t,s,o),l=ia(e),u=ia(r),d=l?yO.bind(void 0,S_,a):_O.bind(void 0,oa),f=l||u?yO.bind(void 0,ZG,a):_O.bind(void 0,tf),p=l||u?GG.bind(void 0,a):void 0;return{stream:new z_e({writableObjectMode:n,writableHighWaterMark:KG(n),readableObjectMode:i,readableHighWaterMark:KG(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},w_=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=JG(s,r,a);t=WG(c,t)}return t},JG=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:LG(n,a)},v_(r,s,n),__(r,o,n,c),{transform:t,final:e},{transform:UG(i,a)},zG({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var YG,L_e,U_e,q_e,B_e,XG=y(()=>{x_();Vr();hr();YG=(t,e)=>{for(let r of L_e(t))U_e(t,r,e)},L_e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),U_e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ho[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>q_e(a,n));r.input=zd(s)},q_e=(t,e)=>{let r=w_(t,e,"utf8",!0);return B_e(r),zd(r)},B_e=t=>{let e=t.find(r=>typeof r!="string"&&!Ft(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var $_,H_e,Z_e,QG,e9,G_e,t9,SO=y(()=>{ea();hr();Ac();Lo();$_=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Ec(r,n)&&!Wr.has(e)&&H_e(n)&&(t.some(({type:i,value:o})=>i==="native"&&Z_e.has(o))||t.every(({type:i})=>gn.has(i))),H_e=t=>t===1||t===2,Z_e=new Set(["pipe","overlapped"]),QG=async(t,e,r,n)=>{for await(let i of t)G_e(e)||t9(i,r,n)},e9=(t,e,r)=>{for(let n of t)t9(n,e,r)},G_e=t=>t._readableState.pipes.length>0,t9=(t,e,r)=>{let n=xy(t);mi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as V_e,appendFileSync as W_e}from"node:fs";var r9,K_e,J_e,Y_e,X_e,Q_e,n9=y(()=>{SO();x_();b_();Vr();hr();na();r9=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>K_e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},K_e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=UZ(t,o,d),p=Yi(f),{stdioItems:m,objectMode:h}=e[r],g=J_e([p],m,c,n),{serializedResult:b,finalResult:_=b}=Y_e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});X_e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&Q_e(b,m,i),S}catch(x){return n.error=x,S}},J_e=(t,e,r,n)=>{try{return w_(t,e,r,!1)}catch(i){return n.error=i,t}},Y_e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:zd(t)};let s=P6(t,r);return n[o]?{serializedResult:s,finalResult:hO(s,!i[o],e)}:{serializedResult:s}},X_e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!$_({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=hO(t,!1,s);try{e9(a,e,n)}catch(c){r.error??=c}},Q_e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>h_.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?W_e(n,t):(r.add(o),V_e(n,t))}}});var i9,o9=y(()=>{Vr();ef();i9=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ro(e,r,"all")]:Array.isArray(e)?[ro(t,r,"all"),...e]:Ft(t)&&Ft(e)?uT([t,e]):`${t}${e}`}});import{once as wO}from"node:events";var s9,ebe,a9,c9,tbe,xO,$O=y(()=>{Xs();s9=async(t,e)=>{let[r,n]=await ebe(t);return e.isForcefullyTerminated??=!1,[r,n]},ebe=async t=>{let[e,r]=await Promise.allSettled([wO(t,"spawn"),wO(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?a9(t):r.value},a9=async t=>{try{return await wO(t,"exit")}catch{return a9(t)}},c9=async t=>{let[e,r]=await t;if(!tbe(e,r)&&xO(e,r))throw new Un;return[e,r]},tbe=(t,e)=>t===void 0&&e===void 0,xO=(t,e)=>t!==0||e!==null});var l9,rbe,u9=y(()=>{Xs();na();$O();l9=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=rbe(t,e,r),s=o?.code==="ETIMEDOUT",a=LZ(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},rbe=(t,e,r)=>t!==void 0?t:xO(e,r)?new Un:void 0});import{spawnSync as nbe}from"node:child_process";var d9,ibe,obe,sbe,k_,abe,cbe,lbe,ube,f9=y(()=>{bT();VT();WT();Qd();f_();jG();ef();XG();n9();na();o9();u9();d9=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=ibe(t,e,r),d=abe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Fc(d,c,l)},ibe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Ey(t,e,r),a=obe(r),{file:c,commandArguments:l,options:u}=Qy(t,e,a);sbe(u);let d=DG(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},obe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,sbe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&k_("ipcInput"),t&&k_("ipc: true"),r&&k_("detached: true"),n&&k_("cancelSignal")},k_=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},abe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=cbe({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=l9(c,r),{output:m,error:h=l}=r9({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ro(_,r,S)),b=ro(i9(m,r),r,"all");return ube({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},cbe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{YG(o,r);let a=lbe(r);return nbe(...e_(t,e,a))}catch(a){return Mc({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},lbe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:u_(e)}),ube=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?d_({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Xd({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as kO,on as dbe}from"node:events";var p9,fbe,pbe,mbe,hbe,m9=y(()=>{Rc();Vd();Gd();p9=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Ic({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Gy(t)}),fbe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),fbe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{zy(e,i);let o=Bo(t,e,r),s=new AbortController;try{return await Promise.race([pbe(o,n,s),mbe(o,r,s),hbe(o,r,s)])}catch(a){throw Pc(t),a}finally{s.abort(),Ly(e,i)}},pbe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await kO(t,"message",{signal:r});return n}for await(let[n]of dbe(t,"message",{signal:r}))if(e(n))return n},mbe=async(t,e,{signal:r})=>{await kO(t,"disconnect",{signal:r}),kH(e)},hbe=async(t,e,{signal:r})=>{let[n]=await kO(t,"strict:error",{signal:r});throw Ny(n,e)}});import{once as g9,on as gbe}from"node:events";var y9,EO,ybe,_be,bbe,h9,AO=y(()=>{Rc();Vd();Gd();y9=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>EO({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),EO=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Ic({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Gy(t)}),zy(e,o);let s=Bo(t,e,r),a=new AbortController,c={};return ybe(t,s,a),_be({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),bbe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},ybe=async(t,e,r)=>{try{await g9(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},_be=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await g9(t,"strict:error",{signal:r.signal});n.error=Ny(i,e),r.abort()}catch{}},bbe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of gbe(r,"message",{signal:o.signal}))h9(s),yield c}catch{h9(s)}finally{o.abort(),Ly(e,a),n||Pc(t),i&&await t}},h9=({error:t})=>{if(t)throw t}});import _9 from"node:process";var b9,v9,S9,TO=y(()=>{Yy();m9();AO();Hy();b9=(t,{ipc:e})=>{Object.assign(t,S9(t,!1,e))},v9=()=>{let t=_9,e=!0,r=_9.channel!==void 0;return{...S9(t,e,r),getCancelSignal:QH.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},S9=(t,e,r)=>({sendMessage:Jy.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:p9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:y9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as vbe}from"node:child_process";import{PassThrough as Sbe,Readable as wbe,Writable as xbe,Duplex as $be}from"node:stream";var w9,kbe,rf,Ebe,Abe,Tbe,Obe,x9=y(()=>{y_();Qd();f_();w9=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{fO(n);let a=new vbe;kbe(a,n),Object.assign(a,{readable:Ebe,writable:Abe,duplex:Tbe});let c=Mc({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=Obe(c,s,i);return{subprocess:a,promise:l}},kbe=(t,e)=>{let r=rf(),n=rf(),i=rf(),o=Array.from({length:e.length-3},rf),s=rf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},rf=()=>{let t=new Sbe;return t.end(),t},Ebe=()=>new wbe({read(){}}),Abe=()=>new xbe({write(){}}),Tbe=()=>new $be({read(){},write(){}}),Obe=async(t,e,r)=>Fc(t,e,r)});import{createReadStream as $9,createWriteStream as k9}from"node:fs";import{Buffer as Ibe}from"node:buffer";import{Readable as nf,Writable as Pbe,Duplex as Rbe}from"node:stream";var A9,of,E9,Cbe,T9=y(()=>{x_();y_();hr();A9=(t,e)=>g_(Cbe,t,e,!1),of=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ho[t]}.`)},E9={fileNumber:of,generator:vO,asyncGenerator:vO,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Rbe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Cbe={input:{...E9,fileUrl:({value:t})=>({stream:$9(t)}),filePath:({value:{file:t}})=>({stream:$9(t)}),webStream:({value:t})=>({stream:nf.fromWeb(t)}),iterable:({value:t})=>({stream:nf.from(t)}),asyncIterable:({value:t})=>({stream:nf.from(t)}),string:({value:t})=>({stream:nf.from(t)}),uint8Array:({value:t})=>({stream:nf.from(Ibe.from(t))})},output:{...E9,fileUrl:({value:t})=>({stream:k9(t)}),filePath:({value:{file:t,append:e}})=>({stream:k9(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Pbe.fromWeb(t)}),iterable:of,asyncIterable:of,string:of,uint8Array:of}}});import{on as Dbe,once as O9}from"node:events";import{PassThrough as Nbe,getDefaultHighWaterMark as jbe}from"node:stream";import{finished as R9}from"node:stream/promises";function sa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)IO(i);let e=t.some(({readableObjectMode:i})=>i),r=Mbe(t,e),n=new OO({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Mbe,OO,Fbe,zbe,Lbe,IO,Ube,qbe,Bbe,Hbe,Zbe,C9,D9,PO,N9,Gbe,E_,I9,P9,A_=y(()=>{Mbe=(t,e)=>{if(t.length===0)return jbe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},OO=class extends Nbe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(IO(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Fbe(this,this.#t,this.#o);let r=Ube({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(IO(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},Fbe=async(t,e,r)=>{E_(t,I9);let n=new AbortController;try{await Promise.race([zbe(t,n),Lbe(t,e,r,n)])}finally{n.abort(),E_(t,-I9)}},zbe=async(t,{signal:e})=>{try{await R9(t,{signal:e,cleanup:!0})}catch(r){throw C9(t,r),r}},Lbe=async(t,e,r,{signal:n})=>{for await(let[i]of Dbe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},IO=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Ube=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{E_(t,P9);let a=new AbortController;try{await Promise.race([qbe(o,e,a),Bbe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Hbe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),E_(t,-P9)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?PO(t):Zbe(t))},qbe=async(t,e,{signal:r})=>{try{await t,r.aborted||PO(e)}catch(n){r.aborted||C9(e,n)}},Bbe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await R9(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;D9(s)?i.add(e):N9(t,s)}},Hbe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await O9(t,i,{signal:o}),!t.readable)return O9(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},Zbe=t=>{t.writable&&t.end()},C9=(t,e)=>{D9(e)?PO(t):N9(t,e)},D9=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",PO=t=>{(t.readable||t.writable)&&t.destroy()},N9=(t,e)=>{t.destroyed||(t.once("error",Gbe),t.destroy(e))},Gbe=()=>{},E_=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},I9=2,P9=1});import{finished as j9}from"node:stream/promises";var Lc,Vbe,RO,Wbe,CO,T_=y(()=>{Xi();Lc=(t,e)=>{t.pipe(e),Vbe(t,e),Wbe(t,e)},Vbe=async(t,e)=>{if(!(Ln(t)||Ln(e))){try{await j9(t,{cleanup:!0,readable:!0,writable:!1})}catch{}RO(e)}},RO=t=>{t.writable&&t.end()},Wbe=async(t,e)=>{if(!(Ln(t)||Ln(e))){try{await j9(e,{cleanup:!0,readable:!1,writable:!0})}catch{}CO(t)}},CO=t=>{t.readable&&t.destroy()}});var M9,Kbe,Jbe,Ybe,Xbe,Qbe,F9=y(()=>{A_();Xi();Fy();hr();T_();M9=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>gn.has(c)))Kbe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!gn.has(c)))Ybe({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:sa(o);Lc(s,i)}},Kbe=(t,e,r,n)=>{r==="output"?Lc(t.stdio[n],e):Lc(e,t.stdio[n]);let i=Jbe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Jbe=["stdin","stdout","stderr"],Ybe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Xbe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Xbe=(t,{signal:e})=>{Ln(t)&&Qs(t,Qbe,e)},Qbe=2});var aa,z9=y(()=>{aa=[];aa.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&aa.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&aa.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var O_,DO,NO,eve,jO,I_,tve,MO,FO,zO,L9,n7e,i7e,U9=y(()=>{z9();O_=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",DO=Symbol.for("signal-exit emitter"),NO=globalThis,eve=Object.defineProperty.bind(Object),jO=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(NO[DO])return NO[DO];eve(NO,DO,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},I_=class{},tve=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),MO=class extends I_{onExit(){return()=>{}}load(){}unload(){}},FO=class extends I_{#t=zO.platform==="win32"?"SIGINT":"SIGHUP";#r=new jO;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of aa)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!O_(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of aa)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,aa.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return O_(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&O_(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},zO=globalThis.process,{onExit:L9,load:n7e,unload:i7e}=tve(O_(zO)?new FO(zO):new MO)});import{addAbortListener as rve}from"node:events";var q9,B9=y(()=>{U9();q9=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=L9(()=>{t.kill()});rve(n,()=>{i()})}});var Z9,nve,ive,H9,ove,G9=y(()=>{lT();ky();qo();$c();Z9=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=$y(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=nve(r,n,i),{sourceStream:d,sourceError:f}=ove(t,l),{options:p,fileDescriptors:m}=gi.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},nve=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=ive(t,e,...r),a=My(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},ive=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(H9,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||aT(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=py(r,...n);return{destination:e(H9)(i,o,s),pipeOptions:s}}if(gi.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},H9=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),ove=(t,e)=>{try{return{sourceStream:Dc(t,e)}}catch(r){return{sourceError:r}}}});var W9,sve,LO,V9,UO=y(()=>{Qd();T_();W9=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=sve({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw LO({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},sve=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return CO(t),n;if(e!==void 0)return RO(r),e},LO=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Mc({error:t,command:V9,escapedCommand:V9,fileDescriptors:e,options:r,startTime:n,isSync:!1}),V9="source.pipe(destination)"});var K9,J9=y(()=>{K9=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as ave}from"node:stream/promises";var Y9,cve,lve,uve,P_,dve,fve,X9=y(()=>{A_();Fy();T_();Y9=(t,e,r)=>{let n=P_.has(e)?lve(t,e):cve(t,e);return Qs(t,dve,r.signal),Qs(e,fve,r.signal),uve(e),n},cve=(t,e)=>{let r=sa([t]);return Lc(r,e),P_.set(e,r),r},lve=(t,e)=>{let r=P_.get(e);return r.add(t),r},uve=async t=>{try{await ave(t,{cleanup:!0,readable:!1,writable:!0})}catch{}P_.delete(t)},P_=new WeakMap,dve=2,fve=1});import{aborted as pve}from"node:util";var Q9,mve,eV=y(()=>{UO();Q9=(t,e)=>t===void 0?[]:[mve(t,e)],mve=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await pve(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw LO({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var R_,hve,gve,tV=y(()=>{Ji();G9();UO();J9();X9();eV();R_=(t,...e)=>{if(Et(e[0]))return R_.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Z9(t,...e),i=hve({...n,destination:r});return i.pipe=R_.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},hve=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=gve(t,i);W9({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Y9(e,o,d);return await Promise.race([K9(u),...Q9(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},gve=(t,e)=>Promise.allSettled([t,e])});import{on as yve}from"node:events";import{getDefaultHighWaterMark as _ve}from"node:stream";var C_,bve,qO,vve,nV,BO,rV,Sve,wve,D_=y(()=>{gO();b_();bO();C_=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return bve(e,s),nV({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},bve=async(t,e)=>{try{await t}catch{}finally{e.abort()}},qO=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;vve(e,s,t);let a=t.readableObjectMode&&!o;return nV({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},vve=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},nV=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=yve(t,"data",{signal:e.signal,highWaterMark:rV,highWatermark:rV});return Sve({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},BO=_ve(!0),rV=BO,Sve=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=wve({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*oa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*tf(a)}},wve=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[v_(t,r,!e),__(t,i,!n,{})].filter(Boolean)});import{setImmediate as xve}from"node:timers/promises";var iV,$ve,kve,Eve,HO,oV,ZO=y(()=>{l_();Vr();SO();D_();na();ef();iV=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=$ve({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([kve(t),d]);return}let f=pO(c,r),p=qO({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Eve({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},$ve=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!$_({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=qO({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await QG(a,t,r,o)},kve=async t=>{await xve(),t.readableFlowing===null&&t.resume()},Eve=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await o_(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await s_(r,{maxBuffer:o})):await c_(r,{maxBuffer:o})}catch(a){return oV(MZ({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},HO=async t=>{try{return await t}catch(e){return oV(e)}},oV=({bufferedData:t})=>O6(t)?new Uint8Array(t):t});import{finished as Ave}from"node:stream/promises";var sf,Tve,Ove,Ive,Pve,Rve,GO,N_,sV,j_=y(()=>{sf=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Tve(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Ave(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Pve(a,e,r,n)}finally{s.abort()}},Tve=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Ove(t,r,n),n},Ove=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Ive(e,r),n.call(t,...i)}},Ive=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Pve=(t,e,r,n)=>{if(!Rve(t,e,r,n))throw t},Rve=(t,e,r,n=!0)=>r.propagating?sV(t)||N_(t):(r.propagating=!0,GO(r,e)===n?sV(t):N_(t)),GO=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",N_=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",sV=t=>t?.code==="EPIPE"});var aV,VO,WO=y(()=>{ZO();j_();aV=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>VO({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),VO=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=sf(t,e,l);if(GO(l,e)){await u;return}let[d]=await Promise.all([iV({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var cV,lV,Cve,Dve,KO=y(()=>{A_();WO();cV=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?sa([t,e].filter(Boolean)):void 0,lV=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>VO({...Cve(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Dve(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Cve=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},Dve=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var uV,dV,fV=y(()=>{Ac();Lo();uV=t=>Ec(t,"ipc"),dV=(t,e)=>{let r=xy(t);mi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var pV,mV,hV=y(()=>{na();fV();eo();AO();pV=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=uV(o),a=Qi(e,"ipc"),c=Qi(r,"ipc");for await(let l of EO({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(FZ(t,i,c),i.push(l)),s&&dV(l,o);return i},mV=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Nve}from"node:events";var gV,jve,Mve,Fve,yV=y(()=>{ra();qT();CT();UT();Xi();hr();ZO();hV();HT();KO();WO();$O();j_();gV=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=s9(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=aV({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=lV({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=pV({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),E=jve(h,t,S),C=Mve(m,S);try{return await Promise.race([Promise.all([{},c9(_),Promise.all(x),w,A,lZ(t,d),...E,...C]),g,Fve(t,b),...iZ(t,o,f,b),...$H({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...rZ({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all(x.map(L=>HO(L))),HO(w),mV(A,R),Promise.allSettled(E),Promise.allSettled(C)])}},jve=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:sf(n,i,r)),Mve=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Bn(o,{checkOpen:!1})&&!Ln(o)).map(({type:i,value:o,stream:s=o})=>sf(s,n,e,{isSameDirection:gn.has(i),stopOnExit:i==="native"}))),Fve=async(t,{signal:e})=>{let[r]=await Nve(t,"error",{signal:e});throw r}});var _V,af,Uc,M_=y(()=>{Cc();_V=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),af=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=hi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Uc=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as bV}from"node:stream/promises";var JO,vV,YO,XO,F_,z_,QO=y(()=>{j_();JO=async t=>{if(t!==void 0)try{await YO(t)}catch{}},vV=async t=>{if(t!==void 0)try{await XO(t)}catch{}},YO=async t=>{await bV(t,{cleanup:!0,readable:!1,writable:!0})},XO=async t=>{await bV(t,{cleanup:!0,readable:!0,writable:!1})},F_=async(t,e)=>{if(await t,e)throw e},z_=(t,e,r)=>{r&&!N_(r)?t.destroy(r):e&&t.destroy()}});import{Readable as zve}from"node:stream";import{callbackify as Lve}from"node:util";var SV,eI,tI,rI,Uve,nI,iI,wV,oI=y(()=>{ea();qo();D_();Cc();M_();QO();SV=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||Wr.has(r),{subprocessStdout:a,waitReadableDestroy:c}=eI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=tI(a,s),{read:f,onStdoutDataDone:p}=rI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new zve({read:f,destroy:Lve(iI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return nI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},eI=(t,e,r)=>{let n=Dc(t,e),i=af(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},tI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:BO},rI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=hi(),s=C_({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Uve(this,s,o)},onStdoutDataDone:o}},Uve=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},nI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await XO(t),await n,await JO(i),await e,r.readable&&r.push(null)}catch(o){await JO(i),wV(r,o)}},iI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Uc(r,e)&&(wV(t,n),await F_(e,n))},wV=(t,e)=>{z_(t,t.readable,e)}});import{Writable as qve}from"node:stream";import{callbackify as xV}from"node:util";var $V,sI,aI,Bve,Hve,cI,lI,kV,uI=y(()=>{qo();M_();QO();$V=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=sI(t,r,e),s=new qve({...aI(n,t,i),destroy:xV(lI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return cI(n,s),s},sI=(t,e,r)=>{let n=My(t,e),i=af(r,n,"writableFinal"),o=af(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},aI=(t,e,r)=>({write:Bve.bind(void 0,t),final:xV(Hve.bind(void 0,t,e,r))}),Bve=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Hve=async(t,e,r)=>{await Uc(r,e)&&(t.writable&&t.end(),await e)},cI=async(t,e,r)=>{try{await YO(t),e.writable&&e.end()}catch(n){await vV(r),kV(e,n)}},lI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Uc(r,e),await Uc(n,e)&&(kV(t,i),await F_(e,i))},kV=(t,e)=>{z_(t,t.writable,e)}});import{Duplex as Zve}from"node:stream";import{callbackify as Gve}from"node:util";var EV,Vve,AV=y(()=>{ea();oI();uI();EV=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||Wr.has(r),{subprocessStdout:c,waitReadableDestroy:l}=eI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=sI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=tI(c,a),{read:g,onStdoutDataDone:b}=rI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new Zve({read:g,...aI(u,t,d),destroy:Gve(Vve.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return nI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),cI(u,_,c),_},Vve=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([iI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),lI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var dI,Wve,TV=y(()=>{ea();qo();D_();dI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||Wr.has(e),s=Dc(t,r),a=C_({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Wve(a,s,t)},Wve=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var OV,IV=y(()=>{M_();oI();uI();AV();TV();OV=(t,{encoding:e})=>{let r=_V();t.readable=SV.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=$V.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=EV.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=dI.bind(void 0,t,e),t[Symbol.asyncIterator]=dI.bind(void 0,t,e,{})}});var PV,Kve,Jve,RV=y(()=>{PV=(t,e)=>{for(let[r,n]of Jve){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Kve=(async()=>{})().constructor.prototype,Jve=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Kve,t)])});import{setMaxListeners as Yve}from"node:events";import{spawn as Xve}from"node:child_process";var CV,Qve,eSe,tSe,rSe,nSe,DV=y(()=>{l_();bT();VT();qo();WT();TO();Qd();f_();x9();T9();ef();F9();Cy();B9();tV();KO();yV();IV();Cc();RV();CV=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Qve(t,e,r),{subprocess:f,promise:p}=tSe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=R_.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),PV(f,p),gi.set(f,{options:u,fileDescriptors:d}),f},Qve=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Ey(t,e,r),{file:a,commandArguments:c,options:l}=Qy(t,e,r),u=eSe(l),d=A9(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},eSe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},tSe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Xve(...e_(t,e,r))}catch(m){return w9({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Yve(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];M9(c,a,l),q9(c,r,l);let d={},f=hi();c.kill=wH.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=cV(c,r),OV(c,r),b9(c,r);let p=rSe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},rSe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await gV({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>ro(x,e,w)),_=ro(h,e,"all"),S=nSe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Fc(S,n,e)},nSe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Xd({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof yi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):d_({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var L_,iSe,oSe,NV=y(()=>{Ji();eo();L_=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,iSe(n,t[n],i)]));return{...t,...r}},iSe=(t,e,r)=>oSe.has(t)&&Et(e)&&Et(r)?{...e,...r}:r,oSe=new Set(["env",...mT])});var Zo,sSe,aSe,jV=y(()=>{Ji();lT();M6();f9();DV();NV();Zo=(t,e,r,n)=>{let i=(s,a,c)=>Zo(s,a,r,c),o=(...s)=>sSe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},sSe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Et(o))return i(t,L_(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=aSe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?d9(a,c,l):CV(a,c,l,i)},aSe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=N6(e)?j6(e,r):[e,...r],[s,a,c]=py(...o),l=L_(L_(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var MV,FV,zV,cSe,lSe,LV=y(()=>{MV=({file:t,commandArguments:e})=>zV(t,e),FV=({file:t,commandArguments:e})=>({...zV(t,e),isSync:!0}),zV=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=cSe(t);return{file:r,commandArguments:n}},cSe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(lSe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},lSe=/ +/g});var UV,qV,uSe,BV,dSe,HV,ZV=y(()=>{UV=(t,e,r)=>{t.sync=e(uSe,r),t.s=t.sync},qV=({options:t})=>BV(t),uSe=({options:t})=>({...BV(t),isSync:!0}),BV=t=>({options:{...dSe(t),...t}}),dSe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},HV={preferLocal:!0}});var Ket,et,Jet,Yet,Xet,Qet,ett,ttt,rtt,ntt,Ir=y(()=>{jV();LV();BT();ZV();TO();Ket=Zo(()=>({})),et=Zo(()=>({isSync:!0})),Jet=Zo(MV),Yet=Zo(FV),Xet=Zo(sZ),Qet=Zo(qV,{},HV,UV),{sendMessage:ett,getOneMessage:ttt,getEachMessage:rtt,getCancelSignal:ntt}=v9()});import{existsSync as U_,statSync as fSe}from"node:fs";import{dirname as fI,extname as pSe,isAbsolute as GV,join as pI,relative as mI,resolve as q_,sep as mSe}from"node:path";function B_(t){return t==="./gradlew"||t==="gradle"}function hSe(t){return(U_(pI(t,"build.gradle.kts"))||U_(pI(t,"build.gradle")))&&U_(pI(t,"gradle.properties"))}function gSe(t,e){let n=mI(t,e).split(mSe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function Go(t,e){return t===":"?`:${e}`:`${t}:${e}`}function ySe(t,e){let r=q_(t,e),n=r;U_(r)?fSe(r).isFile()&&(n=fI(r)):pSe(r)!==""&&(n=fI(r));let i=mI(t,n);if(i.startsWith("..")||GV(i))return null;let o=n;for(;;){if(hSe(o))return o;if(q_(o)===q_(t))return null;let s=fI(o);if(s===o)return null;let a=mI(t,s);if(a.startsWith("..")||GV(a))return null;o=s}}function H_(t,e){let r=q_(t),n=new Map,i=[];for(let o of e){let s=ySe(r,o);if(!s){i.push(o);continue}let a=gSe(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Z_=y(()=>{"use strict"});import{existsSync as _Se,readFileSync as bSe}from"node:fs";import{join as vSe}from"node:path";function qc(t="."){let e=vSe(t,".cladding","config.yaml");if(!_Se(e))return hI;try{let n=(0,VV.parse)(bSe(e,"utf8"))?.gate;if(!n)return hI;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of SSe){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return hI}}function WV(t,e){let r=[],n=!1;for(let i of t){let o=wSe.exec(i);if(o){n=!0;for(let s of e)r.push(Go(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var VV,SSe,hI,wSe,G_=y(()=>{"use strict";VV=kt(or(),1);Z_();SSe=["type","lint","test","coverage"],hI={scope:"feature"};wSe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as yI,readFileSync as KV,readdirSync as xSe,statSync as $Se}from"node:fs";import{join as V_}from"node:path";function vI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=V_(t,e);if(yI(r))try{if(JV.test(KV(r,"utf8")))return!0}catch{}}return!1}function YV(t){try{return yI(t)&&JV.test(KV(t,"utf8"))}catch{return!1}}function XV(t,e=0){if(e>4||!yI(t))return!1;let r;try{r=xSe(t)}catch{return!1}for(let n of r){let i=V_(t,n),o=!1;try{o=$Se(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(XV(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&YV(i))return!0}return!1}function ASe(t){if(vI(t))return!0;for(let e of kSe)if(YV(V_(t,e)))return!0;for(let e of ESe)if(XV(V_(t,e)))return!0;return!1}function QV(t="."){let e=qc(t).coverage;return e||(ASe(t)?"kover":"jacoco")}function eW(t="."){return _I[QV(t)]}function tW(t="."){return gI[QV(t)]}var _I,gI,bI,JV,kSe,ESe,W_=y(()=>{"use strict";G_();_I={kover:"koverXmlReport",jacoco:"jacocoTestReport"},gI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},bI=[gI.kover,gI.jacoco],JV=/kover/i;kSe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],ESe=["buildSrc","build-logic"]});import{existsSync as SI,readdirSync as rW}from"node:fs";import{join as K_}from"node:path";function wI(t){return SI(K_(t,"gradlew"))?"./gradlew":"gradle"}function TSe(t){let e=wI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[eW(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function ISe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function CSe(t,e){for(let r of e)if(SI(K_(t,r)))return r}function DSe(t,e){try{return rW(t).find(n=>n.endsWith(e))}catch{return}}function jSe(t,e){for(let r of NSe)if(r.configs.some(n=>SI(K_(t,n))))return r.gate;return e}function pt(t="."){for(let e of PSe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=DSe(t,o):r=CSe(t,[o]),r)break;if(!r||e.requiresSource&&!ISe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"&&n.lint?{...n,lint:jSe(t,n.lint)}:n;return{language:e.language,manifest:r,gates:i}}return RSe}var OSe,PSe,RSe,NSe,yn=y(()=>{"use strict";W_();OSe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);PSe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","madge","--circular","--extensions","ts","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:TSe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}],RSe={language:"unknown",manifest:"",gates:{}};NSe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}]});import{existsSync as MSe,readFileSync as FSe}from"node:fs";import{join as zSe}from"node:path";function cf(t){return t.code==="ENOENT"}function J_(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return nW.test(o)||nW.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function zt(t,e,r){return cf(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function sr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Bc(t,e){let r=zSe(t,"package.json");if(!MSe(r))return!1;try{return!!JSON.parse(FSe(r,"utf8")).scripts?.[e]}catch{return!1}}var nW,_n=y(()=>{"use strict";nW=/config (is |file )?not found|no such file|ENOENT|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function LSe(t){let{cwd:e="."}=t,r=pt(e),n=r.gates.arch;if(!n)return[{detector:Y_,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=et(n.cmd,[...n.args],{cwd:e,reject:!1});return cf(i)?[{detector:Y_,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:J_(i,Y_,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Y_,X_,xI=y(()=>{"use strict";Ir();yn();_n();Y_="ARCHITECTURE_VIOLATION";X_={name:Y_,run:LSe}});import iW from"node:process";function ca(t={}){let r=X_.run(t).filter(o=>o.severity==="error"),n=r.length===0,i={stage:USe,pass:n,exitCode:n?0:1};return n?i:{...i,stderr:r.map(o=>o.message).join(` +`)}}var USe,qSe,Q_=y(()=>{"use strict";xI();USe="stage_1.5";qSe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${iW.argv[1]}`;if(qSe){let t=ca();console.log(JSON.stringify(t)),iW.exit(t.exitCode)}});import{existsSync as $I,readdirSync as oW}from"node:fs";import{join as eb}from"node:path";function HSe(t,e){let r=eb(t,e.path);if(!$I(r))return!0;if(e.isDirectory)try{return oW(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function ZSe(t){let{cwd:e="."}=t,r=[];for(let i of BSe)HSe(e,i)&&r.push({detector:lf,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=eb(e,"spec.yaml");if($I(n)){let i=WSe(n),o=i?null:GSe(e);if(i)r.push({detector:lf,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:lf,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=VSe(e);s&&r.push({detector:lf,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function GSe(t){for(let e of["spec/features","spec/scenarios"]){let r=eb(t,e);if(!$I(r))continue;let n;try{n=oW(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{di(eb(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function VSe(t){try{return Y(t),null}catch(e){return e.message}}function WSe(t){let e;try{e=di(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var lf,BSe,sW,aW=y(()=>{"use strict";at();cy();lf="ABSENCE_OF_GOVERNANCE",BSe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];sW={name:lf,run:ZSe}});function tb(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function kI(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=tb(r)==="while",o=JSe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${tb(r)}'`}let n=KSe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:tb(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${tb(r)}'`:null}function YSe(t,e){let r=kI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function cW(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...YSe(r,n));return e}var KSe,JSe,EI=y(()=>{"use strict";KSe={event:"when",state:"while",optional:"where",unwanted:"if"},JSe=/\bwhen\b/i});function pe(t,e,r){let n;try{n=Y(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var _t=y(()=>{"use strict";at()});function XSe(t){let{cwd:e="."}=t;return pe(e,rb,QSe)}function QSe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:rb,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of cW(t.features))e.push({detector:rb,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var rb,lW,uW=y(()=>{"use strict";EI();_t();rb="AC_DRIFT";lW={name:rb,run:XSe}});function bi(t=".",e){let n=(e??"").trim().toLowerCase()||pt(t).language;return nwe[n]??dW}var ewe,twe,dW,rwe,nwe,Hc=y(()=>{"use strict";yn();ewe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,twe=/^[ \t]*import\s+([\w.]+)/gm,dW={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:ewe,importStyle:"relative"},rwe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:twe,importStyle:"dotted"},nwe={typescript:dW,kotlin:rwe}});import{existsSync as iwe,readFileSync as owe,readdirSync as swe,statSync as awe}from"node:fs";import{join as pW,relative as fW}from"node:path";function cwe(t,e){if(!iwe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=swe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=pW(i,s),c;try{c=awe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function lwe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function dwe(t){return uwe.test(t)}function fwe(t){let{cwd:e="."}=t,r;try{r=Y(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=bi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>cwe(pW(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=owe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";at();Hc();mW="AI_HINTS_FORBIDDEN_PATTERN";uwe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;hW={name:mW,run:fwe}});function pwe(t){let{cwd:e="."}=t,r;try{r=Y(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:yW,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var yW,_W,bW=y(()=>{"use strict";at();yW="AC_DUPLICATE_WITHIN_FEATURE";_W={name:yW,run:pwe}});import{createRequire as mwe}from"module";import{basename as hwe,dirname as TI,normalize as gwe,relative as ywe,resolve as _we,sep as wW}from"path";import*as bwe from"fs";function vwe(t){let e=gwe(t);return e.length>1&&e[e.length-1]===wW&&(e=e.substring(0,e.length-1)),e}function xW(t,e){return t.replace(Swe,e)}function xwe(t){return t==="/"||wwe.test(t)}function AI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=_we(t)),(n||o)&&(t=vwe(t)),t===".")return"";let s=t[t.length-1]!==i;return xW(s?t+i:t,i)}function $W(t,e){return e+t}function $we(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:xW(ywe(t,n),e.pathSeparator)+e.pathSeparator+r}}function kwe(t){return t}function Ewe(t,e,r){return e+t+r}function Awe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?$we(t,e):n?$W:kwe}function Twe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function Owe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function Cwe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?Owe(t):Twe(t):n&&n.length?Pwe:Iwe:Rwe}function zwe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?Fwe:r&&r.length?n?Dwe:Nwe:n?jwe:Mwe}function qwe(t){return t.group?Uwe:Lwe}function Zwe(t){return t.group?Bwe:Hwe}function Wwe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Vwe:Gwe}function kW(t,e,r){if(r.options.useRealPaths)return Kwe(e,r);let n=TI(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=TI(n)}return r.symlinks.set(t,e),i>1}function Kwe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function nb(t,e,r,n){e(t&&!n?t:null,r)}function ixe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?Jwe:exe:n?e?Ywe:nxe:i?e?Qwe:rxe:e?Xwe:txe}function axe(t){return t?sxe:oxe}function dxe(t,e){return new Promise((r,n)=>{TW(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function TW(t,e,r){new AW(t,e,r).start()}function fxe(t,e){return new AW(t,e).start()}var vW,Swe,wwe,Iwe,Pwe,Rwe,Dwe,Nwe,jwe,Mwe,Fwe,Lwe,Uwe,Bwe,Hwe,Gwe,Vwe,Jwe,Ywe,Xwe,Qwe,exe,txe,rxe,nxe,EW,oxe,sxe,cxe,lxe,uxe,AW,SW,OW,IW,PW=y(()=>{vW=mwe(import.meta.url);Swe=/[\\/]/g;wwe=/^[a-z]:[\\/]$/i;Iwe=(t,e)=>{e.push(t||".")},Pwe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},Rwe=()=>{};Dwe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},Nwe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},jwe=(t,e,r,n)=>{r.files++},Mwe=(t,e)=>{e.push(t)},Fwe=()=>{};Lwe=t=>t,Uwe=()=>[""].slice(0,0);Bwe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},Hwe=()=>{};Gwe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&kW(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},Vwe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&kW(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};Jwe=t=>t.counts,Ywe=t=>t.groups,Xwe=t=>t.paths,Qwe=t=>t.paths.slice(0,t.options.maxFiles),exe=(t,e,r)=>(nb(e,r,t.counts,t.options.suppressErrors),null),txe=(t,e,r)=>(nb(e,r,t.paths,t.options.suppressErrors),null),rxe=(t,e,r)=>(nb(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),nxe=(t,e,r)=>(nb(e,r,t.groups,t.options.suppressErrors),null);EW={withFileTypes:!0},oxe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",EW,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},sxe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",EW)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};cxe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},lxe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},uxe=class{aborted=!1;abort(){this.aborted=!0}},AW=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=ixe(e,this.isSynchronous),this.root=AI(t,e),this.state={root:xwe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new lxe,options:e,queue:new cxe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new uxe,fs:e.fs||bwe},this.joinPath=Awe(this.root,e),this.pushDirectory=Cwe(this.root,e),this.pushFile=zwe(e),this.getArray=qwe(e),this.groupFiles=Zwe(e),this.resolveSymlink=Wwe(e,this.isSynchronous),this.walkDirectory=axe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=AI(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=hwe(_),x=AI(TI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};SW=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return dxe(this.root,this.options)}withCallback(t){TW(this.root,this.options,t)}sync(){return fxe(this.root,this.options)}},OW=null;try{vW.resolve("picomatch"),OW=vW("picomatch")}catch{}IW=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:wW,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new SW(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new SW(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||OW;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var uf=v((ort,jW)=>{"use strict";var RW="[^\\\\/]",pxe="(?=.)",CW="[^/]",OI="(?:\\/|$)",DW="(?:^|\\/)",II=`\\.{1,2}${OI}`,mxe="(?!\\.)",hxe=`(?!${DW}${II})`,gxe=`(?!\\.{0,1}${OI})`,yxe=`(?!${II})`,_xe="[^.\\/]",bxe=`${CW}*?`,vxe="/",NW={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:pxe,QMARK:CW,END_ANCHOR:OI,DOTS_SLASH:II,NO_DOT:mxe,NO_DOTS:hxe,NO_DOT_SLASH:gxe,NO_DOTS_SLASH:yxe,QMARK_NO_DOT:_xe,STAR:bxe,START_ANCHOR:DW,SEP:vxe},Sxe={...NW,SLASH_LITERAL:"[\\\\/]",QMARK:RW,STAR:`${RW}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},wxe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};jW.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:wxe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Sxe:NW}}});var df=v(Pr=>{"use strict";var{REGEX_BACKSLASH:xxe,REGEX_REMOVE_BACKSLASH:$xe,REGEX_SPECIAL_CHARS:kxe,REGEX_SPECIAL_CHARS_GLOBAL:Exe}=uf();Pr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Pr.hasRegexChars=t=>kxe.test(t);Pr.isRegexChar=t=>t.length===1&&Pr.hasRegexChars(t);Pr.escapeRegex=t=>t.replace(Exe,"\\$1");Pr.toPosixSlashes=t=>t.replace(xxe,"/");Pr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Pr.removeBackslashes=t=>t.replace($xe,e=>e==="\\"?"":e);Pr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Pr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Pr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Pr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Pr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var HW=v((art,BW)=>{"use strict";var MW=df(),{CHAR_ASTERISK:PI,CHAR_AT:Axe,CHAR_BACKWARD_SLASH:ff,CHAR_COMMA:Txe,CHAR_DOT:RI,CHAR_EXCLAMATION_MARK:CI,CHAR_FORWARD_SLASH:qW,CHAR_LEFT_CURLY_BRACE:DI,CHAR_LEFT_PARENTHESES:NI,CHAR_LEFT_SQUARE_BRACKET:Oxe,CHAR_PLUS:Ixe,CHAR_QUESTION_MARK:FW,CHAR_RIGHT_CURLY_BRACE:Pxe,CHAR_RIGHT_PARENTHESES:zW,CHAR_RIGHT_SQUARE_BRACKET:Rxe}=uf(),LW=t=>t===qW||t===ff,UW=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Cxe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,R=0,A,E,C={value:"",depth:0,isGlob:!1},k=()=>l>=n,L=()=>c.charCodeAt(l+1),te=()=>(A=E,c.charCodeAt(++l));for(;l0&&(O=c.slice(0,u),c=c.slice(u),d-=u),be&&m===!0&&d>0?(be=c.slice(0,d),P=c.slice(d)):m===!0?(be="",P=c):be=c,be&&be!==""&&be!=="/"&&be!==c&&LW(be.charCodeAt(be.length-1))&&(be=be.slice(0,-1)),r.unescape===!0&&(P&&(P=MW.removeBackslashes(P)),be&&_===!0&&(be=MW.removeBackslashes(be)));let $t={prefix:O,input:t,start:u,base:be,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&($t.maxDepth=0,LW(E)||s.push(C),$t.tokens=s),r.parts===!0||r.tokens===!0){let je;for(let Me=0;Me{"use strict";var pf=uf(),Kr=df(),{MAX_LENGTH:ib,POSIX_REGEX_SOURCE:Dxe,REGEX_NON_SPECIAL_CHARS:Nxe,REGEX_SPECIAL_CHARS_BACKREF:jxe,REPLACEMENTS:ZW}=pf,Mxe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Kr.escapeRegex(i)).join("..")}return r},Zc=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,GW=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},Fxe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},VW=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(Fxe(e))return e.replace(/\\(.)/g,"$1")},zxe=t=>{let e=t.map(VW).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},Lxe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=VW(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Kr.escapeRegex(r[0]):`[${r.map(i=>Kr.escapeRegex(i)).join("")}]`}*`},Uxe=t=>{let e=0,r=t.trim(),n=jI(r);for(;n;)e++,r=n.body.trim(),n=jI(r);return e},qxe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:pf.DEFAULT_MAX_EXTGLOB_RECURSION,n=GW(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||zxe(n)))return{risky:!0};for(let i of n){let o=Lxe(i);if(o)return{risky:!0,safeOutput:o};if(Uxe(i)>r)return{risky:!0}}return{risky:!1}},MI=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=ZW[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(ib,r.maxLength):ib,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=pf.globChars(r.windows),l=pf.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,R=q=>`(${a}(?:(?!${w}${q.dot?m:u}).)*?)`,A=r.dot?"":h,E=r.dot?_:S,C=r.bash===!0?R(r):x;r.capture&&(C=`(${C})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=Kr.removePrefix(t,k),i=t.length;let L=[],te=[],be=[],O=o,P,$t=()=>k.index===i-1,je=k.peek=(q=1)=>t[k.index+q],Me=k.advance=()=>t[++k.index]||"",Kt=()=>t.slice(k.index+1),Gt=(q="",ut=0)=>{k.consumed+=q,k.index+=ut},Br=q=>{k.output+=q.output!=null?q.output:q.value,Gt(q.value)},jn=()=>{let q=1;for(;je()==="!"&&(je(2)!=="("||je(3)==="?");)Me(),k.start++,q++;return q%2===0?!1:(k.negated=!0,k.start++,!0)},Bi=q=>{k[q]++,be.push(q)},ko=q=>{k[q]--,be.pop()},Ee=q=>{if(O.type==="globstar"){let ut=k.braces>0&&(q.type==="comma"||q.type==="brace"),U=q.extglob===!0||L.length&&(q.type==="pipe"||q.type==="paren");q.type!=="slash"&&q.type!=="paren"&&!ut&&!U&&(k.output=k.output.slice(0,-O.output.length),O.type="star",O.value="*",O.output=C,k.output+=O.output)}if(L.length&&q.type!=="paren"&&(L[L.length-1].inner+=q.value),(q.value||q.output)&&Br(q),O&&O.type==="text"&&q.type==="text"){O.output=(O.output||O.value)+q.value,O.value+=q.value;return}q.prev=O,s.push(q),O=q},Yh=(q,ut)=>{let U={...l[ut],conditions:1,inner:""};U.prev=O,U.parens=k.parens,U.output=k.output,U.startIndex=k.index,U.tokensIndex=s.length;let Ae=(r.capture?"(":"")+U.open;Bi("parens"),Ee({type:q,value:ut,output:k.output?"":p}),Ee({type:"paren",extglob:!0,value:Me(),output:Ae}),L.push(U)},Rae=q=>{let ut=t.slice(q.startIndex,k.index+1),U=t.slice(q.startIndex+2,k.index),Ae=qxe(U,r);if((q.type==="plus"||q.type==="star")&&Ae.risky){let ot=Ae.safeOutput?(q.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,ai=s[q.tokensIndex];ai.type="text",ai.value=ut,ai.output=ot||Kr.escapeRegex(ut);for(let ci=q.tokensIndex+1;ci1&&q.inner.includes("/")&&(ot=R(r)),(ot!==C||$t()||/^\)+$/.test(Kt()))&&(st=q.close=`)$))${ot}`),q.inner.includes("*")&&(jt=Kt())&&/^\.[^\\/.]+$/.test(jt)){let ai=MI(jt,{...e,fastpaths:!1}).output;st=q.close=`)${ai})${ot})`}q.prev.type==="bos"&&(k.negatedExtglob=!0)}Ee({type:"paren",extglob:!0,value:P,output:st}),ko("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let q=!1,ut=t.replace(jxe,(U,Ae,st,jt,ot,ai)=>jt==="\\"?(q=!0,U):jt==="?"?Ae?Ae+jt+(ot?_.repeat(ot.length):""):ai===0?E+(ot?_.repeat(ot.length):""):_.repeat(st.length):jt==="."?u.repeat(st.length):jt==="*"?Ae?Ae+jt+(ot?C:""):C:Ae?U:`\\${U}`);return q===!0&&(r.unescape===!0?ut=ut.replace(/\\/g,""):ut=ut.replace(/\\+/g,U=>U.length%2===0?"\\\\":U?"\\":"")),ut===t&&r.contains===!0?(k.output=t,k):(k.output=Kr.wrapOutput(ut,k,e),k)}for(;!$t();){if(P=Me(),P==="\0")continue;if(P==="\\"){let U=je();if(U==="/"&&r.bash!==!0||U==="."||U===";")continue;if(!U){P+="\\",Ee({type:"text",value:P});continue}let Ae=/^\\+/.exec(Kt()),st=0;if(Ae&&Ae[0].length>2&&(st=Ae[0].length,k.index+=st,st%2!==0&&(P+="\\")),r.unescape===!0?P=Me():P+=Me(),k.brackets===0){Ee({type:"text",value:P});continue}}if(k.brackets>0&&(P!=="]"||O.value==="["||O.value==="[^")){if(r.posix!==!1&&P===":"){let U=O.value.slice(1);if(U.includes("[")&&(O.posix=!0,U.includes(":"))){let Ae=O.value.lastIndexOf("["),st=O.value.slice(0,Ae),jt=O.value.slice(Ae+2),ot=Dxe[jt];if(ot){O.value=st+ot,k.backtrack=!0,Me(),!o.output&&s.indexOf(O)===1&&(o.output=p);continue}}}(P==="["&&je()!==":"||P==="-"&&je()==="]")&&(P=`\\${P}`),P==="]"&&(O.value==="["||O.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&O.value==="["&&(P="^"),O.value+=P,Br({value:P});continue}if(k.quotes===1&&P!=='"'){P=Kr.escapeRegex(P),O.value+=P,Br({value:P});continue}if(P==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&Ee({type:"text",value:P});continue}if(P==="("){Bi("parens"),Ee({type:"paren",value:P});continue}if(P===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Zc("opening","("));let U=L[L.length-1];if(U&&k.parens===U.parens+1){Rae(L.pop());continue}Ee({type:"paren",value:P,output:k.parens?")":"\\)"}),ko("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Zc("closing","]"));P=`\\${P}`}else Bi("brackets");Ee({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||O&&O.type==="bracket"&&O.value.length===1){Ee({type:"text",value:P,output:`\\${P}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Zc("opening","["));Ee({type:"text",value:P,output:`\\${P}`});continue}ko("brackets");let U=O.value.slice(1);if(O.posix!==!0&&U[0]==="^"&&!U.includes("/")&&(P=`/${P}`),O.value+=P,Br({value:P}),r.literalBrackets===!1||Kr.hasRegexChars(U))continue;let Ae=Kr.escapeRegex(O.value);if(k.output=k.output.slice(0,-O.value.length),r.literalBrackets===!0){k.output+=Ae,O.value=Ae;continue}O.value=`(${a}${Ae}|${O.value})`,k.output+=O.value;continue}if(P==="{"&&r.nobrace!==!0){Bi("braces");let U={type:"brace",value:P,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};te.push(U),Ee(U);continue}if(P==="}"){let U=te[te.length-1];if(r.nobrace===!0||!U){Ee({type:"text",value:P,output:P});continue}let Ae=")";if(U.dots===!0){let st=s.slice(),jt=[];for(let ot=st.length-1;ot>=0&&(s.pop(),st[ot].type!=="brace");ot--)st[ot].type!=="dots"&&jt.unshift(st[ot].value);Ae=Mxe(jt,r),k.backtrack=!0}if(U.comma!==!0&&U.dots!==!0){let st=k.output.slice(0,U.outputIndex),jt=k.tokens.slice(U.tokensIndex);U.value=U.output="\\{",P=Ae="\\}",k.output=st;for(let ot of jt)k.output+=ot.output||ot.value}Ee({type:"brace",value:P,output:Ae}),ko("braces"),te.pop();continue}if(P==="|"){L.length>0&&L[L.length-1].conditions++,Ee({type:"text",value:P});continue}if(P===","){let U=P,Ae=te[te.length-1];Ae&&be[be.length-1]==="braces"&&(Ae.comma=!0,U="|"),Ee({type:"comma",value:P,output:U});continue}if(P==="/"){if(O.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),O=o;continue}Ee({type:"slash",value:P,output:f});continue}if(P==="."){if(k.braces>0&&O.type==="dot"){O.value==="."&&(O.output=u);let U=te[te.length-1];O.type="dots",O.output+=P,O.value+=P,U.dots=!0;continue}if(k.braces+k.parens===0&&O.type!=="bos"&&O.type!=="slash"){Ee({type:"text",value:P,output:u});continue}Ee({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(O&&O.value==="(")&&r.noextglob!==!0&&je()==="("&&je(2)!=="?"){Yh("qmark",P);continue}if(O&&O.type==="paren"){let Ae=je(),st=P;(O.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(st=`\\${P}`),Ee({type:"text",value:P,output:st});continue}if(r.dot!==!0&&(O.type==="slash"||O.type==="bos")){Ee({type:"qmark",value:P,output:S});continue}Ee({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&je()==="("&&(je(2)!=="?"||!/[!=<:]/.test(je(3)))){Yh("negate",P);continue}if(r.nonegate!==!0&&k.index===0){jn();continue}}if(P==="+"){if(r.noextglob!==!0&&je()==="("&&je(2)!=="?"){Yh("plus",P);continue}if(O&&O.value==="("||r.regex===!1){Ee({type:"plus",value:P,output:d});continue}if(O&&(O.type==="bracket"||O.type==="paren"||O.type==="brace")||k.parens>0){Ee({type:"plus",value:P});continue}Ee({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&je()==="("&&je(2)!=="?"){Ee({type:"at",extglob:!0,value:P,output:""});continue}Ee({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let U=Nxe.exec(Kt());U&&(P+=U[0],k.index+=U[0].length),Ee({type:"text",value:P});continue}if(O&&(O.type==="globstar"||O.star===!0)){O.type="star",O.star=!0,O.value+=P,O.output=C,k.backtrack=!0,k.globstar=!0,Gt(P);continue}let q=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(q)){Yh("star",P);continue}if(O.type==="star"){if(r.noglobstar===!0){Gt(P);continue}let U=O.prev,Ae=U.prev,st=U.type==="slash"||U.type==="bos",jt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!st||q[0]&&q[0]!=="/")){Ee({type:"star",value:P,output:""});continue}let ot=k.braces>0&&(U.type==="comma"||U.type==="brace"),ai=L.length&&(U.type==="pipe"||U.type==="paren");if(!st&&U.type!=="paren"&&!ot&&!ai){Ee({type:"star",value:P,output:""});continue}for(;q.slice(0,3)==="/**";){let ci=t[k.index+4];if(ci&&ci!=="/")break;q=q.slice(3),Gt("/**",3)}if(U.type==="bos"&&$t()){O.type="globstar",O.value+=P,O.output=R(r),k.output=O.output,k.globstar=!0,Gt(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&!jt&&$t()){k.output=k.output.slice(0,-(U.output+O.output).length),U.output=`(?:${U.output}`,O.type="globstar",O.output=R(r)+(r.strictSlashes?")":"|$)"),O.value+=P,k.globstar=!0,k.output+=U.output+O.output,Gt(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&q[0]==="/"){let ci=q[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(U.output+O.output).length),U.output=`(?:${U.output}`,O.type="globstar",O.output=`${R(r)}${f}|${f}${ci})`,O.value+=P,k.output+=U.output+O.output,k.globstar=!0,Gt(P+Me()),Ee({type:"slash",value:"/",output:""});continue}if(U.type==="bos"&&q[0]==="/"){O.type="globstar",O.value+=P,O.output=`(?:^|${f}|${R(r)}${f})`,k.output=O.output,k.globstar=!0,Gt(P+Me()),Ee({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-O.output.length),O.type="globstar",O.output=R(r),O.value+=P,k.output+=O.output,k.globstar=!0,Gt(P);continue}let ut={type:"star",value:P,output:C};if(r.bash===!0){ut.output=".*?",(O.type==="bos"||O.type==="slash")&&(ut.output=A+ut.output),Ee(ut);continue}if(O&&(O.type==="bracket"||O.type==="paren")&&r.regex===!0){ut.output=P,Ee(ut);continue}(k.index===k.start||O.type==="slash"||O.type==="dot")&&(O.type==="dot"?(k.output+=g,O.output+=g):r.dot===!0?(k.output+=b,O.output+=b):(k.output+=A,O.output+=A),je()!=="*"&&(k.output+=p,O.output+=p)),Ee(ut)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Zc("closing","]"));k.output=Kr.escapeLast(k.output,"["),ko("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Zc("closing",")"));k.output=Kr.escapeLast(k.output,"("),ko("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Zc("closing","}"));k.output=Kr.escapeLast(k.output,"{"),ko("braces")}if(r.strictSlashes!==!0&&(O.type==="star"||O.type==="bracket")&&Ee({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let q of k.tokens)k.output+=q.output!=null?q.output:q.value,q.suffix&&(k.output+=q.suffix)}return k};MI.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(ib,r.maxLength):ib,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=ZW[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=pf.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=A=>A.noglobstar===!0?_:`(${g}(?:(?!${p}${A.dot?c:o}).)*?)`,x=A=>{switch(A){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let E=/^(.*?)\.(\w+)$/.exec(A);if(!E)return;let C=x(E[1]);return C?C+o+E[2]:void 0}}},w=Kr.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};WW.exports=MI});var XW=v((lrt,YW)=>{"use strict";var Bxe=HW(),FI=KW(),JW=df(),Hxe=uf(),Zxe=t=>t&&typeof t=="object"&&!Array.isArray(t),At=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>At(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=Zxe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?At.compileRe(t,e):At.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=At(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=At.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};At.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?JW.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=At.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};At.matchBase=(t,e,r)=>(e instanceof RegExp?e:At.makeRe(e,r)).test(JW.basename(t));At.isMatch=(t,e,r)=>At(e,r)(t);At.parse=(t,e)=>Array.isArray(t)?t.map(r=>At.parse(r,e)):FI(t,{...e,fastpaths:!1});At.scan=(t,e)=>Bxe(t,e);At.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=At.toRegex(a,e);return n===!0&&(c.state=t),c};At.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=FI.fastpaths(t,e)),i.output||(i=FI(t,e)),At.compileRe(i,e,r,n)};At.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};At.constants=Hxe;YW.exports=At});var rK=v((urt,tK)=>{"use strict";var QW=XW(),Gxe=df();function eK(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Gxe.isWindows()}),QW(t,e,r)}Object.assign(eK,QW);tK.exports=eK});import{readdir as Vxe,readdirSync as Wxe,realpath as Kxe,realpathSync as Jxe,stat as Yxe,statSync as Xxe}from"fs";import{isAbsolute as Qxe,posix as la,resolve as e0e}from"path";import{fileURLToPath as t0e}from"url";function i0e(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&n0e.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>la.relative(t,n)||".":n=>la.relative(t,`${e}/${n}`)||"."}function a0e(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=la.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function sK(t){var e;let r=Gc.default.scan(t,c0e);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function m0e(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Gc.default.scan(t);return r.isGlob||r.negated}function mf(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function aK(t){return typeof t=="string"?[t]:t??[]}function zI(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=p0e(o);s=Qxe(s.replace(g0e,""))?la.relative(a,s):la.normalize(s);let c=(i=h0e.exec(s))===null||i===void 0?void 0:i[0],l=sK(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?la.join(o,...d):o}return s}function y0e(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(zI(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(zI(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(zI(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function _0e(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=y0e(t,e,n);t.debug&&mf("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(iK,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Gc.default)(i.match,f),m=(0,Gc.default)(i.ignore,f),h=i0e(i.match,f),g=nK(r,d,o),b=o?g:nK(r,d,!0),_=(w,R)=>{let A=b(R,!0);return A!=="."&&!h(A)||m(A)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new IW({filters:[a?(w,R)=>{let A=g(w,R),E=p(A)&&!m(A);return E&&mf(`matched ${A}`),E}:(w,R)=>{let A=g(w,R);return p(A)&&!m(A)}],exclude:a?(w,R)=>{let A=_(w,R);return mf(`${A?"skipped":"crawling"} ${R}`),A}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&mf("internal properties:",{...n,root:d}),[x,r!==d&&!o&&a0e(r,d)]}function b0e(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function S0e(t){let e={...v0e,...t};return e.cwd=(e.cwd instanceof URL?t0e(e.cwd):e0e(e.cwd)).replace(iK,"/"),e.ignore=aK(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||Vxe,readdirSync:e.fs.readdirSync||Wxe,realpath:e.fs.realpath||Kxe,realpathSync:e.fs.realpathSync||Jxe,stat:e.fs.stat||Yxe,statSync:e.fs.statSync||Xxe}),e.debug&&mf("globbing with options:",e),e}function w0e(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=r0e(t)||typeof t=="string",i=aK((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=S0e(n?e:t);return i.length>0?_0e(o,i):[]}function Vo(t,e){let[r,n]=w0e(t,e);return r?b0e(r.sync(),n):[]}var Gc,r0e,iK,oK,n0e,o0e,s0e,c0e,l0e,u0e,d0e,f0e,p0e,h0e,g0e,v0e,hf=y(()=>{PW();Gc=kt(rK(),1),r0e=Array.isArray,iK=/\\/g,oK=process.platform==="win32",n0e=/^(\/?\.\.)+$/;o0e=/^[A-Z]:\/$/i,s0e=oK?t=>o0e.test(t):t=>t==="/";c0e={parts:!0};l0e=/(?t.replace(l0e,"\\$&"),f0e=t=>t.replace(u0e,"\\$&"),p0e=oK?f0e:d0e;h0e=/^(\/?\.\.)+/,g0e=/\\(?=[()[\]{}!*+?@|])/g;v0e={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as ob,readFileSync as x0e,readdirSync as $0e,statSync as cK}from"node:fs";import{join as Vc}from"node:path";function k0e(t){let{cwd:e="."}=t,r,n;try{let c=Y(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=bi(e,n),o=[],{layers:s,forbiddenImports:a}=LI(r);return s.size>0&&(E0e(e,i,s,o),A0e(e,i,s,o)),a.length>0&&T0e(e,i,a,o),o}function LI(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function E0e(t,e,r,n){let i=e.mainRoot,o=Vc(t,i);if(ob(o))for(let s of $0e(o)){let a=Vc(o,s);cK(a).isDirectory()&&(r.has(s)||n.push({detector:sb,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function A0e(t,e,r,n){let i=e.mainRoot,o=Vc(t,i);if(ob(o))for(let s of r){let a=Vc(o,s);ob(a)&&cK(a).isDirectory()||n.push({detector:sb,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function T0e(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Vc(t,i,s.from);if(!ob(a))continue;let c=Vo([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Vc(a,l),d;try{d=x0e(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];O0e(p,s.to,e.importStyle)&&n.push({detector:sb,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function O0e(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var sb,lK,UI=y(()=>{"use strict";hf();at();Hc();sb="ARCHITECTURE_FROM_SPEC";lK={name:sb,run:k0e}});import{existsSync as I0e,readFileSync as P0e}from"node:fs";import{join as R0e}from"node:path";function C0e(t){let{cwd:e="."}=t,r=R0e(e,"spec/capabilities.yaml");if(!I0e(r))return[];let n;try{let c=P0e(r,"utf8"),l=uK.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=Y(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:ab,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:ab,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:ab,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var uK,ab,dK,fK=y(()=>{"use strict";uK=kt(or(),1);at();ab="CAPABILITIES_FEATURE_MAPPING";dK={name:ab,run:C0e}});import{existsSync as D0e,readFileSync as N0e}from"node:fs";import{join as j0e}from"node:path";function M0e(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function F0e(t){let{cwd:e="."}=t;return pe(e,qI,r=>z0e(r,e))}function z0e(t,e){let r=bi(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=j0e(e,o);if(!D0e(s))continue;let a=N0e(s,"utf8");M0e(a)||n.push({detector:qI,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var qI,pK,mK=y(()=>{"use strict";Hc();_t();qI="CONVENTION_DRIFT";pK={name:qI,run:F0e}});import{existsSync as BI,readFileSync as hK}from"node:fs";import{join as cb}from"node:path";function L0e(t){return JSON.parse(t).total?.lines?.pct??0}function gK(t){let e=/BI(cb(c.dir,d)));if(!l){s.push(c.path);continue}let u=gK(hK(cb(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:no,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=yK(n,i);return a0?[{detector:no,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function B0e(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let s=q0e(e,t.focusModules);if(s)return s}let r=bi(e),n=pt(e).language==="kotlin"?bI.find(s=>BI(cb(e,s)))??tW(e):r.coverageSummary,i=cb(e,n);if(!BI(i))return[{detector:no,severity:"info",message:`${n} not present \u2014 run stage_2.2 first`}];let o;try{let s=hK(i,"utf8");o=r.coverageFormat==="jacoco-xml"?U0e(s):L0e(s)}catch(s){return[{detector:no,severity:"warn",message:`${n} unparseable: ${s.message}`}]}return o===null?[{detector:no,severity:"warn",message:`${n} contained no line-coverage counter`}]:o>=lb?[]:[{detector:no,severity:"warn",message:`line coverage ${o.toFixed(1)}% < floor ${lb}%`}]}var no,lb,_K,bK=y(()=>{"use strict";W_();Hc();Z_();yn();no="COVERAGE_DROP",lb=70;_K={name:no,run:B0e}});import{existsSync as H0e}from"node:fs";import{join as Z0e}from"node:path";function G0e(t){let{cwd:e="."}=t;return pe(e,ub,r=>V0e(r,e))}function V0e(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?H0e(Z0e(e,r.path))?[]:[{detector:ub,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:ub,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var ub,vK,SK=y(()=>{"use strict";_t();ub="DELIVERABLE_INTEGRITY";vK={name:ub,run:G0e}});function W0e(t){let e=(t.features??[]).filter(i=>i.status==="done");return e.length===0?[]:!t.project?.deliverable?[]:(t.project?.smoke??[]).length>0?[]:[{detector:HI,severity:"warn",path:"spec.yaml",message:`${e.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function K0e(t){let{cwd:e="."}=t;return pe(e,HI,r=>W0e(r))}var HI,wK,xK=y(()=>{"use strict";_t();HI="SMOKE_PROBE_DEMAND";wK={name:HI,run:K0e}});function J0e(t){let{cwd:e="."}=t;return pe(e,db,r=>Y0e(r,e))}function Y0e(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=wc(e);if(n===null)return[{detector:db,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=n.get(o.id),a=Md(e,o.modules??[]);s!==a&&i.push({detector:db,severity:"warn",path:"spec/attestation.yaml",message:s===void 0?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var db,fb,ZI=y(()=>{"use strict";Fd();_t();db="STALE_ATTESTATION";fb={name:db,run:J0e}});function X0e(t){let{cwd:e="."}=t,r;try{r=Y(e)}catch{return[]}return Q0e(r)}function Q0e(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:$K,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var $K,pb,GI=y(()=>{"use strict";at();$K="DEPENDENCY_CYCLE";pb={name:$K,run:X0e}});import{appendFileSync as e$e,existsSync as kK,mkdirSync as t$e,readFileSync as r$e}from"node:fs";import{dirname as n$e,join as i$e}from"node:path";function EK(t){return i$e(t,o$e,s$e)}function AK(t){return VI.add(t),()=>VI.delete(t)}function ua(t,e){let r=EK(t),n=n$e(r);kK(n)||t$e(n,{recursive:!0}),e$e(r,`${JSON.stringify(e)} +`,"utf8");for(let i of VI)try{i(t,e)}catch{}}function bn(t){let e=EK(t);if(!kK(e))return[];let r=r$e(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var o$e,s$e,VI,Hn=y(()=>{"use strict";o$e=".cladding",s$e="audit.log.jsonl";VI=new Set});import{existsSync as a$e}from"node:fs";import{join as c$e}from"node:path";function l$e(t){let{cwd:e="."}=t,r=bn(e);if(r.length===0)return[{detector:WI,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(a$e(c$e(e,i.artifact))||n.push({detector:WI,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var WI,TK,OK=y(()=>{"use strict";Hn();WI="EVIDENCE_MISMATCH";TK={name:WI,run:l$e}});import{existsSync as u$e,readFileSync as d$e}from"node:fs";import{join as f$e}from"node:path";function p$e(t){let e=f$e(t,CK);if(!u$e(e))return null;try{let n=((0,RK.parse)(d$e(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*PK(t,e){for(let r of t??[])r.startsWith(IK)&&(yield{ref:r,name:r.slice(IK.length),field:e})}function m$e(t){let{cwd:e="."}=t,r=p$e(e);if(r===null)return[];let n;try{n=Y(e)}catch(o){return[{detector:KI,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...PK(s.evidence_refs,"evidence_refs"),...PK(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:KI,severity:"warn",path:CK,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var RK,KI,IK,CK,DK,NK=y(()=>{"use strict";RK=kt(or(),1);at();KI="FIXTURE_REFERENCE_INVALID",IK="fixture:",CK="conformance/fixtures.yaml";DK={name:KI,run:m$e}});function h$e(t){let{cwd:e="."}=t,r=pt(e),n=r.gates.secret;if(!n)return[{detector:mb,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=et(n.cmd,[...n.args],{cwd:e,reject:!1});return cf(i)?[{detector:mb,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:J_(i,mb,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var mb,hb,JI=y(()=>{"use strict";Ir();yn();_n();mb="HARDCODED_SECRET";hb={name:mb,run:h$e}});import{existsSync as Wc,readFileSync as YI}from"node:fs";import{join as da}from"node:path";function g$e(t){return Vo(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec)\.ts$/.test(r)).length}function gf(t){if(!Wc(t))return null;try{return JSON.parse(YI(t,"utf8"))}catch{return null}}function y$e(t,e){let r=da(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(YI(r,"utf8"))}catch(c){e.push({detector:io,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:io,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=g$e(t);s!==a&&e.push({detector:io,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function _$e(t,e){for(let r of jK){let n=da(t,r.path);if(!Wc(n))continue;let i=gf(n);if(!i){e.push({detector:io,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:io,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function b$e(t,e){let r=gf(da(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of jK){let s=da(t,o.path);if(!Wc(s))continue;let a=gf(s);a?.version&&a.version!==n&&e.push({detector:io,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=da(t,".claude-plugin","marketplace.json");if(Wc(i)){let o=gf(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:io,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function v$e(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function S$e(t,e){let r=da(t,"src","cli","clad.ts"),n=da(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Wc(r)||!Wc(n))return;let i=v$e(YI(r,"utf8"));if(i.length===0)return;let s=gf(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:io,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function w$e(t){let{cwd:e="."}=t,r=[];return y$e(e,r),S$e(e,r),_$e(e,r),b$e(e,r),r}var io,jK,MK,FK=y(()=>{"use strict";hf();io="HARNESS_INTEGRITY",jK=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];MK={name:io,run:w$e}});import{existsSync as x$e,readFileSync as $$e}from"node:fs";import{join as k$e}from"node:path";function A$e(t){let{cwd:e="."}=t;return pe(e,gb,r=>I$e(r,e))}function T$e(){return E$e}function O$e(t){let e=k$e(t,"spec/capabilities.yaml");if(!x$e(e))return!1;try{let r=zK.default.parse($$e(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function I$e(t,e){let r=t.features.length;if(r{"use strict";zK=kt(or(),1);_t();gb="HOLLOW_GOVERNANCE",E$e=8;LK={name:gb,run:A$e}});function P$e(t){let{cwd:e="."}=t,r;try{r=Y(e)}catch{return[]}let n=[];return qK(r.features.map(i=>i.id),"feature","spec/features/",n),qK((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function qK(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:BK,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var BK,HK,ZK=y(()=>{"use strict";at();BK="ID_COLLISION";HK={name:BK,run:P$e}});import{existsSync as yf,readFileSync as XI,readdirSync as QI,statSync as R$e,writeFileSync as VK}from"node:fs";import{join as oo}from"node:path";function GK(t){if(!yf(t))return 0;try{return QI(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function C$e(t){if(!yf(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=QI(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=oo(n,o),a;try{a=R$e(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function D$e(t){let e=oo(t,"spec","capabilities.yaml");if(!yf(e))return 0;try{let r=yb.default.parse(XI(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function Wo(t="."){let e=GK(oo(t,"spec","features")),r=GK(oo(t,"spec","scenarios")),n=D$e(t),i=C$e(oo(t,"tests")),o=new Date().toISOString().slice(0,10);return{features:e,scenarios:r,capabilities:n,test_files:i,last_synced:o}}function Kc(t,e){let r=oo(t,"spec.yaml");if(!yf(r))return;let n=XI(r,"utf8"),i=N$e(n,e);i!==n&&VK(r,i)}function N$e(t,e){let r=t.includes(`\r `)?`\r `:` `,n=t.split(/\r?\n/),i=n.findIndex(d=>/^inventory:\s*$/.test(d)),o=["# Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand.","inventory:",` features: ${e.features??0}`,` scenarios: ${e.scenarios??0}`,` capabilities: ${e.capabilities??0}`,` test_files: ${e.test_files??0}`,` last_synced: ${JSON.stringify(e.last_synced??"")}`],s=d=>r===`\r @@ -249,20 +249,20 @@ ${o.join(` `)}let a=i;a>0&&/Auto-maintained by `clad sync`/.test(n[a-1])&&(a-=1);let c=i+1;for(;ci+1);)c++;let l=n.slice(0,a),u=n.slice(c);for(;l.length>0&&l[l.length-1].trim()==="";)l.pop();return l.push(""),s([...l,...o,"",...u.filter((d,f)=>!(f===0&&d.trim()===""))].join(` `).replace(/\n{3,}/g,` -`))}function da(t="."){let e=oo(t,"spec","features");if(!gf(e))return!1;let r=[];for(let i of YI(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,hb.parse)(JI(oo(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` +`))}function fa(t="."){let e=oo(t,"spec","features");if(!yf(e))return!1;let r=[];for(let i of QI(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,yb.parse)(XI(oo(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` `)+` -`;return VK(oo(t,"spec","index.yaml"),n,"utf8"),!0}var hb,yf=y(()=>{"use strict";hb=kt(or(),1)});import{existsSync as WK,readFileSync as KK,readdirSync as j$e}from"node:fs";import{join as XI}from"node:path";function M$e(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=Wo(e),i=r.inventory;if(!i){let s=JK.filter(([c])=>(n[c]??0)>0);if(s.length===0)return QI(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...QI(e),{detector:_f,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of JK){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:_f,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...QI(e)),o}function QI(t){let e=XI(t,"spec","index.yaml"),r=XI(t,"spec","features");if(!WK(e)||!WK(r))return[];let n=new Map;try{for(let l of KK(e,"utf8").split(` -`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of j$e(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=KK(XI(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:_f,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:_f,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var _f,JK,YK,XK=y(()=>{"use strict";yf();at();_f="INVENTORY_DRIFT",JK=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];YK={name:_f,run:M$e}});import{existsSync as F$e,readFileSync as z$e}from"node:fs";import{join as L$e}from"node:path";function q$e(t){let{cwd:e="."}=t,r=L$e(e,"src","spec","schema.json"),n=[];if(F$e(r)){let i;try{i=JSON.parse(z$e(r,"utf8"))}catch(o){n.push({detector:bf,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of U$e)i.required?.includes(o)||n.push({detector:bf,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:bf,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=J(e);i.schema!==QK&&n.push({detector:bf,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${QK}'`})}catch{}return n}var bf,U$e,QK,e3,t3=y(()=>{"use strict";at();bf="META_INTEGRITY",U$e=["schema","project","features"],QK="0.1";e3={name:bf,run:q$e}});function B$e(t){let{cwd:e="."}=t,r;try{r=J(e)}catch{return[]}let n=[];return r3(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),r3((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function r3(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:n3,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var n3,i3,o3=y(()=>{"use strict";at();n3="SLUG_CONFLICT";i3={name:n3,run:B$e}});import{existsSync as H$e}from"node:fs";import{join as Z$e}from"node:path";function G$e(t){let{cwd:e="."}=t;return pe(e,eP,r=>V$e(r,e))}function V$e(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=Z$e(e,i);H$e(o)||r.push({detector:eP,severity:"error",path:i,message:`feature ${n.id} declares module '${i}' but the file does not exist`})}return r}var eP,gb,tP=y(()=>{"use strict";_t();eP="MISSING_IMPLEMENTATION";gb={name:eP,run:G$e}});function W$e(t){let{cwd:e="."}=t;return pe(e,rP,K$e)}function K$e(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:rP,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var rP,yb,nP=y(()=>{"use strict";_t();rP="MISSING_TESTS";yb={name:rP,run:W$e}});import{existsSync as J$e,readFileSync as Y$e}from"node:fs";import{join as s3}from"node:path";function a3(t){if(J$e(t))try{return JSON.parse(Y$e(t,"utf8"))}catch{return}}function tke(t){let{cwd:e="."}=t,r=a3(s3(e,X$e)),n=a3(s3(e,Q$e));if(!r||!n)return[{detector:iP,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>eke&&i.push({detector:iP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var iP,X$e,Q$e,eke,c3,l3=y(()=>{"use strict";iP="PERFORMANCE_DRIFT",X$e="perf/baseline.json",Q$e="perf/current.json",eke=10;c3={name:iP,run:tke}});import{existsSync as rke}from"node:fs";import{join as nke}from"node:path";function oke(t){let{cwd:e="."}=t;return pe(e,oP,r=>cke(r,e))}function ske(){return ike}function ake(t,e){return(t.modules??[]).some(r=>rke(nke(e,r)))}function cke(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||ake(s,e)||r.push(s.id);let n=ske();if(r.length<=n)return[];let i=r.slice(0,u3).join(", "),o=r.length>u3?", \u2026":"";return[{detector:oP,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var oP,ike,u3,d3,f3=y(()=>{"use strict";_t();oP="PLANNED_BACKLOG",ike=5,u3=8;d3={name:oP,run:oke}});import{existsSync as lke,readFileSync as uke}from"node:fs";import{join as dke}from"node:path";function mke(t){let{cwd:e="."}=t;return pe(e,sP,r=>gke(r,e))}function hke(){return fke}function gke(t,e){if(t.features.lengthn.includes(i))?[{detector:sP,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Refine it with \`clad refine\` or by hand.`}]:[]}var sP,fke,pke,p3,m3=y(()=>{"use strict";_t();sP="PROJECT_CONTEXT_DRIFT",fke=8,pke=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];p3={name:sP,run:mke}});function h3(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:_b,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function yke(t){let{cwd:e="."}=t;return pe(e,_b,_ke)}function _ke(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...h3(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:_b,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...h3(e,n.features,`scenario ${n.id}.features`));return r}var _b,bb,aP=y(()=>{"use strict";_t();_b="REFERENCE_INTEGRITY";bb={name:_b,run:yke}});function vb(t=""){return new RegExp(bke,t)}var bke,cP=y(()=>{"use strict";bke=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as vke,readdirSync as Ske,readFileSync as wke,statSync as xke,writeFileSync as $ke}from"node:fs";import{dirname as kke,join as vf,normalize as Eke,relative as Ake}from"node:path";function Pke(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function g3(t){return t.split("\\").join("/")}function Rke(t){return Tke.some(e=>t===e||t.startsWith(`${e}/`))}function Cke(t){let e=vf(t,"docs");if(!vke(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=Ske(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=vf(i,s),c;try{c=xke(a)}catch{continue}let l=g3(Ake(t,a));Rke(l)||(c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l))}}return r.sort()}function Dke(t,e){if(/^[a-z]+:/i.test(e))return null;let r=Eke(vf(kke(t),e));return g3(r)}function Sf(t="."){let e=[];for(let r of Cke(t)){let n;try{n=wke(vf(t,r),"utf8")}catch{continue}let i=n.includes(Oke),o=Pke(n),s=i?[]:[...new Set(o.match(vb("g"))??[])].sort(),a=new Set;for(let c of o.matchAll(Ike)){let l=Dke(r,c[1]);l&&a.add(l)}e.push({doc:r,features:s,doc_links:[...a].sort()})}return{docs:e}}function y3(t="."){let e=Sf(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return $ke(vf(t,"spec","_doc-links.yaml"),`${r.join(` +`;return VK(oo(t,"spec","index.yaml"),n,"utf8"),!0}var yb,_f=y(()=>{"use strict";yb=kt(or(),1)});import{existsSync as WK,readFileSync as KK,readdirSync as j$e}from"node:fs";import{join as eP}from"node:path";function M$e(t){let{cwd:e="."}=t,r;try{r=Y(e)}catch{return[]}let n=Wo(e),i=r.inventory;if(!i){let s=JK.filter(([c])=>(n[c]??0)>0);if(s.length===0)return tP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...tP(e),{detector:bf,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of JK){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:bf,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...tP(e)),o}function tP(t){let e=eP(t,"spec","index.yaml"),r=eP(t,"spec","features");if(!WK(e)||!WK(r))return[];let n=new Map;try{for(let l of KK(e,"utf8").split(` +`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of j$e(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=KK(eP(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:bf,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:bf,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var bf,JK,YK,XK=y(()=>{"use strict";_f();at();bf="INVENTORY_DRIFT",JK=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];YK={name:bf,run:M$e}});import{existsSync as F$e,readFileSync as z$e}from"node:fs";import{join as L$e}from"node:path";function q$e(t){let{cwd:e="."}=t,r=L$e(e,"src","spec","schema.json"),n=[];if(F$e(r)){let i;try{i=JSON.parse(z$e(r,"utf8"))}catch(o){n.push({detector:vf,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of U$e)i.required?.includes(o)||n.push({detector:vf,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:vf,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=Y(e);i.schema!==QK&&n.push({detector:vf,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${QK}'`})}catch{}return n}var vf,U$e,QK,e3,t3=y(()=>{"use strict";at();vf="META_INTEGRITY",U$e=["schema","project","features"],QK="0.1";e3={name:vf,run:q$e}});function B$e(t){let{cwd:e="."}=t,r;try{r=Y(e)}catch{return[]}let n=[];return r3(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),r3((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function r3(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:n3,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var n3,i3,o3=y(()=>{"use strict";at();n3="SLUG_CONFLICT";i3={name:n3,run:B$e}});import{existsSync as H$e}from"node:fs";import{join as Z$e}from"node:path";function G$e(t){let{cwd:e="."}=t;return pe(e,rP,r=>V$e(r,e))}function V$e(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=Z$e(e,i);H$e(o)||r.push({detector:rP,severity:"error",path:i,message:`feature ${n.id} declares module '${i}' but the file does not exist`})}return r}var rP,_b,nP=y(()=>{"use strict";_t();rP="MISSING_IMPLEMENTATION";_b={name:rP,run:G$e}});function W$e(t){let{cwd:e="."}=t;return pe(e,iP,K$e)}function K$e(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:iP,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var iP,bb,oP=y(()=>{"use strict";_t();iP="MISSING_TESTS";bb={name:iP,run:W$e}});import{existsSync as J$e,readFileSync as Y$e}from"node:fs";import{join as s3}from"node:path";function a3(t){if(J$e(t))try{return JSON.parse(Y$e(t,"utf8"))}catch{return}}function tke(t){let{cwd:e="."}=t,r=a3(s3(e,X$e)),n=a3(s3(e,Q$e));if(!r||!n)return[{detector:sP,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>eke&&i.push({detector:sP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var sP,X$e,Q$e,eke,c3,l3=y(()=>{"use strict";sP="PERFORMANCE_DRIFT",X$e="perf/baseline.json",Q$e="perf/current.json",eke=10;c3={name:sP,run:tke}});import{existsSync as rke}from"node:fs";import{join as nke}from"node:path";function oke(t){let{cwd:e="."}=t;return pe(e,aP,r=>cke(r,e))}function ske(){return ike}function ake(t,e){return(t.modules??[]).some(r=>rke(nke(e,r)))}function cke(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||ake(s,e)||r.push(s.id);let n=ske();if(r.length<=n)return[];let i=r.slice(0,u3).join(", "),o=r.length>u3?", \u2026":"";return[{detector:aP,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var aP,ike,u3,d3,f3=y(()=>{"use strict";_t();aP="PLANNED_BACKLOG",ike=5,u3=8;d3={name:aP,run:oke}});import{existsSync as lke,readFileSync as uke}from"node:fs";import{join as dke}from"node:path";function mke(t){let{cwd:e="."}=t;return pe(e,cP,r=>gke(r,e))}function hke(){return fke}function gke(t,e){if(t.features.lengthn.includes(i))?[{detector:cP,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Refine it with \`clad refine\` or by hand.`}]:[]}var cP,fke,pke,p3,m3=y(()=>{"use strict";_t();cP="PROJECT_CONTEXT_DRIFT",fke=8,pke=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];p3={name:cP,run:mke}});function h3(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:vb,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function yke(t){let{cwd:e="."}=t;return pe(e,vb,_ke)}function _ke(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...h3(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:vb,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...h3(e,n.features,`scenario ${n.id}.features`));return r}var vb,Sb,lP=y(()=>{"use strict";_t();vb="REFERENCE_INTEGRITY";Sb={name:vb,run:yke}});function wb(t=""){return new RegExp(bke,t)}var bke,uP=y(()=>{"use strict";bke=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as vke,readdirSync as Ske,readFileSync as wke,statSync as xke,writeFileSync as $ke}from"node:fs";import{dirname as kke,join as Sf,normalize as Eke,relative as Ake}from"node:path";function Pke(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function g3(t){return t.split("\\").join("/")}function Rke(t){return Tke.some(e=>t===e||t.startsWith(`${e}/`))}function Cke(t){let e=Sf(t,"docs");if(!vke(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=Ske(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Sf(i,s),c;try{c=xke(a)}catch{continue}let l=g3(Ake(t,a));Rke(l)||(c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l))}}return r.sort()}function Dke(t,e){if(/^[a-z]+:/i.test(e))return null;let r=Eke(Sf(kke(t),e));return g3(r)}function wf(t="."){let e=[];for(let r of Cke(t)){let n;try{n=wke(Sf(t,r),"utf8")}catch{continue}let i=n.includes(Oke),o=Pke(n),s=i?[]:[...new Set(o.match(wb("g"))??[])].sort(),a=new Set;for(let c of o.matchAll(Ike)){let l=Dke(r,c[1]);l&&a.add(l)}e.push({doc:r,features:s,doc_links:[...a].sort()})}return{docs:e}}function y3(t="."){let e=wf(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return $ke(Sf(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var Tke,Oke,Ike,Sb=y(()=>{"use strict";cP();Tke=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],Oke="clad-doc-links: ignore",Ike=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g});import{existsSync as Nke}from"node:fs";import{join as jke}from"node:path";function Mke(t){let{cwd:e="."}=t;return pe(e,wb,r=>Fke(r,e))}function Fke(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Sf(e).docs){for(let o of i.doc_links)Nke(jke(e,o))||n.push({detector:wb,severity:"error",path:i.doc,message:`doc '${i.doc}' links to missing file '${o}'`});for(let o of i.features)r.has(o)||n.push({detector:wb,severity:"warn",path:i.doc,message:`doc '${i.doc}' references unknown feature '${o}' \u2014 archived/renamed? If it is an illustrative example, add a \`clad-doc-links: ignore\` marker to the doc.`})}return n}var wb,xb,lP=y(()=>{"use strict";Sb();_t();wb="DOC_LINK_INTEGRITY";xb={name:wb,run:Mke}});function Lke(t){let{cwd:e="."}=t;return pe(e,wf,r=>qke(r))}function Uke(){return zke}function qke(t){let e=[],r=t.features.length,n=t.scenarios??[];r>=Uke()&&n.length===0&&e.push({detector:wf,severity:"warn",path:"spec/scenarios/",message:`${r} features but no scenarios declared \u2014 cross-feature user-journey flows are not captured. Author at least one with \`clad_create_scenario\`.`});for(let o of n)(o.features??[]).length===0&&e.push({detector:wf,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let i=new Map(t.features.filter(o=>typeof o.slug=="string"&&o.slug.length>0).map(o=>[o.slug,o.id]));for(let o of n){if(!o.flow)continue;let s=new Set(o.features??[]),a=new Map;for(let c of o.flow.matchAll(/\(([^)]+)\)/g))for(let l of c[1].split(/[,/·]/)){let u=l.trim(),d=i.get(u);d&&!s.has(d)&&a.set(u,d)}if(a.size>0){let c=[...a].map(([l,u])=>`${l} (${u})`).join(", ");e.push({detector:wf,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} flow references ${c} but features[] does not bind ${a.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var wf,zke,_3,b3=y(()=>{"use strict";_t();wf="SCENARIO_COVERAGE",zke=8;_3={name:wf,run:Lke}});import{createHash as Bke}from"node:crypto";function Hke(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function xf(t,e=0){if(t.oracle_policy){let r=t.oracle_policy;return{mandateActive:!0,reportOnly:!1,exhaustive:!1,alwaysEars:new Set(r.always_ears??v3),sample:Hke(r.sample??0)}}return t.require_oracles===!0?{mandateActive:!0,reportOnly:!1,exhaustive:!0,alwaysEars:new Set,sample:1}:t.require_oracles===void 0&&e>=8?{mandateActive:!0,reportOnly:!0,exhaustive:!1,alwaysEars:new Set(v3),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function $f(t){return(t.features??[]).filter(e=>e.status==="done").length}function Zke(t,e){return e<=0?!1:e>=1?!0:parseInt(Bke("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var v3,$b=y(()=>{"use strict";v3=["unwanted"]});import{existsSync as Gke,readdirSync as Vke}from"node:fs";import{join as w3}from"node:path";import x3 from"node:process";function Wke(t){let e=!1,r=n=>{for(let i of Vke(n,{withFileTypes:!0})){if(e)return;let o=w3(n,i.name);i.isDirectory()?r(o):(/\.(test|spec)\.[cm]?[jt]sx?$/.test(i.name)||/_test\.py$/.test(i.name))&&(e=!0)}};try{r(t)}catch{}return e}function uP(t={}){let{cwd:e="."}=t,r=w3(e,Ko);if(!Gke(r)||!Wke(r))return{stage:kb,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${Ko}/ \u2014 skipped`};let n=pt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:kb,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=et(i.cmd,[...i.args,Ko],{cwd:e,reject:!1}),s=zt(kb,i.cmd,o);return s||sr(kb,o)}var kb,Ko,Kke,dP=y(()=>{"use strict";Ir();gn();yn();kb="stage_2.3",Ko="tests/oracle";Kke=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${x3.argv[1]}`;if(Kke){let t=uP();console.log(JSON.stringify(t)),x3.exit(t.exitCode)}});import{existsSync as Jke}from"node:fs";import{join as Yke}from"node:path";function Xke(t){let{cwd:e="."}=t;return pe(e,Zn,r=>Qke(r,e))}function Qke(t,e){let r=[],n=xf(t.project,$f(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?_n(e):[],s=o.filter(l=>l.kind==="oracle"),a=new Set(["agent:developer","agent:specialists"]),c=l=>o.find(u=>u.featureId===l&&a.has(u.stage))?.identity.name;for(let l of t.features)if(l.status==="done")for(let u of l.acceptance_criteria??[]){let d=u.oracle_refs??[];if(kf(n,l.id,u)&&d.length===0){let f=n.exhaustive?"project.require_oracles is set":u.ears&&n.alwaysEars.has(u.ears)?`oracle_policy.always_ears includes '${u.ears}'`:"selected by oracle_policy.sample";r.push({detector:Zn,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${Ko}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!Jke(Yke(e,f))){r.push({detector:Zn,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${Ko}/`)||r.push({detector:Zn,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${Ko}/ \u2014 stage_2.3 only runs ${Ko}/, so this oracle will not execute`}),!n.mandateActive)continue;let p=s.find(g=>g.featureId===l.id&&g.acId===u.id&&g.artifact===f);if(!p){r.push({detector:Zn,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' has no authoring-provenance record \u2014 author it via 'clad oracle' (or clad_author_oracle) so impl-blindness can be verified`});continue}let m=c(l.id);m&&p.identity.name===m?r.push({detector:Zn,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:Zn,severity:"info",message:`${l.id}.${u.id} oracle author\u2260implementer not verified \u2014 no implementer identity recorded (no clad drive history to compare)`});let h=(p.readManifest??[]).filter(g=>(l.modules??[]).includes(g));h.length>0&&r.push({detector:Zn,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: author read implementation file(s) the feature owns (${h.join(", ")})`}),p.blind===!1&&r.push({detector:Zn,severity:"info",message:`${l.id}.${u.id} oracle '${f}' provenance is self-reported (host-protocol), not cladding-controlled \u2014 manifest checked, blindness unproven`})}}if(n.mandateActive&&!n.exhaustive){let l=t.features.filter(u=>u.status==="done").flatMap(u=>u.acceptance_criteria??[]).filter(u=>!u.ears).length;l>0&&r.push({detector:Zn,severity:"info",message:`${l} done AC(s) carry no EARS tag and are invisible to the risk-weighted oracle mandate \u2014 tag them (ubiquitous/event/state/optional/unwanted/complex) for the mandate to mean anything.`})}return r}var Zn,$3,k3=y(()=>{"use strict";Hn();$b();dP();_t();Zn="SPEC_CONFORMANCE";$3={name:Zn,run:Xke}});function eEe(t){let{cwd:e="."}=t,r=_n(e);if(r.length===0)return[{detector:fP,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=Date.now(),i=[];for(let o of r){let s=Date.parse(o.identity.timestamp);if(Number.isNaN(s))continue;let a=(n-s)/(1e3*60*60*24);a>E3&&i.push({detector:fP,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${E3})`})}return i}var fP,E3,A3,T3=y(()=>{"use strict";Hn();fP="STALE_EVIDENCE",E3=90;A3={name:fP,run:eEe}});import{existsSync as O3}from"node:fs";import{join as I3}from"node:path";function tEe(t){let{cwd:e="."}=t;return pe(e,Wc,r=>rEe(r,e))}function rEe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Wc,severity:"warn",message:`feature ${n.id} has archived_at but status='${n.status}' (expected 'archived')`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`archived_at already set but status is '${n.status}'`}}}),n.superseded_by&&!n.archived_at&&r.push({detector:Wc,severity:"warn",message:`feature ${n.id} has superseded_by but no archived_at`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`superseded by ${n.superseded_by} but missing archived_at`}}}),n.status==="archived"){let i=(n.modules??[]).filter(o=>O3(I3(e,o)));i.length>0&&r.push({detector:Wc,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}(n.status==="planned"||n.status==="in_progress")&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>O3(I3(e,i)))&&r.push({detector:Wc,severity:"warn",message:`feature ${n.id} (status='${n.status}') declares ${n.modules?.length??0} module(s) but none exist on disk \u2014 consider archiving`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:"all declared modules vanished from disk"}}})}return r}var Wc,Eb,pP=y(()=>{"use strict";_t();Wc="STALE_SPECIFICATION";Eb={name:Wc,run:tEe}});import{existsSync as P3,statSync as R3}from"node:fs";import{join as C3}from"node:path";function iEe(t,e){let r=0;for(let n of e){let i=C3(t,n);if(!P3(i))continue;let o=R3(i).mtimeMs;o>r&&(r=o)}return r}function oEe(t){let{cwd:e="."}=t;return pe(e,mP,r=>sEe(r,e))}function sEe(t,e){let r=bi(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=iEe(e,n);if(i===0)return[];let o=Vo([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=C3(e,a);if(!P3(c))continue;let l=R3(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>nEe&&s.push({detector:mP,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var mP,nEe,Ab,hP=y(()=>{"use strict";mf();qc();_t();mP="STALE_TESTS",nEe=30;Ab={name:mP,run:oEe}});import{existsSync as aEe}from"node:fs";import{join as cEe}from"node:path";function lEe(t){let{cwd:e="."}=t;return pe(e,Ef,r=>uEe(r,e))}function uEe(t,e){let r=[];for(let n of t.features){let i=n.modules??[],o=n.acceptance_criteria??[];if(n.status==="done"&&i.length===0&&o.length===0){r.push({detector:Ef,severity:"error",message:`feature ${n.id} status='done' but declares no modules and no acceptance_criteria \u2014 nothing to verify (hollow completion)`});continue}if(i.length===0)continue;let s=i.filter(a=>!aEe(cEe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:Ef,severity:"error",message:`feature ${n.id} status='done' but ${s.length}/${i.length} module(s) missing: ${s.join(", ")}`}):n.status==="in_progress"&&s.length===i.length&&r.push({detector:Ef,severity:"warn",message:`feature ${n.id} status='in_progress' but every declared module is missing \u2014 likely a stale start`}))}return r}var Ef,Tb,gP=y(()=>{"use strict";_t();Ef="STATUS_DRIFT";Tb={name:Ef,run:lEe}});function dEe(t){let{cwd:e="."}=t;return pe(e,Ob,r=>fEe(r,e))}function fEe(t,e){let r=pt(e).language;return r==="unknown"?[{detector:Ob,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:Ob,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var Ob,D3,N3=y(()=>{"use strict";gn();_t();Ob="TECH_STACK_MISMATCH";D3={name:Ob,run:dEe}});function gEe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function yEe(t){let{cwd:e="."}=t;return pe(e,yP,r=>_Ee(r,e))}function _Ee(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=Vo([...gEe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:yP,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var yP,j3,pEe,mEe,hEe,Ib,_P=y(()=>{"use strict";mf();zI();_t();yP="UNMAPPED_ARTIFACT",j3=["src/stages/**/*.ts","src/spec/**/*.ts"],pEe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},mEe={kotlin:"src/main/kotlin"},hEe=8;Ib={name:yP,run:yEe}});import{existsSync as M3}from"node:fs";import{join as F3}from"node:path";function vEe(t){return bEe.some(e=>t.startsWith(e))}function SEe(t){let{cwd:e="."}=t;return pe(e,bP,r=>wEe(r,e))}function wEe(t,e){let r=[];for(let n of t.features)if(n.status==="done")for(let i of n.acceptance_criteria??[])for(let o of i.test_refs??[]){if(vEe(o))continue;let s=o.split("#",1)[0];M3(F3(e,o))||s&&M3(F3(e,s))||r.push({detector:bP,severity:"error",path:o,message:`${n.id}.${i.id} test_ref '${o}' resolves to nothing on disk \u2014 a test_ref must be a real file path (e.g. 'tests/x.test.ts', optionally with a '#' anchor) or a 'self-dogfood: +`)}`)}return o}function lX(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as kNe}from"node:fs";import{dirname as ENe,join as sD}from"node:path";import{fileURLToPath as ANe}from"node:url";var aD=ENe(ANe(import.meta.url));function pX(t){for(let e of[sD(aD,"viewer",t),sD(aD,"..","graph","viewer",t),sD(aD,"..","..","dist","viewer",t)])try{return kNe(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function mX(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -701,19 +701,19 @@ ${r} ${o} -`}HI();lP();tP();nP();aP();BI();hP();gP();_P();vP();jp();cP();at();var ANe=[yb,Pb,gb,Ib,bb,xb,db,Tb,Ab,ub];function TNe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[Le.module(n),Le.test(n),Le.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=vb().exec(t.message??"");return r&&e.has(Le.feature(r[0]))?[Le.feature(r[0])]:[]}function XS(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ws(e,J(e))}catch{}try{for(let o of ANe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of TNe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ws(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}aD();at();zo();var INe=new Set(["mermaid","dot","json","obsidian","html"]);function gX(t={}){try{let e=t.format??"mermaid";if(!INe.has(e)){B("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=J(),i=Ia(n,".");if(t.focus){let s=GS(n,i,t.focus);if(s.length===0){B("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){B("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=ZS(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=fX(i);for(let[c,l]of a){let u=ONe(s,c);cD(uD(u),{recursive:!0}),lD(u,l,"utf8")}B("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){B("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=YS(i,XS(i,"."));cD(uD(t.out),{recursive:!0}),lD(t.out,s,"utf8"),B("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?dX(i):r==="json"?JS(i):uX(i);t.out?(cD(uD(t.out),{recursive:!0}),lD(t.out,o,"utf8"),B("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){B("fail","graph",e.message),process.exit(1)}}function yX(){try{let t=Ia(J(),".");process.stdout.write(hX(QS(t)),()=>process.exit(0))}catch(t){B("fail","graph",t.message),process.exit(1)}}jp();import{createServer as PNe}from"node:http";import{existsSync as RNe,watch as CNe}from"node:fs";import{join as DNe}from"node:path";at();zo();function NNe(t={}){let e=t.cwd??".",r=new Set,n=()=>Ia(J(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}GI();dP();nP();oP();lP();ZI();yP();_P();vP();wP();Fp();uP();at();var TNe=[bb,Cb,_b,Rb,Sb,kb,pb,Ib,Ob,fb];function ONe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[Le.module(n),Le.test(n),Le.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=wb().exec(t.message??"");return r&&e.has(Le.feature(r[0]))?[Le.feature(r[0])]:[]}function ew(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ks(e,Y(e))}catch{}try{for(let o of TNe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of ONe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ks(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}cD();at();zo();var PNe=new Set(["mermaid","dot","json","obsidian","html"]);function gX(t={}){try{let e=t.format??"mermaid";if(!PNe.has(e)){B("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=Y(),i=Pa(n,".");if(t.focus){let s=WS(n,i,t.focus);if(s.length===0){B("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){B("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=VS(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=fX(i);for(let[c,l]of a){let u=INe(s,c);lD(dD(u),{recursive:!0}),uD(u,l,"utf8")}B("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){B("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=QS(i,ew(i,"."));lD(dD(t.out),{recursive:!0}),uD(t.out,s,"utf8"),B("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?dX(i):r==="json"?XS(i):uX(i);t.out?(lD(dD(t.out),{recursive:!0}),uD(t.out,o,"utf8"),B("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){B("fail","graph",e.message),process.exit(1)}}function yX(){try{let t=Pa(Y(),".");process.stdout.write(hX(tw(t)),()=>process.exit(0))}catch(t){B("fail","graph",t.message),process.exit(1)}}Fp();import{createServer as RNe}from"node:http";import{existsSync as CNe,watch as DNe}from"node:fs";import{join as NNe}from"node:path";at();zo();function jNe(t={}){let e=t.cwd??".",r=new Set,n=()=>Pa(Y(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=PNe((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=JS(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(XS(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected +`)}catch{r.delete(u)}},o=RNe((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=XS(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(ew(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected -`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=YS(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=DNe(e,u);if(RNe(d))try{let f=CNe(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive +`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=QS(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=NNe(e,u);if(CNe(d))try{let f=DNe(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive -`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function _X(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await NNe({port:e,cwd:t.cwd??"."});B("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){B("fail","graph",r.message),process.exit(1)}}var jNe=["stage_1.1","stage_2.1","stage_2.3"];function MNe(t){return(t.features??[]).filter(e=>e.status==="done")}function FNe(t,e){let r=MNe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function bX(t,e){let r=[];for(let n of jNe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=FNe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}Y_();import vX from"node:process";function zNe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function ew(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=zNe(n,t);i.pass||r.push(i)}return r}Hn();var dD="stage_4.1";function fD(t={}){let{cwd:e="."}=t,r=_n(e);if(r.length===0)return{stage:dD,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=ew(r);if(n.length===0)return{stage:dD,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:dD,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var LNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vX.argv[1]}`;if(LNe){let t=fD();console.log(JSON.stringify(t)),vX.exit(t.exitCode)}Ir();import SX from"node:process";var tw="stage_1.4";function pD(t={}){let{cwd:e="."}=t,r;try{r=et("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:tw,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:tw,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:tw,pass:!0,exitCode:0}:{stage:tw,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var UNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${SX.argv[1]}`;if(UNe){let t=pD();console.log(JSON.stringify(t)),SX.exit(t.exitCode)}Ir();Mp();yn();import wX from"node:process";var rw="stage_2.2";function mD(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=ss("coverage",t))}catch(a){return{stage:rw,pass:!1,exitCode:1,stderr:a.message}}if(!r||!n)return{stage:rw,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=et(r,[...n],{cwd:e,reject:!1}),s=zt(rw,r,o);return s||sr(rw,o)}var HNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wX.argv[1]}`;if(HNe){let t=mD();console.log(JSON.stringify(t)),wX.exit(t.exitCode)}Cb();hD();Ir();gn();yn();import $X from"node:process";var iw="stage_3.2";function gD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:iw,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Uc(e,o[o.length-1]))return{stage:iw,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=et(i,[...o],{cwd:e,reject:!1}),a=zt(iw,i,s);return a||sr(iw,s)}var GNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${$X.argv[1]}`;if(GNe){let t=gD();console.log(JSON.stringify(t)),$X.exit(t.exitCode)}Ir();at();yn();import{existsSync as VNe}from"node:fs";import{resolve as kX}from"node:path";import EX from"node:process";var Wt="stage_2.4",AX=5e3;function yD(t={}){let{cwd:e="."}=t,r,n=[],i=!1;try{let f=J(e);r=f.project.deliverable,n=f.project.smoke??[],i=f.features.some(p=>p.status==="done")}catch{return{stage:Wt,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return WNe(e,n[0],i);if(!r)return{stage:Wt,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:Wt,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:Wt,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let o=kX(e,r.path);if(!VNe(o))return{stage:Wt,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let s=r.timeout_ms??AX,a;try{a=et(o,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:s})}catch(f){a=f}let c=zt(Wt,r.path,a);if(c)return c;if(a.timedOut)return{stage:Wt,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${s}ms (hung or too slow)`};let l=r.expect_exit??0,u=a.exitCode??1;if(u===l)return{stage:Wt,pass:!0,exitCode:0,disposition:"liveness"};let d=String(a.stderr??"").trim()||String(a.stdout??"").trim();return{stage:Wt,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${u}, expected ${l}${d?` \u2014 ${d.slice(0,200)}`:""}`}}function WNe(t,e,r){if(e.kind==="none")return{stage:Wt,pass:!0,exitCode:0,disposition:"na"};if(!r)return{stage:Wt,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 smoke probe skipped"};let n=e.run??[];if(n.length===0)return{stage:Wt,pass:!1,exitCode:2,stderr:"cli smoke probe has no run argv \u2014 skipped"};let[i,...o]=n,s=i.startsWith(".")||i.startsWith("/")?kX(t,i):i,a=AX,c;try{c=et(s,[...o],{cwd:t,reject:!1,timeout:a})}catch(p){c=p}let l=zt(Wt,i,c);if(l)return l;if(c.timedOut)return{stage:Wt,pass:!1,exitCode:1,stderr:`smoke probe '${n.join(" ")}' timed out after ${a}ms`};let u=e.expect?.exit??0,d=c.exitCode??1;if(d!==u){let p=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:Wt,pass:!1,exitCode:1,disposition:"fail",stderr:`smoke probe exited ${d}, expected ${u}${p?` \u2014 ${p.slice(0,200)}`:""}`}}let f=e.expect?.token;return f?String(c.stdout??"").includes(f)?{stage:Wt,pass:!0,exitCode:0,disposition:"pass"}:{stage:Wt,pass:!1,exitCode:1,disposition:"fail",stderr:`smoke probe ran (exit ${d}) but stdout did not contain the AC token ${JSON.stringify(f)}`}:{stage:Wt,pass:!0,exitCode:0,disposition:"liveness"}}var KNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${EX.argv[1]}`;if(KNe){let t=yD();console.log(JSON.stringify(t)),EX.exit(t.exitCode)}Ir();gn();yn();import TX from"node:process";var ow="stage_3.1";function _D(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:ow,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Uc(e,o[o.length-1]))return{stage:ow,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=et(i,[...o],{cwd:e,reject:!1}),a=zt(ow,i,s);return a||sr(ow,s)}var JNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${TX.argv[1]}`;if(JNe){let t=_D();console.log(JSON.stringify(t)),TX.exit(t.exitCode)}dP();bD();vD();Ir();Mp();yn();import PX from"node:process";var cw="stage_2.1";function SD(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=ss("test",t))}catch(a){return{stage:cw,pass:!1,exitCode:1,stderr:a.message}}if(!r||!n)return{stage:cw,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${i}'`};let o=et(r,[...n],{cwd:e,reject:!1}),s=zt(cw,r,o);return s||sr(cw,o)}var QNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${PX.argv[1]}`;if(QNe){let t=SD();console.log(JSON.stringify(t)),PX.exit(t.exitCode)}Ir();gn();yn();import RX from"node:process";var lw="stage_3.3";function wD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:lw,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Uc(e,o[o.length-1]))return{stage:lw,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=et(i,[...o],{cwd:e,reject:!1}),a=zt(lw,i,s);return a||sr(lw,s)}var eje=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${RX.argv[1]}`;if(eje){let t=wD();console.log(JSON.stringify(t)),RX.exit(t.exitCode)}var tje=new Set(["fail","pending_env","advisory"]);function Pa(t){return tje.has(t)}function CX(t){return t.disposition??(t.pass?"pass":t.exitCode===2?"skip":"fail")}function DX(t,e){return Pa(e)?t.disposition?1:t.exitCode:0}pP();$D();ED();yf();Sb();var BX=kt(or(),1);import{existsSync as AD,readFileSync as _je,readdirSync as qX,statSync as bje,writeFileSync as vje}from"node:fs";import{basename as Up,join as qp,relative as UX}from"node:path";var Sje=["self-dogfood:","fixture:","derived:"],HX=/\.(test|spec)\.[jt]sx?$/;function ZX(t,e=t,r=[]){let n;try{n=qX(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=qp(e,i);try{bje(o).isDirectory()?ZX(t,o,r):HX.test(i)&&r.push(o)}catch{continue}}return r}function GX(t="."){let e=qp(t,"spec","features"),r=qp(t,"tests"),n=[],i=[];if(!AD(e)||!AD(r))return{repaired:n,suggested:i};let o=ZX(r),s=new Map;for(let a of o){let c=UX(t,a).split("\\").join("/"),l=s.get(Up(a))??[];l.push(c),s.set(Up(a),l)}for(let a of qX(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=qp(e,a),l,u;try{l=_je(c,"utf8"),u=(0,BX.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(Sje.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(AD(qp(t,b)))continue;let _=s.get(Up(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>Up(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>UX(t,h).split("\\").join("/")).find(h=>{let g=Up(h).replace(HX,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 +`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function _X(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await jNe({port:e,cwd:t.cwd??"."});B("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){B("fail","graph",r.message),process.exit(1)}}var MNe=["stage_1.1","stage_2.1","stage_2.3"];function FNe(t){return(t.features??[]).filter(e=>e.status==="done")}function zNe(t,e){let r=FNe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function bX(t,e){let r=[];for(let n of MNe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=zNe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}Q_();import vX from"node:process";function LNe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function rw(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=LNe(n,t);i.pass||r.push(i)}return r}Hn();var fD="stage_4.1";function pD(t={}){let{cwd:e="."}=t,r=bn(e);if(r.length===0)return{stage:fD,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=rw(r);if(n.length===0)return{stage:fD,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:fD,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var UNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vX.argv[1]}`;if(UNe){let t=pD();console.log(JSON.stringify(t)),vX.exit(t.exitCode)}Ir();import SX from"node:process";var nw="stage_1.4";function mD(t={}){let{cwd:e="."}=t,r;try{r=et("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:nw,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:nw,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:nw,pass:!0,exitCode:0}:{stage:nw,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var qNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${SX.argv[1]}`;if(qNe){let t=mD();console.log(JSON.stringify(t)),SX.exit(t.exitCode)}Ir();zp();_n();import wX from"node:process";var iw="stage_2.2";function hD(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=as("coverage",t))}catch(a){return{stage:iw,pass:!1,exitCode:1,stderr:a.message}}if(!r||!n)return{stage:iw,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=et(r,[...n],{cwd:e,reject:!1}),s=zt(iw,r,o);return s||sr(iw,o)}var ZNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wX.argv[1]}`;if(ZNe){let t=hD();console.log(JSON.stringify(t)),wX.exit(t.exitCode)}Nb();gD();Ir();yn();_n();import $X from"node:process";var sw="stage_3.2";function yD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:sw,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Bc(e,o[o.length-1]))return{stage:sw,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=et(i,[...o],{cwd:e,reject:!1}),a=zt(sw,i,s);return a||sr(sw,s)}var VNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${$X.argv[1]}`;if(VNe){let t=yD();console.log(JSON.stringify(t)),$X.exit(t.exitCode)}Ir();at();_n();import{existsSync as WNe}from"node:fs";import{resolve as kX}from"node:path";import EX from"node:process";var Wt="stage_2.4",AX=5e3;function _D(t={}){let{cwd:e="."}=t,r,n=[],i=!1;try{let f=Y(e);r=f.project.deliverable,n=f.project.smoke??[],i=f.features.some(p=>p.status==="done")}catch{return{stage:Wt,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return KNe(e,n[0],i);if(!r)return{stage:Wt,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:Wt,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:Wt,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let o=kX(e,r.path);if(!WNe(o))return{stage:Wt,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let s=r.timeout_ms??AX,a;try{a=et(o,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:s})}catch(f){a=f}let c=zt(Wt,r.path,a);if(c)return c;if(a.timedOut)return{stage:Wt,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${s}ms (hung or too slow)`};let l=r.expect_exit??0,u=a.exitCode??1;if(u===l)return{stage:Wt,pass:!0,exitCode:0,disposition:"liveness"};let d=String(a.stderr??"").trim()||String(a.stdout??"").trim();return{stage:Wt,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${u}, expected ${l}${d?` \u2014 ${d.slice(0,200)}`:""}`}}function KNe(t,e,r){if(e.kind==="none")return{stage:Wt,pass:!0,exitCode:0,disposition:"na"};if(!r)return{stage:Wt,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 smoke probe skipped"};let n=e.run??[];if(n.length===0)return{stage:Wt,pass:!1,exitCode:2,stderr:"cli smoke probe has no run argv \u2014 skipped"};let[i,...o]=n,s=i.startsWith(".")||i.startsWith("/")?kX(t,i):i,a=AX,c;try{c=et(s,[...o],{cwd:t,reject:!1,timeout:a})}catch(p){c=p}let l=zt(Wt,i,c);if(l)return l;if(c.timedOut)return{stage:Wt,pass:!1,exitCode:1,stderr:`smoke probe '${n.join(" ")}' timed out after ${a}ms`};let u=e.expect?.exit??0,d=c.exitCode??1;if(d!==u){let p=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:Wt,pass:!1,exitCode:1,disposition:"fail",stderr:`smoke probe exited ${d}, expected ${u}${p?` \u2014 ${p.slice(0,200)}`:""}`}}let f=e.expect?.token;return f?String(c.stdout??"").includes(f)?{stage:Wt,pass:!0,exitCode:0,disposition:"pass"}:{stage:Wt,pass:!1,exitCode:1,disposition:"fail",stderr:`smoke probe ran (exit ${d}) but stdout did not contain the AC token ${JSON.stringify(f)}`}:{stage:Wt,pass:!0,exitCode:0,disposition:"liveness"}}var JNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${EX.argv[1]}`;if(JNe){let t=_D();console.log(JSON.stringify(t)),EX.exit(t.exitCode)}Ir();yn();_n();import TX from"node:process";var aw="stage_3.1";function bD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:aw,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Bc(e,o[o.length-1]))return{stage:aw,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=et(i,[...o],{cwd:e,reject:!1}),a=zt(aw,i,s);return a||sr(aw,s)}var YNe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${TX.argv[1]}`;if(YNe){let t=bD();console.log(JSON.stringify(t)),TX.exit(t.exitCode)}pP();vD();SD();Ir();zp();_n();import PX from"node:process";var uw="stage_2.1";function wD(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=as("test",t))}catch(a){return{stage:uw,pass:!1,exitCode:1,stderr:a.message}}if(!r||!n)return{stage:uw,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${i}'`};let o=et(r,[...n],{cwd:e,reject:!1}),s=zt(uw,r,o);return s||sr(uw,o)}var eje=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${PX.argv[1]}`;if(eje){let t=wD();console.log(JSON.stringify(t)),PX.exit(t.exitCode)}Ir();yn();_n();import RX from"node:process";var dw="stage_3.3";function xD(t={}){let{cwd:e="."}=t,r=pt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:dw,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Bc(e,o[o.length-1]))return{stage:dw,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=et(i,[...o],{cwd:e,reject:!1}),a=zt(dw,i,s);return a||sr(dw,s)}var tje=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${RX.argv[1]}`;if(tje){let t=xD();console.log(JSON.stringify(t)),RX.exit(t.exitCode)}var rje=new Set(["fail","pending_env","advisory"]);function Ra(t){return rje.has(t)}function CX(t){return t.disposition??(t.pass?"pass":t.exitCode===2?"skip":"fail")}function DX(t,e){return Ra(e)?t.disposition?1:t.exitCode:0}hP();kD();AD();_f();xb();var BX=kt(or(),1);import{existsSync as TD,readFileSync as bje,readdirSync as qX,statSync as vje,writeFileSync as Sje}from"node:fs";import{basename as Bp,join as Hp,relative as UX}from"node:path";var wje=["self-dogfood:","fixture:","derived:"],HX=/\.(test|spec)\.[jt]sx?$/;function ZX(t,e=t,r=[]){let n;try{n=qX(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Hp(e,i);try{vje(o).isDirectory()?ZX(t,o,r):HX.test(i)&&r.push(o)}catch{continue}}return r}function GX(t="."){let e=Hp(t,"spec","features"),r=Hp(t,"tests"),n=[],i=[];if(!TD(e)||!TD(r))return{repaired:n,suggested:i};let o=ZX(r),s=new Map;for(let a of o){let c=UX(t,a).split("\\").join("/"),l=s.get(Bp(a))??[];l.push(c),s.set(Bp(a),l)}for(let a of qX(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Hp(e,a),l,u;try{l=bje(c,"utf8"),u=(0,BX.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(wje.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(TD(Hp(t,b)))continue;let _=s.get(Bp(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>Bp(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>UX(t,h).split("\\").join("/")).find(h=>{let g=Bp(h).replace(HX,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 ${_}test_refs: -${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&vje(c,l,"utf8")}return{repaired:n,suggested:i}}Md();import{existsSync as wje,readFileSync as xje}from"node:fs";import{join as $je}from"node:path";function kje(t,e){let r=$je(t,e);if(!wje(r))return[];let n=[];for(let i of xje(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function VX(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>kje(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function WX(t){let e=[];e.push(`# Spec-conformance oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` -`)}$b();at();zo();Hn();Md();var Eje={ALL_FEATURES_DONE:"All work complete.",MAX_ITERATIONS:"Stopped \u2014 reached the iteration limit.",WALL_CLOCK:"Stopped \u2014 exceeded the time budget.",BUDGET_EXCEEDED:"Stopped \u2014 budget exhausted.",BLOCKED_FEATURE:"Stopped \u2014 a feature is blocked by dependencies.",RETRY_THRESHOLD:"Stopped \u2014 a feature failed too many times.",GATE_NO_PROGRESS:"Stopped \u2014 gates are not making progress.",HUMAN_REQUIRED:"Paused \u2014 needs human sign-off.",TRANSPORT_AUTH_FAILED:"Stopped \u2014 agent rejected the credentials. Check your API key.",TRANSPORT_RATE_LIMITED:"Stopped \u2014 agent is rate-limited. Try again after the cooldown.",TRANSPORT_NETWORK:"Stopped \u2014 could not reach the agent over the network.",LLM_UNAVAILABLE:"Stopped \u2014 could not reach the agent.",UNCAUGHT_ERROR:"Stopped \u2014 unexpected error."},Aje={"stage_1.1":"Type","stage_1.2":"Lint","stage_1.3":"Drift","stage_1.4":"Commit","stage_1.5":"Architecture","stage_1.6":"Secret","stage_2.1":"Unit tests","stage_2.2":"Coverage","stage_2.3":"Spec conformance","stage_2.4":"Deliverable smoke","stage_3.1":"Smoke","stage_3.2":"Performance","stage_3.3":"Visual","stage_4.1":"Audit","stage_4.2":"UAT"};function TD(t,e){let r=e.features.find(n=>n.id===t);return r&&r.title?r.title:t}function KX(t,e){let r=Eje[t.class]??"Stopped.",n=Tje(t.detail,e);return n?`${r} ${n}`:r}function gw(t){return Aje[t]??t}function Tje(t,e){return t?t.replace(/\bF-\d{3,}\b/g,r=>{let n=TD(r,e);return n===r?r:`"${n}"`}):""}var JX=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"];function Oje(t,e,r){if(e.startsWith("stage_4")){let n=_n(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return ew(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function Ije(t,e,r){let n=t.modules??[];if(t.status!=="done"||n.length===0)return"\xB7";if(e===null)return"-";let i=e.get(t.id);return i===void 0?"!":i===jd(r,n)?"\u2713":"!"}function YX(t,e=".",r={}){let n=r.internal??!1,i=vc(e),o=[...JX.map(l=>n?l.replace("stage_",""):Pje(l)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,c=t.features.map(l=>({featureId:l.id,title:l.title||l.id,cells:[...JX.map(u=>Oje(l,u,e)),Ije(l,i,e)]})).map(l=>{let u=l.cells.join(" ");return n?`${l.featureId.padEnd(12)} ${u} ${l.title}`:`${l.title.padEnd(35).slice(0,35)} ${u}`});return[s,...c].join(` -`)}function Pje(t){return gw(t).slice(0,3)}async function BZe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Qse(),Xse)),Promise.resolve().then(()=>(iae(),nae)),Promise.resolve().then(()=>(Cf(),QJ))]),i=e({cwd:t.cwd});n(i.server);let o=new r;K.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function HZe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await WY({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});for(let o of n.created)B("pass",`created ${o}`);for(let o of n.skipped)B("skip",o);for(let o of n.proposals??[])B("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(B("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){K.stdout.write(` +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&Sje(c,l,"utf8")}return{repaired:n,suggested:i}}Fd();import{existsSync as xje,readFileSync as $je}from"node:fs";import{join as kje}from"node:path";function Eje(t,e){let r=kje(t,e);if(!xje(r))return[];let n=[];for(let i of $je(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function VX(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>Eje(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function WX(t){let e=[];e.push(`# Spec-conformance oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` +`)}Eb();at();zo();Hn();Fd();var Aje={ALL_FEATURES_DONE:"All work complete.",MAX_ITERATIONS:"Stopped \u2014 reached the iteration limit.",WALL_CLOCK:"Stopped \u2014 exceeded the time budget.",BUDGET_EXCEEDED:"Stopped \u2014 budget exhausted.",BLOCKED_FEATURE:"Stopped \u2014 a feature is blocked by dependencies.",RETRY_THRESHOLD:"Stopped \u2014 a feature failed too many times.",GATE_NO_PROGRESS:"Stopped \u2014 gates are not making progress.",HUMAN_REQUIRED:"Paused \u2014 needs human sign-off.",TRANSPORT_AUTH_FAILED:"Stopped \u2014 agent rejected the credentials. Check your API key.",TRANSPORT_RATE_LIMITED:"Stopped \u2014 agent is rate-limited. Try again after the cooldown.",TRANSPORT_NETWORK:"Stopped \u2014 could not reach the agent over the network.",LLM_UNAVAILABLE:"Stopped \u2014 could not reach the agent.",UNCAUGHT_ERROR:"Stopped \u2014 unexpected error."},Tje={"stage_1.1":"Type","stage_1.2":"Lint","stage_1.3":"Drift","stage_1.4":"Commit","stage_1.5":"Architecture","stage_1.6":"Secret","stage_2.1":"Unit tests","stage_2.2":"Coverage","stage_2.3":"Spec conformance","stage_2.4":"Deliverable smoke","stage_3.1":"Smoke","stage_3.2":"Performance","stage_3.3":"Visual","stage_4.1":"Audit","stage_4.2":"UAT"};function OD(t,e){let r=e.features.find(n=>n.id===t);return r&&r.title?r.title:t}function KX(t,e){let r=Aje[t.class]??"Stopped.",n=Oje(t.detail,e);return n?`${r} ${n}`:r}function _w(t){return Tje[t]??t}function Oje(t,e){return t?t.replace(/\bF-\d{3,}\b/g,r=>{let n=OD(r,e);return n===r?r:`"${n}"`}):""}var JX=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"];function Ije(t,e,r){if(e.startsWith("stage_4")){let n=bn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return rw(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function Pje(t,e,r){let n=t.modules??[];if(t.status!=="done"||n.length===0)return"\xB7";if(e===null)return"-";let i=e.get(t.id);return i===void 0?"!":i===Md(r,n)?"\u2713":"!"}function YX(t,e=".",r={}){let n=r.internal??!1,i=wc(e),o=[...JX.map(l=>n?l.replace("stage_",""):Rje(l)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,c=t.features.map(l=>({featureId:l.id,title:l.title||l.id,cells:[...JX.map(u=>Ije(l,u,e)),Pje(l,i,e)]})).map(l=>{let u=l.cells.join(" ");return n?`${l.featureId.padEnd(12)} ${u} ${l.title}`:`${l.title.padEnd(35).slice(0,35)} ${u}`});return[s,...c].join(` +`)}function Rje(t){return _w(t).slice(0,3)}async function HZe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Qse(),Xse)),Promise.resolve().then(()=>(iae(),nae)),Promise.resolve().then(()=>(Nf(),QJ))]),i=e({cwd:t.cwd});n(i.server);let o=new r;K.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function ZZe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await WY({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});for(let o of n.created)B("pass",`created ${o}`);for(let o of n.skipped)B("skip",o);for(let o of n.proposals??[])B("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(B("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){K.stdout.write(` \u{1F4A1} \uB2E4\uC74C \uC815\uBCF4\uAC00 \uC788\uC73C\uBA74 \uB354 \uC815\uD655\uD55C \uC2A4\uD399\uC774 \uB429\uB2C8\uB2E4: `);for(let[o,s]of n.clarifyingQuestions.entries())K.stdout.write(` ${o+1}. ${s} `);K.stdout.write(` @@ -723,30 +723,30 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&vje(c,l,"u `),K.stdout.write(` \uC608: clad init \uACB0\uC81C SaaS for B2B `),K.stdout.write(` \uAE30\uC874 seeds \uB294 .cladding/scan/*.proposal \uB85C \uBD84\uAE30\uB429\uB2C8\uB2E4. -`));K.exit(0)}async function ZZe(t,e){B("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Oae(),Tae)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)B(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),K.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=J(e.cwd??"."),a=n.featuresTouched.map(l=>TD(l,s)),c=`${KX(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;B(i,"run",c),a.length>0&&K.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&B("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),K.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function GZe(t={}){try{let e=J(),r=Wo(".");Vc(".",r),da("."),y3(".");let n=GX(".");for(let o of n.repaired)B("note","test_refs",`repaired ${o.from} \u2192 ${o.to} (${o.shard})`);for(let o of n.suggested)B("note","test_refs",`suggested ${o.ref} (${o.shard}) \u2014 confirm by removing the 'derived:' prefix`);let i=hw(".");if(i&&B("note","deliverable",`auto-detected entry '${i.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`),t.proposeArchive){let s=Eb.run({cwd:"."}).filter(a=>a.suggestion?.action==="propose-archive");if(s.length===0){B("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),K.exit(0);return}for(let a of s){let c=a.suggestion?.args??{},l=String(c.featureId??"?"),u=String(c.reason??a.message);B("note",`propose-archive \xB7 ${l}`,u)}B("pass","sync",`${e.features.length} features \xB7 ${s.length} archive candidate(s)`),K.exit(0);return}B("pass","sync",`${e.features.length} features valid`),K.exit(0)}catch(e){B("fail","sync",e.message),K.exit(1)}}function VZe(t){if(!t){B("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),K.exit(2);return}let e=uw(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";B("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),K.exit(0)}function WZe(t,e={}){if(!t){B("fail","rollback","feature id required (e.g. clad rollback F-001)"),K.exit(2);return}let r=dw(".",t);if(!r){B("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),K.exit(1);return}fw(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";B("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?K.stdout.write(`Run: git checkout ${r.gitHead} +`));K.exit(0)}async function GZe(t,e){B("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Oae(),Tae)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)B(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),K.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=Y(e.cwd??"."),a=n.featuresTouched.map(l=>OD(l,s)),c=`${KX(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;B(i,"run",c),a.length>0&&K.stdout.write(`Touched: ${a.join(", ")} +`)}let o=n.stubsCreated.length>0;o&&B("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),K.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function VZe(t={}){try{let e=Y(),r=Wo(".");Kc(".",r),fa("."),y3(".");let n=GX(".");for(let o of n.repaired)B("note","test_refs",`repaired ${o.from} \u2192 ${o.to} (${o.shard})`);for(let o of n.suggested)B("note","test_refs",`suggested ${o.ref} (${o.shard}) \u2014 confirm by removing the 'derived:' prefix`);let i=yw(".");if(i&&B("note","deliverable",`auto-detected entry '${i.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`),t.proposeArchive){let s=Tb.run({cwd:"."}).filter(a=>a.suggestion?.action==="propose-archive");if(s.length===0){B("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),K.exit(0);return}for(let a of s){let c=a.suggestion?.args??{},l=String(c.featureId??"?"),u=String(c.reason??a.message);B("note",`propose-archive \xB7 ${l}`,u)}B("pass","sync",`${e.features.length} features \xB7 ${s.length} archive candidate(s)`),K.exit(0);return}B("pass","sync",`${e.features.length} features valid`),K.exit(0)}catch(e){B("fail","sync",e.message),K.exit(1)}}function WZe(t){if(!t){B("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),K.exit(2);return}let e=fw(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";B("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),K.exit(0)}function KZe(t,e={}){if(!t){B("fail","rollback","feature id required (e.g. clad rollback F-001)"),K.exit(2);return}let r=pw(".",t);if(!r){B("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),K.exit(1);return}mw(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";B("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?K.stdout.write(`Run: git checkout ${r.gitHead} `):K.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),K.exit(0)}async function KZe(t){let e=await W1({force:t.force,quiet:t.quiet});K.exit(e.errors.length>0?1:0)}async function JZe(){B("note","update","reconciling the current project after the engine upgrade");let t=await bJ(".",{wireHosts:async()=>(await W1({quiet:!0})).errors.length});if(B(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){B("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),K.exit(t.code);return}B("pass","spec",`inventory synced \xB7 ${t.features} features`),B(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),B(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)B("note","deprecated",r);K.stdout.write(` +`),K.exit(0)}async function JZe(t){let e=await K1({force:t.force,quiet:t.quiet});K.exit(e.errors.length>0?1:0)}async function YZe(){B("note","update","reconciling the current project after the engine upgrade");let t=await bJ(".",{wireHosts:async()=>(await K1({quiet:!0})).errors.length});if(B(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){B("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),K.exit(t.code);return}B("pass","spec",`inventory synced \xB7 ${t.features} features`),B(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),B(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)B("note","deprecated",r);K.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),M2({tier:"pre-commit",strict:!0}).anyFailed?K.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):B("pass","drift","clean against the stricter detectors"),K.exit(t.code)}var YZe={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function M2(t){let e=t.tier??"all",r=YZe[e];if(!r)return t.json?K.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):B("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0};let n={focusModules:t.focusModules},o=[["stage_1.1",()=>zp(n)],["stage_1.2",()=>Fp(n)],["stage_1.3",()=>so({...n,strict:t.strict})],["stage_1.4",pD],["stage_1.5",aa],["stage_1.6",Tf],["stage_2.1",()=>SD(n)],["stage_2.2",()=>mD(n)],["stage_2.3",uP],["stage_2.4",yD],["stage_3.1",_D],["stage_3.2",gD],["stage_3.3",wD],["stage_4.1",fD],["stage_4.2",Lp]].filter(([u])=>r.includes(u)),s=0,a=!1,c=u=>u==="pass"?"pass":u==="liveness"?"note":u==="na"?"skip":Pa(u)?"fail":"skip",l=[];for(let[u,d]of o){let f=d({}),p=t.internal?u:gw(u),m=CX(f);Pa(m)&&(a=!0,s=Math.max(s,DX(f,m))),l.push({stage:u,label:p,status:m,exitCode:f.exitCode,stderr:f.stderr,findings:f.findings}),t.json||(B(c(m),p),Pa(m)&&oGe(f))}if(t.strict)try{let u=J();for(let d of bX(u,l))s=Math.max(s,1),a=!0,l.push({stage:d.stage,label:d.label,status:"fail",exitCode:1,stderr:d.message}),t.json||B("fail",d.label,d.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let u=l.find(m=>m.stage==="stage_1.3"),d=(u?.findings??[]).filter(m=>m.severity==="error"||m.severity==="warn"),f=u?.status==="fail"&&d.length>0&&d.every(m=>m.detector==="STALE_ATTESTATION"),p=l.every(m=>m.stage==="stage_1.3"||!Pa(m.status));if(f&&p&&u&&(u.status="pass",u.exitCode=0,u.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",a=l.some(m=>Pa(m.status)),s=a?Math.max(1,s):0,t.json||B("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!a)try{S6(".",J())&&(t.json||B("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json?K.stdout.write(`${JSON.stringify({tier:e,worst:s,anyFailed:a,stages:l},null,2)} -`):a&&K.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),Ki(".","gate_run",{tier:e,strict:t.strict===!0,worst:s,anyFailed:a}),{worst:s,anyFailed:a}}function XZe(t){try{let e=J(),r=Tl(e,t);K.stdout.write(`${JSON.stringify(r,null,2)} -`),K.exit("not_found"in r?1:0)}catch(e){B("fail","context",e.message),K.exit(1)}}function QZe(t,e={}){try{let r=J(),n=e.depth!==void 0?Number(e.depth):void 0,i=bn(r,t,{depth:n});K.stdout.write(`${JSON.stringify(i,null,2)} -`),K.exit("not_found"in i?1:0)}catch(r){B("fail","impact",r.message),K.exit(1)}}function eGe(t={}){try{let e=J(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Rb(e,o=>{try{return Pae(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});K.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),K.exit(0)}catch(e){B("fail","infer-deps",e.message),K.exit(1)}}function tGe(t={}){try{let e=J(),n=sX(e,i=>{try{return Pae(i,"utf8")}catch{return null}},".");if(t.json)K.stdout.write(`${JSON.stringify(n,null,2)} +`),M2({tier:"pre-commit",strict:!0}).anyFailed?K.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):B("pass","drift","clean against the stricter detectors"),K.exit(t.code)}var XZe={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function M2(t){let e=t.tier??"all",r=XZe[e];if(!r)return t.json?K.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):B("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0};let n={focusModules:t.focusModules},o=[["stage_1.1",()=>Up(n)],["stage_1.2",()=>Lp(n)],["stage_1.3",()=>so({...n,strict:t.strict})],["stage_1.4",mD],["stage_1.5",ca],["stage_1.6",Of],["stage_2.1",()=>wD(n)],["stage_2.2",()=>hD(n)],["stage_2.3",fP],["stage_2.4",_D],["stage_3.1",bD],["stage_3.2",yD],["stage_3.3",xD],["stage_4.1",pD],["stage_4.2",qp]].filter(([u])=>r.includes(u)),s=0,a=!1,c=u=>u==="pass"?"pass":u==="liveness"?"note":u==="na"?"skip":Ra(u)?"fail":"skip",l=[];for(let[u,d]of o){let f=d({}),p=t.internal?u:_w(u),m=CX(f);Ra(m)&&(a=!0,s=Math.max(s,DX(f,m))),l.push({stage:u,label:p,status:m,exitCode:f.exitCode,stderr:f.stderr,findings:f.findings}),t.json||(B(c(m),p),Ra(m)&&sGe(f))}if(t.strict)try{let u=Y();for(let d of bX(u,l))s=Math.max(s,1),a=!0,l.push({stage:d.stage,label:d.label,status:"fail",exitCode:1,stderr:d.message}),t.json||B("fail",d.label,d.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let u=l.find(m=>m.stage==="stage_1.3"),d=(u?.findings??[]).filter(m=>m.severity==="error"||m.severity==="warn"),f=u?.status==="fail"&&d.length>0&&d.every(m=>m.detector==="STALE_ATTESTATION"),p=l.every(m=>m.stage==="stage_1.3"||!Ra(m.status));if(f&&p&&u&&(u.status="pass",u.exitCode=0,u.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",a=l.some(m=>Ra(m.status)),s=a?Math.max(1,s):0,t.json||B("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!a)try{S6(".",Y())&&(t.json||B("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json?K.stdout.write(`${JSON.stringify({tier:e,worst:s,anyFailed:a,stages:l},null,2)} +`):a&&K.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),Ki(".","gate_run",{tier:e,strict:t.strict===!0,worst:s,anyFailed:a}),{worst:s,anyFailed:a}}function QZe(t){try{let e=Y(),r=Ol(e,t);K.stdout.write(`${JSON.stringify(r,null,2)} +`),K.exit("not_found"in r?1:0)}catch(e){B("fail","context",e.message),K.exit(1)}}function eGe(t,e={}){try{let r=Y(),n=e.depth!==void 0?Number(e.depth):void 0,i=Jr(r,t,{depth:n});K.stdout.write(`${JSON.stringify(i,null,2)} +`),K.exit("not_found"in i?1:0)}catch(r){B("fail","impact",r.message),K.exit(1)}}function tGe(t={}){try{let e=Y(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Db(e,o=>{try{return Pae(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});K.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),K.exit(0)}catch(e){B("fail","infer-deps",e.message),K.exit(1)}}function rGe(t={}){try{let e=Y(),n=sX(e,i=>{try{return Pae(i,"utf8")}catch{return null}},".");if(t.json)K.stdout.write(`${JSON.stringify(n,null,2)} `);else{let i=n.context,o=i.truncatedCount>0?`budget enforces ${i.medianShrinkTruncated}x on ${i.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",s=i.fitsCount>0?`${i.medianShrinkFit}x on ${i.fitsCount} fitting`:"none fit untruncated",a=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${i.medianSliceTokens} tok vs naive ${i.medianNaiveTokens} tok \u2014 ${o}, ${s}`,` uncapped structural slice = ${i.medianStructuralRatio}x of naive \u2014 the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`," (deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"];K.stdout.write(`${a.join(` `)} -`)}K.exit(0)}catch(e){B("fail","measure",e.message),K.exit(1)}}function rGe(t){let e;if(t.feature)try{let n=(J().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(B("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),K.exit(1)),e=n.modules}catch(r){B("fail","check",r.message),K.exit(1)}K.exit(M2({...t,focusModules:e}).worst)}function nGe(t){let e=A6(".",t,{checkStages:M2,onIndex:da});B(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),K.exit(e.code)}function iGe(t,e={}){let r=e.cwd??".",n;try{n=J(r)}catch(o){B("fail","oracle",`spec not loaded: ${o.message}`),K.exit(1);return}if(e.required){t&&K.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`)}K.exit(0)}catch(e){B("fail","measure",e.message),K.exit(1)}}function nGe(t){let e;if(t.feature)try{let n=(Y().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(B("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),K.exit(1)),e=n.modules}catch(r){B("fail","check",r.message),K.exit(1)}K.exit(M2({...t,focusModules:e}).worst)}function iGe(t){let e=A6(".",t,{checkStages:M2,onIndex:fa});B(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),K.exit(e.code)}function oGe(t,e={}){let r=e.cwd??".",n;try{n=Y(r)}catch(o){B("fail","oracle",`spec not loaded: ${o.message}`),K.exit(1);return}if(e.required){t&&K.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') `);let o=S3(n);if(o.length===0){K.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),K.exit(0);return}let s=o.filter(a=>!a.hasOracle);for(let a of o){let c=a.hasOracle?"\u2713":"\xB7",l=a.hasOracle?"":" \u2190 needs an impl-blind oracle";K.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}K.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. `),K.exit(s.length>0?1:0);return}if(!t){B("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),K.exit(1);return}let i=VX(n,t,e.ac,r);if(!i||i.acs.length===0){B("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),K.exit(1);return}K.stdout.write(`${WX(i)} -`),K.exit(0)}function oGe(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=i.path?` ${i.path}`:"";K.stdout.write(` [${i.detector}]${o} \u2014 ${Iae(i.message,140)} +`),K.exit(0)}function sGe(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=i.path?` ${i.path}`:"";K.stdout.write(` [${i.detector}]${o} \u2014 ${Iae(i.message,140)} `)}n.length>3&&K.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` `).find(r=>r.trim().length>0);e&&K.stdout.write(` ${Iae(e.trim(),160)} -`)}}function Iae(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function sGe(t){let e=J();K.stdout.write(`${YX(e,".",{internal:t.internal})} -`),K.exit(0)}function aGe(t){let e=nE(t);B("note",`route \u2192 ${e}`,t),K.exit(e==="unknown"?1:0)}var cGe={refine:"clarify",panel:"status",drive:"run"};function lGe(t){let e=t?cGe[t]:void 0;e&&K.stderr.write(`cladding: '${t}' is now '${e}' \u2014 the old verb is removed in 0.8 -`)}function uGe(){let t=new Y2;t.name("clad").description("Reference Ironclad CLI").version("0.7.0"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init \uACB0\uC81C SaaS for B2B`) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").action(HZe),t.command("run [goal]").alias("drive").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(ZZe),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(GZe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(KZe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(JZe),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(rGe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(VZe),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(nGe),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>iGe(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(WZe),t.command("status").alias("panel").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").action(sGe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(XZe),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>QZe(r,n)),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>eGe(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full per-feature report as JSON").action(r=>tGe(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>gX(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>yX()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{_X(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").action(r=>h6(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(aGe),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(fJ),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(BZe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").action($6),t.command("clarify [answer...]").alias("refine").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, e.g. `clad clarify \uBC95\uC778 \uC0AC\uC5C5\uC790\uB9CC`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(eX),t}var dGe=!!globalThis.__CLADDING_BUNDLED,fGe=dGe||import.meta.url===`file://${K.argv[1]}`;fGe&&(lGe(K.argv[2]),uGe().parse());export{cGe as RENAMED_VERBS,YZe as TIER_STAGES,uGe as createProgram,lGe as printVerbDeprecationNotice,rGe as runCheckCommand,M2 as runCheckStages,VZe as runCheckpointCommand,XZe as runContextCommand,nGe as runDoneCommand,QZe as runImpactCommand,eGe as runInferDepsCommand,HZe as runInitCommand,tGe as runMeasureCommand,iGe as runOracleCommand,WZe as runRollbackCommand,aGe as runRouteCommand,ZZe as runRunCommand,BZe as runServeCommand,KZe as runSetupCommand,sGe as runStatusCommand,GZe as runSyncCommand,JZe as runUpdateCommand}; +`)}}function Iae(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function aGe(t){let e=Y();K.stdout.write(`${YX(e,".",{internal:t.internal})} +`),K.exit(0)}function cGe(t){let e=oE(t);B("note",`route \u2192 ${e}`,t),K.exit(e==="unknown"?1:0)}var lGe={refine:"clarify",panel:"status",drive:"run"};function uGe(t){let e=t?lGe[t]:void 0;e&&K.stderr.write(`cladding: '${t}' is now '${e}' \u2014 the old verb is removed in 0.8 +`)}function dGe(){let t=new Y2;t.name("clad").description("Reference Ironclad CLI").version("0.7.0"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init \uACB0\uC81C SaaS for B2B`) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").action(ZZe),t.command("run [goal]").alias("drive").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(GZe),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(VZe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(JZe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(YZe),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(nGe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(WZe),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(iGe),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>oGe(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(KZe),t.command("status").alias("panel").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").action(aGe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(QZe),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>eGe(r,n)),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>tGe(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full per-feature report as JSON").action(r=>rGe(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>gX(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>yX()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{_X(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").action(r=>h6(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(cGe),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(fJ),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(HZe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").action($6),t.command("clarify [answer...]").alias("refine").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, e.g. `clad clarify \uBC95\uC778 \uC0AC\uC5C5\uC790\uB9CC`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(eX),t}var fGe=!!globalThis.__CLADDING_BUNDLED,pGe=fGe||import.meta.url===`file://${K.argv[1]}`;pGe&&(uGe(K.argv[2]),dGe().parse());export{lGe as RENAMED_VERBS,XZe as TIER_STAGES,dGe as createProgram,uGe as printVerbDeprecationNotice,nGe as runCheckCommand,M2 as runCheckStages,WZe as runCheckpointCommand,QZe as runContextCommand,iGe as runDoneCommand,eGe as runImpactCommand,tGe as runInferDepsCommand,ZZe as runInitCommand,rGe as runMeasureCommand,oGe as runOracleCommand,KZe as runRollbackCommand,cGe as runRouteCommand,GZe as runRunCommand,HZe as runServeCommand,JZe as runSetupCommand,aGe as runStatusCommand,VZe as runSyncCommand,YZe as runUpdateCommand}; diff --git a/spec.yaml b/spec.yaml index 36794313..738776f3 100644 --- a/spec.yaml +++ b/spec.yaml @@ -49,8 +49,8 @@ project: # Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand. inventory: - features: 199 + features: 200 scenarios: 2 capabilities: 6 - test_files: 170 + test_files: 171 last_synced: "2026-07-02" diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 74baed6a..9af83a4c 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -50,7 +50,7 @@ attested: F-041: cddb50fc41e49066 F-042: d1f661281bb9fb6e F-043: 2c5f4a94e3e57e9b - F-044: e6e44528a461c0f5 + F-044: 1bf702635dbbf92a F-045: b494c9a80442ac20 F-046: 4b563fce74b6bb4b F-047: baf5a2dbb9bb5a4b @@ -75,17 +75,17 @@ attested: F-067: 6e6dbd05bf314b56 F-068: 058091774fa65ef8 F-069: 9cf62671c6057a36 - F-06dfdad6: 40a338458a879a3d + F-06dfdad6: f2046016be8f0937 F-070: e50bb5d3addc7720 F-071: 3183a483a8015d4c F-072: 44e1d39139c816cc - F-073: 94a40afd6119e9aa - F-074: 086d43ceef38da3f + F-073: 1461ea9027fd955f + F-074: c35e987c6de7f53f F-075: 4d8346cb6a1bbd14 F-076: 0061ab2d4b4991a8 F-077: 7aac44757146b695 F-078: c6af3d128b98f4e6 - F-079: aa032a8dc1704024 + F-079: 2450b633a8a11ebc F-080: 1c19da74d32894e6 F-081: 248f9660cfb1b02b F-098d3b: 42d61bf806ce462b @@ -94,23 +94,23 @@ attested: F-0f2984d0: a85294b0b4128d5d F-12d740: 84ad71574d306c81 F-15999130: 894b484b7a93690c - F-16138071: 12d9c7b057fea527 + F-16138071: b6dd70f1d2840a50 F-16746b: 2f98a1261b9b1fc2 F-17df0a: 915d13b33258d3fc F-18e951: d907c170a230e052 F-1c9166: 09dad0dc6b0be87d - F-1d23a6: 1a236a840d631afb + F-1d23a6: 6b019e8fe121c8e7 F-1edb38: 64283112a3ab96ce - F-24062d: 7b14f2aef3ceee4d + F-24062d: 54e8fc1e30006a78 F-245bd5: a8372aeb83acc411 F-2be3e3bb: a85294b0b4128d5d F-2de65d: 84ad71574d306c81 F-315fd7: c3b042c80fa7c187 F-31eeb8: d88a9880d29ae411 - F-32b1e0: 9792422c1c008207 + F-32b1e0: 4cc7240778eaae75 F-3788c2: af9778dea8687b29 F-37b4a8: e067655bad681488 - F-3a5339: 0dfdeec23abfa841 + F-3a5339: 7d790460b97b35a7 F-3b3690: 6a36aad282d36f3a F-40327b: 8295358f7b813c8a F-417ff0: dde21c2716b745dc @@ -119,41 +119,41 @@ attested: F-4747ef: c255a18b6849d002 F-4db939: b2c386ca4e18c117 F-50ff43: fac674314685a912 - F-551a1c: 30bb1ad68313708f + F-551a1c: b3df5ef23910b386 F-569f4b37: b65f8d46b6e57af7 F-56abaa: 34257a997efcb048 - F-570a3f: d424bb82a591d619 + F-570a3f: dfb4267629a84295 F-59f093: 26735424fba6308c F-5b188856: d1e2e4184aa76c12 - F-5b9f9f: dcc903a25cdfe77f + F-5b9f9f: c9f8b72b10fa5d7c F-5d3ed2: 9452eac28760fb99 F-5f6b45: 15323c4f5b619de7 - F-64a5c159: a14622fa5f30f985 + F-64a5c159: dd42d7d046380184 F-65814a: 2136c8b8c94ef535 F-67d2e9: ad7a8fe2939cd13c - F-67e33f: 77f9d583176bb4f2 + F-67e33f: 80a0b17ae9fc4a2b F-6d943d: e02e71ed007aded2 F-6f80e7: 0c0e5b71ae22cc26 F-7076f7: 7e819e0d440f3ffe - F-7794a6bc: 1eb3a1bcee7017dc + F-7794a6bc: ca831090957472c9 F-77f7ead0: 4fd1ec36a5726fe9 F-78b50d: 688e6afe2352a034 F-7afbd4: 18ce48352bee0fce F-7ce18e: 7effa760a0661b6a F-7fa4a7: 19b7709a0b2202e3 F-80d19d: 4988733647f7777d - F-836a90: 2397ddde473a959a + F-836a90: 9e5bbc7ff223634b F-8f419e: f3473746f4e252bc - F-904495a5: 2edac28aac267ee6 + F-904495a5: 1684fb1beb040cab F-9064ff: 9efbbb6021aadfb9 F-94dda4: 8dfb0267c45534f9 - F-95a096: 29bc5fbffce6f117 - F-96250595: c095846f30f2eb0e + F-95a096: e8ed4fb958234914 + F-96250595: 41b790c427d2b01b F-96700032: 5ae97b4c82c14acc F-99c6e5: 8a8724852f1d6059 F-9a3b61: 786eeefef2d25138 F-9b643e: b0672cf024eacf79 - F-9d168287: 34d2194d7ab98cf5 + F-9d168287: c78b3fdff9219838 F-a04cd9: e65d87671306d305 F-a4b512: d136f2a1bbc4383a F-a5228c: aaf1d6876a5c7221 @@ -177,15 +177,16 @@ attested: F-c2c996: c92ab5bb0fbd1367 F-c48eb2: 9358d7394e88e95c F-c4c5ae: 18200d79542ae22e + F-c6a32fff: 056320bfd510c090 F-c8aef8: 02e07f929a1d0ded F-cd0415: 9cf6ce40e2a8b381 F-cfba0c: 077c03b8a96f562b F-d12edf: c19aa5d1007e0b8f - F-d2c806: 5aa60f71bbd0a136 + F-d2c806: 829db2373596bbdd F-d3bde4: 915d13b33258d3fc F-d49585: f3ef2fc02122533a - F-d6b93648: 065d493eb44c4b7b - F-d7312b: 9b7db1624caf7302 + F-d6b93648: d272c3163ca37592 + F-d7312b: cdba5500f011277e F-d8223c: 0501e9564231899b F-d980359c: 8f1559276afc5c03 F-dd51b42c: 496eeffa2641169d diff --git a/spec/capabilities.yaml b/spec/capabilities.yaml index 26a5c274..5c28baba 100644 --- a/spec/capabilities.yaml +++ b/spec/capabilities.yaml @@ -37,4 +37,4 @@ capabilities: title: "Knowledge graph (spec↔code↔doc)" summary: "Always-current, bidirectional graph over the SSoT: reverse-index backlinks, blast-radius impact queries, doc↔spec/doc link integrity, and viewer exports (mermaid/Obsidian/DOT/JSON) + hub stats. Retrieval/traceability, not correctness." surface: tool - features: [F-ee47fc2b, F-7794a6bc, F-ee5f643e, F-569f4b37, F-02343cd1, F-64a5c159, F-8234ec3c, F-04f50847, F-af45042a] + features: [F-ee47fc2b, F-7794a6bc, F-ee5f643e, F-569f4b37, F-02343cd1, F-64a5c159, F-8234ec3c, F-04f50847, F-af45042a, F-c6a32fff] diff --git a/spec/features/graph-honest-fallback-c6a32fff.yaml b/spec/features/graph-honest-fallback-c6a32fff.yaml new file mode 100644 index 00000000..883596eb --- /dev/null +++ b/spec/features/graph-honest-fallback-c6a32fff.yaml @@ -0,0 +1,71 @@ +id: F-c6a32fff +slug: graph-honest-fallback +title: "Fallback safety contract — a graph answer that cannot know says so and points back to baseline search" +status: done +modules: + - src/optimizer/reverse-slice.ts + - src/optimizer/iterative-slice.ts + - src/optimizer/working-set.ts + - src/optimizer/measurement.ts + - src/cli/hook.ts + - src/serve/server.ts + - src/optimizer/context-slice.ts +acceptance_criteria: + - id: AC-30e00a5c + ears: state + condition: "while the spec declares zero depends_on edges (a blank dependency ledger — the state of every freshly adopted project)" + action: "attach a ledger block {depends_on_edges, test_ref_edges} to every impact slice and, when a count is zero, a fallback hint telling the agent the answer means unknown-not-safe and to fall back to normal code search / the full suite" + response: "an empty impacted list on a blank map is distinguishable from a verified leaf on a dense map — the graph never converts \"no data\" into \"nothing breaks\"" + text: "While the dependency ledger is empty, the system shall mark impact answers with ledger counts and a fallback hint so blank-map emptiness is distinguishable from verified emptiness." + test_refs: + - "tests/optimizer/reverse-slice.test.ts#BLANK ledger: impacted:[] carries zero-counts + fallback hints — unknown, not safe (F-c6a32fff)" + - "tests/optimizer/reverse-slice.test.ts#DENSE ledger: a verified leaf shows real edge counts and NO hints — distinguishable from blank" + notes: "## Why\nMeasured (vapt clone, 196 features/0 edges): a feature with 10 real dependents answered impacted:[] coverage:1.0 — byte-identical to a verified leaf. 44% of cladding-self features hit the totalKnown=0 path, so this is a mainstream path, not an edge case. Ledger is the SOLE blank-vs-leaf disambiguator (3-case simulation, wf_04e7f5b8)." + - id: AC-67150016 + ears: state + condition: "while an impact query resolves to a feature with zero known dependents" + action: "stop the iterative widening with stoppedBy 'no-known-dependents' and coverage null (never a vacuous coverage 1.0), and carry total_known_dependents through the working-set radius" + response: "consumers see \"no dependents are known\" instead of \"100% of the blast radius is covered\"" + text: "While a feature has zero known dependents, the iterative impact slice shall report stoppedBy no-known-dependents with coverage null, and the working-set radius shall include total_known_dependents." + test_refs: + - "tests/optimizer/iterative-slice.test.ts#zero known dependents stops honestly: no-known-dependents + coverage null, never a vacuous 1.0 (F-c6a32fff)" + - "tests/optimizer/working-set.test.ts#blank-ledger radius: no-known-dependents, coverage null (not 0), denominator + ledger surfaced (F-c6a32fff)" + notes: "## Decision\ncoverage:null (not 0/1): JS null*100===0, so the working-set rounding site needs an explicit null guard or the radius would show a legitimate-looking FALSE 0% (simulation-caught). measurement.ts excludes null coverages from its median." + - id: AC-85daff2d + ears: unwanted + condition: "if the Stop or PostToolUse hook fires in a cwd that has no spec.yaml (a non-cladding project or an unrelated directory)" + action: "return silence without running the gate and without writing any .cladding/ state — mirroring the SessionStart guard" + response: "cladding never blocks a session or pollutes a tree that did not adopt it" + text: "If spec.yaml is absent from the hook cwd, the Stop and PostToolUse hooks shall print nothing and write nothing." + test_refs: + - "tests/cli/hook.test.ts#Stop in a spec-less cwd → silence, no drift run, no .cladding/ writes" + - "tests/cli/hook.test.ts#PostToolUse in a spec-less cwd → silence, no drift run, no stamp write" + notes: "## Why\nReproduced with the shipped bundle: in a spec-less dir the Stop hook blocked with 4 ABSENCE findings and wrote 3 state files; a monorepo SUBDIR of a valid cladding project behaved identically (hook cwd is process.cwd(), no upward search) — the guard is a repair there, not a regression. Broken-but-present spec keeps its honest one-time block." + - id: AC-c57ea33e + ears: unwanted + condition: "if the drift engine throws while computing the gate footer that rides mutating MCP tool results" + action: "report {pass:false, unavailable:true} with a pointer to clad check --strict instead of fabricating a passing gate" + response: "an engine fault reads as \"gate could not run\", never as a verified GREEN, on the one structural channel hosts without lifecycle hooks can see" + text: "If the gate footer cannot run, the system shall report pass:false with unavailable:true rather than a fabricated pass:true." + test_refs: + - "tests/serve/gate-footer-unavailable.test.ts#a throwing drift engine yields gate {pass:false, unavailable:true} on a mutating tool result" + notes: "## Decision\npass:false stays alongside unavailable:true — removing the pass field would contradict F-570a3f's wire contract (drift pass flag) and hosts branching on gate.pass; explicit false is fail-closed at zero migration cost (simulation: no test pins the catch branch)." + - id: AC-6704a592 + ears: event + condition: "when a graph MCP tool cannot load the spec, or a graph query misses" + action: "answer with the loadSpecOrError guidance (run clad init) instead of a raw ENOENT, include the discovery hint on clad_get_graph misses like its sibling tools, and extend discovery hints with the baseline fallback (normal code search)" + response: "every graph-tool failure tells the agent how to proceed WITHOUT the graph" + text: "When a graph tool fails to answer, the system shall include recovery guidance: clad init for a missing spec, and fall-back-to-normal-search wording in the miss discovery hints." + test_refs: + - "tests/serve/server.test.ts#read surfaces degrade gracefully when spec.yaml is absent (no crash)" + notes: "## Why\nclad_list_features already had this precedent (loadSpecOrError); the four graph tools shipped with raw err.message. Zero tests pin the raw ENOENT text (simulation), so this is a text-only change." + - id: AC-10b1a2f8 + ears: event + condition: "when the PostToolUse impact card renders on a blank ledger, or the SessionStart card renders over an unparseable spec whose counts could not be resolved from any source" + action: "append a one-token 'deps unledgered' disclosure to the impact card, and replace the counts line with 'spec.yaml present but unparseable — counts unavailable' only when parsing failed AND no count source resolved" + response: "the push surfaces stop rendering unknown states as healthy ones, without adding noise to dense-ledger projects" + text: "When rendering over a blank ledger or an unparseable spec with no resolvable counts, the push cards shall disclose the unknown state instead of rendering it as empty-and-healthy." + test_refs: + - "tests/cli/impact-card.test.ts#a blank ledger discloses itself; a dense ledger does not; the empty-card path stays empty (F-c6a32fff)" + - "tests/cli/hook.test.ts#SessionStart over an unparseable spec with no other count source → honest counts-unavailable line" + notes: "## Decision\nSessionStart line is conditional on parseFailed AND !counted — spec/index.yaml is the primary count source, so an unparseable master with a healthy index still renders true counts (unconditional rendering would be wrong more often than right — simulation)." diff --git a/spec/index.yaml b/spec/index.yaml index 72195000..d987955b 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -178,6 +178,7 @@ features: F-c2c996: {slug: checkpoint-events, status: done, modules: 3} F-c48eb2: {slug: scan-source-roots, status: done, modules: 5} F-c4c5ae: {slug: spec-conformance-oracle-stage, status: done, modules: 8} + F-c6a32fff: {slug: graph-honest-fallback, status: done, modules: 7} F-c6c3daaf: {slug: kotlin-module-scoped-gate, status: in_progress, modules: 13} F-c8aef8: {slug: project-context, status: done, modules: 5} F-cd0415: {slug: spec-load-once, status: done, modules: 2} diff --git a/src/cli/hook.ts b/src/cli/hook.ts index c23c3538..9fec457b 100644 --- a/src/cli/hook.ts +++ b/src/cli/hook.ts @@ -79,10 +79,11 @@ function renderSessionStartCard(cwd: string): string { const specPath = join(cwd, 'spec.yaml'); if (!existsSync(specPath)) return ''; let spec: SpecDoc = {}; + let parseFailed = false; try { spec = (parseYaml(readFileSync(specPath, 'utf8')) as SpecDoc | null) ?? {}; } catch { - /* unparseable spec → counts degrade to the inventory defaults below */ + parseFailed = true; // counts may still resolve via spec/index.yaml (the primary source) } let total = 0; @@ -132,8 +133,13 @@ function renderSessionStartCard(cwd: string): string { ? spec.scenarios.length : 0; + // An unparseable master with NO other count source must not render as a + // verified-empty "0 features" project (F-c6a32fff). Conditional on !counted: + // sharded projects usually still count fine via spec/index.yaml. const lines: string[] = [ - `cladding: ${total} features (${done} done, ${inProgress.length} in progress) · ${scenarios} scenarios`, + parseFailed && !counted + ? 'cladding: spec.yaml present but unparseable — counts unavailable (run clad check)' + : `cladding: ${total} features (${done} done, ${inProgress.length} in progress) · ${scenarios} scenarios`, ]; if (inProgress.length > 0) { lines.push(`in progress: ${inProgress.slice(0, 3).map((f) => `${f.id} ${f.slug}`).join(', ')}`); @@ -282,6 +288,11 @@ function stopBlockPath(cwd: string): string { */ function runStopGate(input: unknown, cwd: string): string { if (asRecord(input).stop_hook_active === true) return ''; + // Not under cladding → not our session to gate (SessionStart parity, F-c6a32fff). + // Without this, a spec-less cwd (non-cladding repo, or a SUBDIR of a cladding + // monorepo — the hook cwd is process.cwd(), no upward search) got falsely + // BLOCKED by ABSENCE_OF_GOVERNANCE and had .cladding/ state written into it. + if (!existsSync(join(cwd, 'spec.yaml'))) return ''; const failures: StopFailure[] = []; try { const drift = runDrift({strict: true, cwd}); @@ -380,7 +391,11 @@ export function formatImpactCard(slice: ImpactSlice, filePath: string): string { const co = owners.length > 1 ? ` (+${owners.length - 1} co-owner${owners.length > 2 ? 's' : ''})` : ''; const breaks = slice.impacted.length > 0 ? ` · breaks ${slice.impacted.length} feature(s)` : ''; const tests = slice.test_refs.length > 0 ? ` · run ${slice.test_refs.length} test(s)` : ''; - return `cladding impact: ${filePath} → ${label}${co}${breaks}${tests}`; + // Blank ledger disclosure: empty breaks/tests segments must not read as "verified + // safe" when NO depends_on edge exists project-wide (strict === 0 — old-shaped + // slices without a ledger stay unmarked rather than mis-firing). + const unledgered = slice.ledger?.depends_on_edges === 0 ? ' · deps unledgered' : ''; + return `cladding impact: ${filePath} → ${label}${co}${breaks}${tests}${unledgered}`; } /** @@ -393,6 +408,8 @@ function runPostToolUseDrift(input: unknown, cwd: string): string { if (!WRITE_TOOLS.has(asString(rec.tool_name))) return ''; const filePath = asString(asRecord(rec.tool_input).file_path); if (!isWatchedSourcePath(filePath)) return ''; + // Not under cladding → no drift nudges and no .cladding/ writes (SessionStart parity). + if (!existsSync(join(cwd, 'spec.yaml'))) return ''; const stampPath = join(cwd, '.cladding', 'hook-drift-ts'); const now = Date.now(); try { diff --git a/src/optimizer/context-slice.ts b/src/optimizer/context-slice.ts index e5102abd..6dbd80ab 100644 --- a/src/optimizer/context-slice.ts +++ b/src/optimizer/context-slice.ts @@ -49,7 +49,9 @@ export function buildContextSlice(spec: Spec, query: string): ContextSlice | Con return { not_found: query, accepted_forms: ['feature id (F-…)', 'slug', 'module path (e.g. src/auth/login.ts)'], - discovery: 'grep spec/index.yaml — one line per feature (id, slug, status), regenerated by clad sync', + discovery: + 'grep spec/index.yaml — one line per feature (id, slug, status; run clad sync if missing); ' + + 'if the query is a file, fall back to normal code search — the graph only knows declared modules', }; } const pruned = pruneToFeature(spec, focus.id); diff --git a/src/optimizer/iterative-slice.ts b/src/optimizer/iterative-slice.ts index 32c3e283..abaf9ab2 100644 --- a/src/optimizer/iterative-slice.ts +++ b/src/optimizer/iterative-slice.ts @@ -23,7 +23,7 @@ import {buildImpactSlice, collectDependents, type ImpactLookupMiss, type ImpactS import {reverseIndexOf} from '../spec/reverse-index.js'; import type {Spec} from '../spec/types.js'; -export type StopReason = 'exhaustion' | 'coverage' | 'marginal-yield' | 'max-depth'; +export type StopReason = 'exhaustion' | 'coverage' | 'marginal-yield' | 'max-depth' | 'no-known-dependents'; export interface IterativeImpactOptions { readonly initialDepth?: number; @@ -45,8 +45,10 @@ export interface IterativeImpactResult { readonly analysis: { /** The k-th ring added 0 new dependents → the reachable graph boundary was hit. */ readonly frontierExhausted: boolean; - /** Fraction of all known transitive dependents now in the radius (0..1). */ - readonly coverage: number; + /** Fraction of all known transitive dependents now in the radius (0..1). NULL when the + * denominator is zero — a vacuous 1.0 there read as "100% covered" on a blank ledger + * (F-c6a32fff; 44% of cladding-self features take this path). */ + readonly coverage: number | null; /** New-node fraction per hop: [yield@d1, yield@d2, …] — the expansion curve. */ readonly marginalYields: readonly number[]; /** Total transitive dependents reachable at unbounded depth (the coverage denominator). */ @@ -93,6 +95,22 @@ export function buildIterativeImpactSlice( } const totalKnown = collectDependents(seedIds, ri.dependents, Infinity).size; + // ZERO KNOWN DEPENDENTS — a genuine leaf on a dense map, or a blank ledger where + // nothing was ever declared. Either way the widening loop has nothing to widen into, + // and the old fall-through (`coverage = 1, stoppedBy: 'coverage'`) actively claimed + // 100% completeness on both. Stop honestly instead; the slice's ledger counts are + // what distinguish leaf (edges elsewhere) from blank map (zero edges anywhere). + if (totalKnown === 0) { + const slice = buildImpactSlice(spec, query, {depth: initialDepth}); + if ('not_found' in slice) return slice; // defensive; resolution already succeeded + return { + slice, + depthUsed: initialDepth, + stoppedBy: 'no-known-dependents', + analysis: {frontierExhausted: true, coverage: null, marginalYields: [0], totalKnownDependents: 0}, + }; + } + const yields: number[] = []; let prevCount = 0; let lastSlice: ImpactSlice | null = null; diff --git a/src/optimizer/measurement.ts b/src/optimizer/measurement.ts index 17a120ee..7ea92764 100644 --- a/src/optimizer/measurement.ts +++ b/src/optimizer/measurement.ts @@ -49,8 +49,9 @@ export interface FeatureEfficiency { readonly edgesResolved: number; /** iterative stop reason — coverage = confident, marginal-yield/max-depth = honest partial. */ readonly stoppedBy: string; - /** fraction of the true transitive blast radius the surfaced regression set covers (0..1). */ - readonly coverage: number; + /** fraction of the true transitive blast radius the surfaced regression set covers (0..1); + * null when zero dependents are known (no denominator — F-c6a32fff honesty contract). */ + readonly coverage: number | null; /** count of regression tests the slice hands you to run. */ readonly regressionTests: number; } @@ -191,7 +192,9 @@ export function measureGraphEfficiency(spec: Spec, read: ModuleReader, cwd = '.' }, stability: { byStopReason: byStop, - medianCoverage: Math.round(median(rows.map((r) => r.coverage)) * 100) / 100, + // Null coverages (no-known-dependents — no denominator) are excluded, not counted as 0/1. + medianCoverage: + Math.round(median(rows.map((r) => r.coverage).filter((c): c is number => c !== null)) * 100) / 100, medianRegressionTests: median(rows.map((r) => r.regressionTests)), }, features: rows, diff --git a/src/optimizer/reverse-slice.ts b/src/optimizer/reverse-slice.ts index 312cd917..4a3ff290 100644 --- a/src/optimizer/reverse-slice.ts +++ b/src/optimizer/reverse-slice.ts @@ -11,9 +11,28 @@ // re-run (the regression set), and the modules in the blast radius — bounded // and deterministic so a host can cache and diff it. -import {reverseIndexOf} from '../spec/reverse-index.js'; +import {reverseIndexOf, type ReverseIndex} from '../spec/reverse-index.js'; import type {Feature, Spec} from '../spec/types.js'; +/** + * Spec-wide edge counts — the FALLBACK-SAFETY disambiguator (F-c6a32fff). + * `impacted: []` on a blank ledger (zero depends_on edges anywhere — every + * freshly adopted project) is byte-identical to a verified leaf on a dense + * map; measured on a vapt clone, a feature with 10 real dependents answered + * "nothing breaks, coverage 1.0". These counts make the two distinguishable, + * and the hints tell the agent to fall back to its baseline behavior. + */ +export interface LedgerSummary { + /** Total depends_on edges declared spec-wide (sum over the reverse index). */ + readonly depends_on_edges: number; + /** Total test_ref citations declared spec-wide (anchor-stripped, pseudo-refs excluded). */ + readonly test_ref_edges: number; + /** Present ONLY when depends_on_edges === 0 — the answer means unknown, not safe. */ + readonly fallback_hint?: string; + /** Present ONLY when test_ref_edges === 0 — the regression set is unknown. */ + readonly regression_hint?: string; +} + export interface ImpactSlice { /** What was queried. Either a feature (id/title/status) or a module (path + owning features). */ readonly focus: { @@ -32,6 +51,8 @@ export interface ImpactSlice { readonly scenarios: ReadonlyArray<{readonly id: string; readonly title: string}>; /** Deduped, sorted union of test_refs across the radius — the regression set to run. */ readonly test_refs: readonly string[]; + /** Spec-wide ledger counts + blank-map fallback hints. Optional for payload compat. */ + readonly ledger?: LedgerSummary; } export interface ImpactLookupMiss { @@ -71,6 +92,24 @@ export function collectDependents( return result; } +/** Spec-wide edge counts from the (memoised) reverse index — O(map size), ~0.04ms measured. */ +export function ledgerOf(ri: ReverseIndex): LedgerSummary { + let dep = 0; + for (const s of ri.dependents.values()) dep += s.size; + let test = 0; + for (const s of ri.testRefCitations.values()) test += s.size; + return { + depends_on_edges: dep, + test_ref_edges: test, + ...(dep === 0 + ? {fallback_hint: 'dependency ledger is empty — impacted: [] means unknown, not safe; fall back to grep/imports'} + : {}), + ...(test === 0 + ? {regression_hint: 'no test_refs declared project-wide — the regression set is unknown; run the full suite'} + : {}), + }; +} + /** id (F-…) or slug → the feature; else null. */ function resolveFeature(spec: Spec, query: string): Feature | null { const features = spec.features ?? []; @@ -116,7 +155,9 @@ export function buildImpactSlice( return { not_found: query, accepted_forms: ['feature id (F-…)', 'slug', 'module path (e.g. src/spec/load.ts)'], - discovery: 'grep spec/index.yaml — one line per feature; module paths live in each shard’s modules:', + discovery: + 'grep spec/index.yaml — one line per feature (run clad sync if missing); module paths live in each ' + + 'shard’s modules:; if the query is a file, fall back to normal code search — the graph only knows declared modules', }; } @@ -154,5 +195,5 @@ export function buildImpactSlice( ? {module: moduleQuery, owners: [...seedIds].sort()} : {id: seedFeatures[0].id, title: seedFeatures[0].title, status: seedFeatures[0].status}; - return {focus, impacted, impacted_modules, scenarios, test_refs}; + return {focus, impacted, impacted_modules, scenarios, test_refs, ledger: ledgerOf(ri)}; } diff --git a/src/optimizer/working-set.ts b/src/optimizer/working-set.ts index 7c18cf59..54023f11 100644 --- a/src/optimizer/working-set.ts +++ b/src/optimizer/working-set.ts @@ -38,8 +38,17 @@ export interface WorkingSet { readonly breaks_if_changed: { readonly impacted: readonly Summary[]; readonly regression_tests: readonly string[]; - /** Self-describing radius: how far the blast-radius search widened + why it stopped + coverage of known dependents. */ - readonly radius?: {readonly depth: number; readonly stopped_by: string; readonly coverage: number}; + /** Self-describing radius: how far the blast-radius search widened + why it stopped + coverage + * of known dependents (null when zero dependents are known — never a vacuous 1.0) + the + * denominator itself so "0 known" survives to the consumer. */ + readonly radius?: { + readonly depth: number; + readonly stopped_by: string; + readonly coverage: number | null; + readonly total_known_dependents: number; + }; + /** Spec-wide ledger counts + blank-map fallback hints (from the impact slice — F-c6a32fff). */ + readonly ledger?: import('./reverse-slice.js').LedgerSummary; }; /** How to verify: scenarios, tests, oracle refs, and the high-risk (EARS unwanted/state) ACs. */ readonly verify: { @@ -112,7 +121,14 @@ export function buildWorkingSet(spec: Spec, query: string, opts: WorkingSetOptio const radius = 'not_found' in iter ? null - : {depth: iter.depthUsed, stopped_by: iter.stoppedBy, coverage: Math.round(iter.analysis.coverage * 100) / 100}; + : { + depth: iter.depthUsed, + stopped_by: iter.stoppedBy, + // Explicit null guard: JS coerces null*100 to 0, which would render the + // no-known-dependents state as a legitimate-looking FALSE "coverage: 0". + coverage: iter.analysis.coverage === null ? null : Math.round(iter.analysis.coverage * 100) / 100, + total_known_dependents: iter.analysis.totalKnownDependents, + }; const acs = focus.acceptance_criteria ?? []; const highRiskAcs = acs @@ -180,6 +196,7 @@ export function buildWorkingSet(spec: Spec, query: string, opts: WorkingSetOptio impacted: imp, regression_tests: reg, ...(radius ? {radius} : {}), + ...(impact?.ledger ? {ledger: impact.ledger} : {}), }); const overWith = (imp: readonly Summary[], reg: readonly string[], di: number, dr: number): boolean => { const marker = di + dr > 0 ? [`breaks: omitted ${di} feature(s) / ${dr} test(s)`] : []; diff --git a/src/serve/server.ts b/src/serve/server.ts index cf18ad71..1eb9d16b 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -208,7 +208,13 @@ const PAYLOAD_SCHEMA_VERSION = 1; * channel the model cannot not see, on every host — and Gemini/Codex have no * lifecycle hooks, so this is their only structural enforcement channel. */ -function gateFooter(cwd: string): {pass: boolean; findings: ReadonlyArray<{detector?: string; severity: string; message: string}>; next?: string} { +function gateFooter(cwd: string): { + pass: boolean; + /** True when the drift engine itself failed — the gate DID NOT RUN (≠ verified green). */ + unavailable?: boolean; + findings: ReadonlyArray<{detector?: string; severity: string; message: string}>; + next?: string; +} { try { const report = runDrift({cwd}); const findings = report.findings @@ -219,7 +225,10 @@ function gateFooter(cwd: string): {pass: boolean; findings: ReadonlyArray<{detec ? {pass: true, findings} : {pass: false, findings, next: 'Resolve these findings, then verify with clad_run_gate (or `clad check --strict`) before `clad done`.'}; } catch { - return {pass: true, findings: []}; + // An engine fault must never read as a verified GREEN on the one structural + // channel hook-less hosts see (F-c6a32fff). pass:false is fail-closed; the + // explicit flag distinguishes "could not run" from "ran and found problems". + return {pass: false, unavailable: true, findings: [], next: 'gate could not run — verify with `clad check --strict`.'}; } } @@ -453,8 +462,11 @@ function registerTools(server: McpServer, cwd: string): void { }, async (args) => { try { - const spec = loadSpec(cwd); - const slice = buildContextSlice(spec, args.query); + const loaded = loadSpecOrError(cwd); + if ('error' in loaded) { + return {isError: true, content: [{type: 'text', text: loaded.error}]}; + } + const slice = buildContextSlice(loaded.spec, args.query); const miss = 'not_found' in slice; return { isError: miss, @@ -492,7 +504,11 @@ function registerTools(server: McpServer, cwd: string): void { }, async (args) => { try { - const ws = buildWorkingSet(loadSpec(cwd), args.query, {cwd, maxTokens: args.max_tokens}); + const loaded = loadSpecOrError(cwd); + if ('error' in loaded) { + return {isError: true, content: [{type: 'text', text: loaded.error}]}; + } + const ws = buildWorkingSet(loaded.spec, args.query, {cwd, maxTokens: args.max_tokens}); return { isError: 'not_found' in ws, content: [{type: 'text', text: JSON.stringify({schema_version: PAYLOAD_SCHEMA_VERSION, ...ws}, null, 2)}], @@ -530,8 +546,11 @@ function registerTools(server: McpServer, cwd: string): void { }, async (args) => { try { - const spec = loadSpec(cwd); - const slice = buildImpactSlice(spec, args.query, {depth: args.max_depth}); + const loaded = loadSpecOrError(cwd); + if ('error' in loaded) { + return {isError: true, content: [{type: 'text', text: loaded.error}]}; + } + const slice = buildImpactSlice(loaded.spec, args.query, {depth: args.max_depth}); const miss = 'not_found' in slice; return { isError: miss, @@ -575,7 +594,11 @@ function registerTools(server: McpServer, cwd: string): void { }, async (args) => { try { - const spec = loadSpec(cwd); + const loaded = loadSpecOrError(cwd); + if ('error' in loaded) { + return {isError: true, content: [{type: 'text', text: loaded.error}]}; + } + const spec = loaded.spec; const graph = buildGraph(spec, cwd); if (!args.query) { return { @@ -610,6 +633,9 @@ function registerTools(server: McpServer, cwd: string): void { schema_version: PAYLOAD_SCHEMA_VERSION, not_found: args.query, accepted_forms: ['feature id (F-…)', 'slug', 'module path'], + discovery: + 'grep spec/index.yaml — one line per feature (run clad sync if missing); ' + + 'if the query is a file, fall back to normal code search', }, null, 2, diff --git a/tests/cli/hook.test.ts b/tests/cli/hook.test.ts index c02ad324..a3200ac3 100644 --- a/tests/cli/hook.test.ts +++ b/tests/cli/hook.test.ts @@ -248,6 +248,11 @@ describe('PreToolUse — structural guard on spec edits', () => { }); describe('Stop — deterministic trio with fingerprint-keyed demotion', () => { + // The Stop gate only runs under cladding (F-c6a32fff): seed the master file. + beforeEach(() => { + writeFileSync(join(cwd, 'spec.yaml'), 'schema: "0.1"\nproject:\n name: fixture\n', 'utf8'); + }); + const TWO_FINDINGS: DriftReport = { pass: false, exitCode: 1, @@ -323,6 +328,11 @@ describe('Stop — deterministic trio with fingerprint-keyed demotion', () => { }); describe('PostToolUse — debounced drift nudge', () => { + // Drift nudges only run under cladding (F-c6a32fff): seed the master file. + beforeEach(() => { + writeFileSync(join(cwd, 'spec.yaml'), 'schema: "0.1"\nproject:\n name: fixture\n', 'utf8'); + }); + const ONE_ERROR: DriftReport = { pass: false, exitCode: 1, @@ -393,6 +403,50 @@ describe('PostToolUse — debounced drift nudge', () => { }); }); +describe('fallback safety — a spec-less cwd is not ours to gate (F-c6a32fff)', () => { + // v0.7.0 regression, reproduced with the shipped bundle: in a non-cladding + // repo (or a monorepo SUBDIR — the hook cwd is process.cwd()) the Stop hook + // falsely BLOCKED with ABSENCE_OF_GOVERNANCE and wrote .cladding/ state into + // a tree that never adopted cladding. These run UNSTUBBED-equivalent: the + // guard must fire before runDrift, so the stubs must never be called. + test('Stop in a spec-less cwd → silence, no drift run, no .cladding/ writes', () => { + expect(runHookEvent('Stop', {stop_hook_active: false}, cwd)).toBe(''); + expect(driftStub).not.toHaveBeenCalled(); + expect(existsSync(join(cwd, '.cladding'))).toBe(false); + }); + + test('PostToolUse in a spec-less cwd → silence, no drift run, no stamp write', () => { + const out = runHookEvent( + 'PostToolUse', + {tool_name: 'Edit', tool_input: {file_path: 'src/foo.ts', new_string: 'x'.repeat(50)}}, + cwd, + ); + expect(out).toBe(''); + expect(driftStub).not.toHaveBeenCalled(); + expect(existsSync(join(cwd, '.cladding'))).toBe(false); + }); + + test('SessionStart over an unparseable spec with no other count source → honest counts-unavailable line', () => { + writeFileSync(join(cwd, 'spec.yaml'), 'features:\n - id: F-x\n badly: indented\n', 'utf8'); + const out = runHookEvent('SessionStart', {}, cwd); + expect(out).toContain('spec.yaml present but unparseable — counts unavailable'); + expect(out).not.toContain('0 features'); + }); + + test('SessionStart over an unparseable spec WITH a healthy index → real counts, no false alarm', () => { + writeFileSync(join(cwd, 'spec.yaml'), 'features:\n - id: F-x\n badly: indented\n', 'utf8'); + mkdirSync(join(cwd, 'spec'), {recursive: true}); + writeFileSync( + join(cwd, 'spec', 'index.yaml'), + '# Cladding · Tier C\nfeatures:\n F-aaa111: {slug: alpha, status: done, modules: 1}\n', + 'utf8', + ); + const out = runHookEvent('SessionStart', {}, cwd); + expect(out).toContain('cladding: 1 features (1 done, 0 in progress)'); + expect(out).not.toContain('unparseable'); + }); +}); + describe('protocol resilience', () => { test('unknown events and malformed inputs degrade to silence, never throw', () => { expect(runHookEvent('SubagentStop', {}, cwd)).toBe(''); diff --git a/tests/cli/impact-card.test.ts b/tests/cli/impact-card.test.ts index 32e2a623..40ccb991 100644 --- a/tests/cli/impact-card.test.ts +++ b/tests/cli/impact-card.test.ts @@ -50,6 +50,41 @@ describe('impact card', () => { expect(formatImpactCard(slice, 'src/x.ts')).toBe(''); }); + test('a blank ledger discloses itself; a dense ledger does not; the empty-card path stays empty (F-c6a32fff)', () => { + const blank: ImpactSlice = { + focus: {module: 'src/x.ts', owners: ['F-aaa']}, + impacted: [], + impacted_modules: [], + scenarios: [], + test_refs: [], + ledger: {depends_on_edges: 0, test_ref_edges: 0}, + }; + const blankCard = formatImpactCard(blank, 'src/x.ts'); + expect(blankCard).toContain('· deps unledgered'); // empty breaks/tests ≠ verified safe + expect(blankCard.split('\n')).toHaveLength(1); // stays a one-line card + + const dense: ImpactSlice = { + focus: {module: 'src/x.ts', owners: ['F-aaa']}, + impacted: [], + impacted_modules: [], + scenarios: [], + test_refs: [], + ledger: {depends_on_edges: 246, test_ref_edges: 316}, + }; + expect(formatImpactCard(dense, 'src/x.ts')).not.toContain('unledgered'); // verified leaf, no noise + + // ownerless slice: the '' contract survives even with a blank ledger. + const ownerless: ImpactSlice = { + focus: {module: 'src/x.ts'}, + impacted: [], + impacted_modules: [], + scenarios: [], + test_refs: [], + ledger: {depends_on_edges: 0, test_ref_edges: 0}, + }; + expect(formatImpactCard(ownerless, 'src/x.ts')).toBe(''); + }); + test('editMagnitude measures Edit, Write, and MultiEdit changed-char size', () => { expect(editMagnitude({content: 'abcde'})).toBe(5); expect(editMagnitude({new_string: 'abc'})).toBe(3); diff --git a/tests/optimizer/iterative-slice.test.ts b/tests/optimizer/iterative-slice.test.ts index 7a55bb42..9a674a86 100644 --- a/tests/optimizer/iterative-slice.test.ts +++ b/tests/optimizer/iterative-slice.test.ts @@ -146,4 +146,18 @@ describe('buildIterativeImpactSlice', () => { expect(Array.isArray(result.accepted_forms)).toBe(true); expect(typeof result.discovery).toBe('string'); }); + + test('zero known dependents stops honestly: no-known-dependents + coverage null, never a vacuous 1.0 (F-c6a32fff)', () => { + // Old behavior actively claimed completeness here: coverage=1 via the + // vacuous 0-denominator arm + stoppedBy 'coverage' — identical for a blank + // ledger and a genuine leaf, and identical to a real full-coverage stop. + const spec = chainSpec(); // F-A ← F-B ← F-C chain; F-C (the tip) has no dependents + const result = buildIterativeImpactSlice(spec, 'F-C'); + if ('not_found' in result) throw new Error('expected a slice'); + expect(result.stoppedBy).toBe('no-known-dependents'); + expect(result.analysis.coverage).toBeNull(); + expect(result.analysis.totalKnownDependents).toBe(0); + expect(result.analysis.frontierExhausted).toBe(true); + expect(result.slice.impacted).toEqual([]); + }); }); diff --git a/tests/optimizer/reverse-slice.test.ts b/tests/optimizer/reverse-slice.test.ts index 5ebae253..e93d4511 100644 --- a/tests/optimizer/reverse-slice.test.ts +++ b/tests/optimizer/reverse-slice.test.ts @@ -169,4 +169,40 @@ describe('reverse-slice / impact (F-7794a6bc)', () => { if ('not_found' in bounded) throw new Error('unexpected miss'); expect(bounded.impacted.map((i) => i.id)).toEqual(['B']); }); + + test('BLANK ledger: impacted:[] carries zero-counts + fallback hints — unknown, not safe (F-c6a32fff)', () => { + // The state of every freshly adopted project: features exist, no edges declared. + const spec = mkSpec([ + {id: 'F-aaa111', title: 'A', status: 'done', modules: ['src/a.ts']}, + {id: 'F-bbb222', title: 'B', status: 'done', modules: ['src/b.ts']}, + ]); + const slice = buildImpactSlice(spec, 'F-aaa111'); + if ('not_found' in slice) throw new Error('unexpected miss'); + expect(slice.impacted).toEqual([]); + expect(slice.ledger?.depends_on_edges).toBe(0); + expect(slice.ledger?.test_ref_edges).toBe(0); + expect(slice.ledger?.fallback_hint).toContain('unknown, not safe'); + expect(slice.ledger?.regression_hint).toContain('run the full suite'); + }); + + test('DENSE ledger: a verified leaf shows real edge counts and NO hints — distinguishable from blank', () => { + const spec = mkSpec([ + { + id: 'F-aaa111', + title: 'A', + status: 'done', + modules: ['src/a.ts'], + acceptance_criteria: [{id: 'AC-1', test_refs: ['tests/a.test.ts#x']}], + }, + {id: 'F-bbb222', title: 'B', status: 'done', depends_on: ['F-aaa111']}, + {id: 'F-leaf00', title: 'Leaf', status: 'done', modules: ['src/leaf.ts']}, // nothing depends on it + ]); + const slice = buildImpactSlice(spec, 'F-leaf00'); + if ('not_found' in slice) throw new Error('unexpected miss'); + expect(slice.impacted).toEqual([]); // same emptiness as blank map… + expect(slice.ledger?.depends_on_edges).toBe(1); // …but the ledger says edges exist + expect(slice.ledger?.test_ref_edges).toBe(1); + expect(slice.ledger?.fallback_hint).toBeUndefined(); + expect(slice.ledger?.regression_hint).toBeUndefined(); + }); }); diff --git a/tests/optimizer/working-set.test.ts b/tests/optimizer/working-set.test.ts index f941c609..65f6d021 100644 --- a/tests/optimizer/working-set.test.ts +++ b/tests/optimizer/working-set.test.ts @@ -289,6 +289,27 @@ describe('working-set', () => { expect(JSON.stringify(a)).toBe(JSON.stringify(b)); }); + test('blank-ledger radius: no-known-dependents, coverage null (not 0), denominator + ledger surfaced (F-c6a32fff)', () => { + // Zero depends_on and zero test_refs anywhere — the freshly-adopted state. + const spec = makeSpec([ + feature({id: 'F-aaa111', slug: 'alpha', title: 'Alpha', acceptance_criteria: [ac({id: 'AC-001', test_refs: []})]}), + feature({id: 'F-bbb222', slug: 'beta', title: 'Beta', acceptance_criteria: [ac({id: 'AC-001', test_refs: []})]}), + ]); + const r = buildWorkingSet(spec, 'F-aaa111') as WorkingSetShape | MissShape; + expect(isMiss(r)).toBe(false); + if (isMiss(r)) throw new Error('expected a working set'); + const breaks = r.breaks_if_changed as typeof r.breaks_if_changed & { + radius?: {depth: number; stopped_by: string; coverage: number | null; total_known_dependents: number}; + ledger?: {depends_on_edges: number; test_ref_edges: number; fallback_hint?: string}; + }; + expect(breaks.radius?.stopped_by).toBe('no-known-dependents'); + // JS null*100===0 — an unguarded round would render a FALSE "0% coverage". + expect(breaks.radius?.coverage).toBeNull(); + expect(breaks.radius?.total_known_dependents).toBe(0); + expect(breaks.ledger?.depends_on_edges).toBe(0); + expect(breaks.ledger?.fallback_hint).toContain('unknown, not safe'); + }); + test('a module query seeds ALL co-owners — their dependents and tests reach breaks_if_changed', () => { // v0.7.0 regression: only the alphabetically-first owner was seeded, so a // shared file's other owners contributed nothing to the blast radius diff --git a/tests/serve/gate-footer-unavailable.test.ts b/tests/serve/gate-footer-unavailable.test.ts new file mode 100644 index 00000000..c984f7c7 --- /dev/null +++ b/tests/serve/gate-footer-unavailable.test.ts @@ -0,0 +1,61 @@ +// Cladding · gateFooter fallback honesty (F-c6a32fff) +// +// The gate footer rides every mutating MCP tool result — for hosts without +// lifecycle hooks (Gemini/Codex) it is the ONLY structural gate channel. The +// v0.7.0 catch branch fabricated {pass:true, findings:[]} when the drift +// engine itself threw: an engine fault read as a verified GREEN. This suite +// mocks the drift engine to throw and asserts the footer now fails closed +// ({pass:false, unavailable:true}) — "could not run" is not "ran green". + +import {mkdtempSync, mkdirSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; + +import {InMemoryTransport} from '@modelcontextprotocol/sdk/inMemory.js'; +import {Client} from '@modelcontextprotocol/sdk/client/index.js'; +import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'; + +vi.mock('../../src/stages/drift.js', () => ({ + runDrift: (): never => { + throw new Error('engine fault: detector exploded'); + }, +})); + +const {buildServer} = await import('../../src/serve/server.js'); + +describe('gateFooter — engine fault fails closed, never a fabricated GREEN', () => { + let dir: string; + + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-gatefooter-')); + writeFileSync(join(dir, 'spec.yaml'), 'schema: "0.1"\nproject:\n name: fixture\n', 'utf8'); + mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); + }); + + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + test('a throwing drift engine yields gate {pass:false, unavailable:true} on a mutating tool result', async () => { + const server = buildServer({cwd: dir, name: 'cladding-test', version: '0.0.0-test'}); + const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair(); + const client = new Client({name: 'cladding-test-client', version: '0.0.0-test'}); + await Promise.all([server.connect(serverTransport), client.connect(clientTransport)]); + try { + const res = await client.callTool({ + name: 'clad_create_feature', + arguments: {slug: 'probe-feature', title: 'Probe'}, + }); + const doc = JSON.parse((res.content as Array<{type: string; text: string}>)[0].text) as { + gate: {pass: boolean; unavailable?: boolean; findings: unknown[]; next?: string}; + }; + expect(doc.gate.pass).toBe(false); + expect(doc.gate.unavailable).toBe(true); + expect(doc.gate.findings).toEqual([]); + expect(doc.gate.next).toContain('clad check --strict'); + } finally { + await client.close(); + await server.close(); + } + }); +}); diff --git a/tests/serve/server.test.ts b/tests/serve/server.test.ts index 947849ac..8baf878e 100644 --- a/tests/serve/server.test.ts +++ b/tests/serve/server.test.ts @@ -210,6 +210,15 @@ describe('serve/server — MCP read surface', () => { const res = await client.readResource({uri: RESOURCE_URIS.spec}); const text = (res.contents as Array<{text: string}>)[0].text; expect(JSON.parse(text).error).toContain('spec not loaded'); + + // F-c6a32fff: the four graph tools carry the same recovery guidance — + // they used to surface a raw ENOENT with no way forward. + for (const name of ['clad_get_context', 'clad_get_working_set', 'clad_get_impact', 'clad_get_graph']) { + const r = await client.callTool({name, arguments: name === 'clad_get_graph' ? {} : {query: 'F-001'}}); + expect(r.isError, `${name} must fail on an absent spec`).toBe(true); + const msg = (r.content as Array<{text: string}>)[0].text; + expect(msg, `${name} must carry the clad-init guidance`).toContain('clad init'); + } } finally { await cleanup(); rmSync(bare, {recursive: true, force: true}); From 1ba653b941f58902fcd67d1fd4d45fddb2a5901e Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Thu, 2 Jul 2026 18:23:39 +0900 Subject: [PATCH 6/6] =?UTF-8?q?Release=20v0.7.1=20=E2=80=94=20Honest=20Gra?= =?UTF-8?q?ph=20(version=20bump=20+=20CHANGELOG=20+=20READMEs)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit npm run version-bump -- 0.7.1 (9 sites incl. marketplace catalog) + package-lock refresh. CHANGELOG [Unreleased] → [0.7.1] — 2026-07-02. READMEs (md/ko.md/html/ko.html): status v0.7.1, tests 1691/1691, features 200 (196 done). Full suite 1691/1691 GREEN; clad check --tier=pre-push --strict GREEN. Externally validated against npm 0.7.0 on a real 188-feature project: 23 scenarios, 15 measured improvements, 0 regressions. Co-Authored-By: Claude Fable 5 --- .claude-plugin/marketplace.json | 2 +- CHANGELOG.md | 8 ++ README.html | 8 +- README.ko.html | 8 +- README.ko.md | 6 +- README.md | 6 +- package-lock.json | 4 +- package.json | 2 +- .../claude-code/.claude-plugin/plugin.json | 2 +- plugins/claude-code/dist/clad.js | 4 +- plugins/codex/.codex-plugin/plugin.json | 2 +- plugins/gemini-cli/gemini-extension.json | 2 +- spec.yaml | 2 +- spec/attestation.yaml | 118 +++++++++--------- src/cli/clad.ts | 2 +- src/serve/server.ts | 2 +- tests/cli/clad.test.ts | 2 +- 17 files changed, 94 insertions(+), 86 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 60ae4a47..f82a8de8 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -9,7 +9,7 @@ "name": "claude-code", "source": "./plugins/claude-code", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Claude Code.", - "version": "0.7.0", + "version": "0.7.1", "author": { "name": "qwerfunch" }, diff --git a/CHANGELOG.md b/CHANGELOG.md index 07811ac6..b9bad350 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [0.7.1] — 2026-07-02 — Honest Graph + +Repairs found by a deep multi-agent review of the 0.7.0 graph capability. +Every fix was simulation-verified against real repo data before coding, and +the release was validated by an external real-usage battery against npm +0.7.0 on a real 188-feature project: 23 scenarios, 15 measured improvements, +0 regressions. + ### Added - **Fallback safety contract — the graph says "unknown" instead of "safe".** diff --git a/README.html b/README.html index 3e6278d5..febb68f0 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -276,7 +276,7 @@

cladding

So you can ship AI-written code trusting it as much as code a human wrote.

- cladding builds itself with cladding too — 195 of its 199 features passed the same gate, and it's the first L4 implementation of the Ironclad standard. + cladding builds itself with cladding too — 196 of its 200 features passed the same gate, and it's the first L4 implementation of the Ironclad standard.

@@ -544,7 +544,7 @@

Status

version
-
v0.7.0
+
v0.7.1
2026-07
@@ -554,7 +554,7 @@

Status

tests
-
1665/1665
+
1691/1691
all pass
diff --git a/README.ko.html b/README.ko.html index d112b5fd..48ebc876 100644 --- a/README.ko.html +++ b/README.ko.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -276,7 +276,7 @@

cladding

그래서 AI가 짠 코드를 사람이 짠 코드만큼 믿고 내보낼 수 있다.

- cladding은 자기 자신도 cladding으로 만든다 — 기능 199개 중 195개가 같은 게이트를 통과했고, Ironclad 표준을 L4로 구현한 첫 사례다. + cladding은 자기 자신도 cladding으로 만든다 — 기능 200개 중 196개가 같은 게이트를 통과했고, Ironclad 표준을 L4로 구현한 첫 사례다.

@@ -545,7 +545,7 @@

Status

version
-
v0.7.0
+
v0.7.1
2026-07
@@ -555,7 +555,7 @@

Status

tests
-
1665/1665
+
1691/1691
all pass
diff --git a/README.ko.md b/README.ko.md index 7df6f4fe..e547f955 100644 --- a/README.ko.md +++ b/README.ko.md @@ -16,7 +16,7 @@

ironclad spec - tests + tests detectors license

@@ -46,7 +46,7 @@ 그래서 AI가 짠 코드를 **사람이 짠 코드만큼 믿고** 내보낼 수 있다. -cladding은 **자기 자신도 cladding으로 만든다** — 기능 199개 중 195개가 같은 게이트를 통과했고, Ironclad 표준을 L4로 구현한 첫 사례다. +cladding은 **자기 자신도 cladding으로 만든다** — 기능 200개 중 196개가 같은 게이트를 통과했고, Ironclad 표준을 L4로 구현한 첫 사례다. ## 호스트 LLM과 어떻게 함께 일하나 @@ -307,7 +307,7 @@ clad update # 3. 새 버전에 맞게 정리 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.7.0 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 1665 / 1665 · all pass | 15 단계 · 40 detectors | 199 · 195 done · 자기 스펙 | +| v0.7.1 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 1691 / 1691 · all pass | 15 단계 · 40 detectors | 200 · 196 done · 자기 스펙 | 170 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 diff --git a/README.md b/README.md index bb414607..77f69df6 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@

ironclad spec - tests + tests detectors license

@@ -43,7 +43,7 @@ So you can ship code an AI wrote with **the same trust as code a human wrote**. -cladding builds **itself** with cladding too — 195 of its 199 features cleared the same gate, the first L4 implementation of the Ironclad standard. +cladding builds **itself** with cladding too — 196 of its 200 features cleared the same gate, the first L4 implementation of the Ironclad standard. @@ -311,7 +311,7 @@ Your code · `spec.yaml` · docs are left untouched, so it's safe — and if the | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.7.0 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 1665 / 1665 | 15 stages · 40 detectors | 199 (195 done) | +| v0.7.1 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 1691 / 1691 | 15 stages · 40 detectors | 200 (196 done) | 170 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/package-lock.json b/package-lock.json index 8a24d4e0..81ecc9c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cladding", - "version": "0.7.0", + "version": "0.7.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cladding", - "version": "0.7.0", + "version": "0.7.1", "license": "MIT", "dependencies": { "@anthropic-ai/sdk": "^0.96.0", diff --git a/package.json b/package.json index 55b4d5d7..14664cc3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.7.0", + "version": "0.7.1", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Claude Code.", "type": "module", "license": "MIT", diff --git a/plugins/claude-code/.claude-plugin/plugin.json b/plugins/claude-code/.claude-plugin/plugin.json index 36257f60..9f380124 100644 --- a/plugins/claude-code/.claude-plugin/plugin.json +++ b/plugins/claude-code/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.7.0", + "version": "0.7.1", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Claude Code.", "author": { "name": "qwerfunch" diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 0d47797d..2ca9cdf2 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -431,7 +431,7 @@ schema: "0.1" source: spec.yaml `});function sc(t){let e=t.identity.timestamp??new Date().toISOString(),r=`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return{...t,id:r,identity:{...t.identity,timestamp:e}}}var Nk=y(()=>{"use strict"});import{existsSync as ZHe,mkdirSync as GHe,readFileSync as Zse,readdirSync as VHe,writeFileSync as Gse}from"node:fs";import{dirname as WHe,join as w2}from"node:path";function JHe(t,e){return`${KHe}/${t}.${e}.test.ts`}function YHe(t,e){let r=w2(t,"spec/features");if(!ZHe(r))return null;for(let n of VHe(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))){let i=w2(r,n);try{if((0,qi.parseDocument)(Zse(i,"utf8")).get("id")===e)return i}catch{}}return null}function XHe(t,e,r,n){let i=YHe(t,e);if(!i)return!1;let o=(0,qi.parseDocument)(Zse(i,"utf8")),s=o.get("acceptance_criteria");if(!(0,qi.isSeq)(s))return!1;let a=s.items.find(l=>(0,qi.isMap)(l)&&l.get("id")===r);if(!a||!(0,qi.isMap)(a))return!1;let c=a.get("oracle_refs",!0);if((0,qi.isSeq)(c)){if(c.items.some(l=>((0,qi.isMap)(l)?void 0:l.value)===n))return!0;c.add(n)}else a.set("oracle_refs",[n]);return Gse(i,String(o),"utf8"),!0}function Vse(t){let e=t.cwd??".",r=JHe(t.featureId,t.acId),n=w2(e,r);GHe(WHe(n),{recursive:!0}),Gse(n,t.body.endsWith(` `)?t.body:`${t.body} -`,"utf8");let i=sc({featureId:t.featureId,acId:t.acId,stage:"stage_2.3",identity:{author:"llm",name:t.authorName??"oracle-author"},kind:"oracle",content:`impl-blind oracle authored for ${t.featureId}.${t.acId} (blind=${t.blind===!0})`,artifact:r,readManifest:t.readManifest,blind:t.blind===!0});return ua(e,i),XHe(e,t.featureId,t.acId,r)?{ok:!0,oraclePath:r,evidenceId:i.id}:{ok:!1,oraclePath:r,evidenceId:i.id,reason:`oracle + provenance written, but could not stamp oracle_refs (no shard for ${t.featureId}.${t.acId}) \u2014 add 'oracle_refs: [${r}]' to the AC manually`}}var qi,KHe,Wse=y(()=>{"use strict";qi=kt(or(),1);Hn();Nk();KHe="tests/oracle"});var Xse={};Er(Xse,{PERSONA_IDS:()=>Jse,PERSONA_PROMPT_ALIASES:()=>Yse,RESOURCE_URIS:()=>zs,TOOL_NAMES:()=>rZe,buildServer:()=>nZe});import{spawnSync as QHe}from"node:child_process";import{readFileSync as x2,existsSync as ed,statSync as eZe}from"node:fs";import{dirname as Kse,join as Ls}from"node:path";import{fileURLToPath as tZe}from"node:url";function nZe(t={}){let e=t.cwd??".",r=new Ck({name:t.name??"cladding",version:t.version??"0.7.0"},{capabilities:{resources:{subscribe:!0}}});return aZe(r,e),lZe(r,e),uZe(r,e),iZe(r),oZe(r,e),r}function iZe(t){t.server.setRequestHandler(EF,async()=>({})),t.server.setRequestHandler(AF,async()=>({}))}function oZe(t,e){AK(r=>{r===e&&t.server.sendResourceUpdated({uri:zs.audit})})}function ac(t){try{return{spec:Y(t)}}catch(e){return{error:`cladding: spec not loaded \u2014 ${e.message}. Run \`clad init\` to scaffold spec.yaml first.`}}}function jk(t){try{let e=so({cwd:t}),r=e.findings.filter(n=>n.severity!=="info").slice(0,3).map(n=>({detector:n.detector,severity:n.severity,message:n.message.slice(0,220)}));return e.pass?{pass:!0,findings:r}:{pass:!1,findings:r,next:"Resolve these findings, then verify with clad_run_gate (or `clad check --strict`) before `clad done`."}}catch{return{pass:!1,unavailable:!0,findings:[],next:"gate could not run \u2014 verify with `clad check --strict`."}}}function sZe(){let t=Kse(tZe(import.meta.url));for(let e=0;e<5;e++){let r=Ls(t,"bin","clad");if(ed(r))return r;t=Kse(t)}return null}function aZe(t,e){t.registerTool("clad_list_features",{title:"List cladding features",description:"List features from spec.yaml. Optionally filter by status or slug substring, and sort alphabetically (default) or by recent file mtime.",inputSchema:{statusFilter:oe.enum(["planned","in_progress","done","archived"]).optional().describe("Limit to features with this status"),slugSubstring:oe.string().optional().describe("Case-insensitive substring match on slug (e.g. 'auth')"),sort:oe.enum(["alphabetical","recent"]).optional().describe("'alphabetical' (default \u2014 by id) or 'recent' (by file mtime, newest first)")}},async r=>{let n=ac(e);if("error"in n)return{isError:!0,content:[{type:"text",text:n.error}]};let o=n.spec.features;if(r.statusFilter&&(o=o.filter(c=>c.status===r.statusFilter)),r.slugSubstring){let c=r.slugSubstring.toLowerCase();o=o.filter(l=>{let u=l.slug;return u?u.toLowerCase().includes(c):!1})}let a=(r.sort==="recent"?cZe(o,e):o).map(c=>({id:c.id,slug:c.slug,title:c.title,status:c.status}));return{content:[{type:"text",text:JSON.stringify({total:a.length,features:a},null,2)}]}}),t.registerTool("clad_get_feature",{title:"Get a cladding feature",description:'Returns one feature record by id (e.g. "F-049" or "F-a3f9c2") or by slug (e.g. "login-flow"). When a slug matches multiple features, all matches are returned.',inputSchema:{id:oe.string().optional().describe('Feature id such as "F-049" or "F-a3f9c2"'),slug:oe.string().optional().describe("Feature slug such as 'login-flow'")}},async r=>{if(!r.id&&!r.slug)return{isError:!0,content:[{type:"text",text:"provide either id or slug"}]};let n=ac(e);if("error"in n)return{isError:!0,content:[{type:"text",text:n.error}]};let i=n.spec.features.filter(s=>!!(r.id&&s.id===r.id||r.slug&&s.slug===r.slug));if(i.length===0)return{isError:!0,content:[{type:"text",text:`no feature with ${r.id?`id "${r.id}"`:`slug "${r.slug}"`} found`}]};let o=i.length===1?i[0]:{matches:i};return{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}),t.registerTool("clad_run_check",{title:"Run cladding drift check",description:"Runs `clad check` drift detection. Returns a TERSE report by default (pass, error/warn counts, top 3 blocking findings) to keep the agent loop cheap; pass verbose:true for every finding incl. info-severity + suggestions.",inputSchema:{strict:oe.boolean().optional().describe("Treat warnings as errors when true"),verbose:oe.boolean().optional().describe("Return the full report (all findings incl. info + suggestions) instead of the terse top-3 summary")}},async r=>{let n=so({strict:r.strict,cwd:e});if(r.verbose)return{content:[{type:"text",text:JSON.stringify(n,null,2)}],isError:!n.pass};let i=n.findings??[],o=i.filter(l=>l.severity==="error"),s=i.filter(l=>l.severity==="warn"),a=(o.length>0?o:s).slice(0,3).map(l=>({detector:l.detector,severity:l.severity,message:l.message,...l.path?{path:l.path}:{},...l.line?{line:l.line}:{}})),c={stage:n.stage,pass:n.pass,errorCount:o.length,warnCount:s.length,findings:a,...o.length+s.length>a.length?{truncated:!0,hint:"call clad_run_check with verbose:true for all findings"}:{}};return{content:[{type:"text",text:JSON.stringify(c,null,2)}],isError:!n.pass}}),t.registerTool("clad_run_gate",{title:"Run the full Iron Law gate",description:"Runs the real `clad check` pipeline for a tier (default pre-commit for latency; pre-push runs type/lint/tests/coverage/conformance/smoke) and returns the untruncated JSON outcome. Strict by default \u2014 this is the verification surface; use clad_run_check for the cheap drift-only view.",inputSchema:{tier:oe.enum(["pre-commit","pre-push","all"]).optional().describe("Stage tier (default pre-commit)"),strict:oe.boolean().optional().describe("Promote warn findings to blocking (default true)")}},async r=>{let n=sZe();if(!n)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:mr,error:"cladding engine shim (bin/clad) not found relative to the running server"})}]};let i=r.tier??"pre-commit",o=r.strict!==!1,s=QHe(n,["check",`--tier=${i}`,...o?["--strict"]:[],"--json"],{cwd:e,encoding:"utf8",timeout:3e5});try{let a=JSON.parse(s.stdout||"");return{isError:(a.worst??1)!==0,content:[{type:"text",text:JSON.stringify({schema_version:mr,...a},null,2)}]}}catch{return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:mr,error:"gate produced no parseable JSON",stderr:(s.stderr??"").slice(0,400)})}]}}}),t.registerTool("clad_get_context",{title:"Get the context slice for one feature",description:"Returns the working set for ONE feature in one call: the focus feature (full), its transitive depends_on ancestors (title+status), bound scenarios, the matching ai_hints patterns, and the union of the feature's test_refs. Look up by feature id (F-\u2026), slug, or a module path. Prefer this over reading shards by hand \u2014 dispatch the slice, never the whole spec.",inputSchema:{query:oe.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/auth/login.ts)")}},async r=>{try{let n=ac(e);if("error"in n)return{isError:!0,content:[{type:"text",text:n.error}]};let i=Ol(n.spec,r.query);return{isError:"not_found"in i,content:[{type:"text",text:JSON.stringify({schema_version:mr,...i},null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_get_working_set",{title:"Get the token-budgeted working set for one feature (code + needs + breaks)",description:"Returns ONE token-budgeted working set for a feature/module: must_edit (focus + full ACs + the ACTUAL source code of its modules), needs (forward depends_on), breaks_if_changed (direct dependents + the regression test set), verify (scenarios + tests + oracle_refs + EARS unwanted/state high-risk ACs), guidance (ai_hints), and budget (what was clipped to fit). One call replaces reading the shard + opening each module file + grepping deps/tests. Look up by feature id (F-\u2026), slug, or module path.",inputSchema:{query:oe.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/auth/login.ts)"),max_tokens:oe.number().int().positive().max(2e4).optional().describe("Token budget for the payload (default 3000); distant deps then code then tests are clipped to fit")}},async r=>{try{let n=ac(e);if("error"in n)return{isError:!0,content:[{type:"text",text:n.error}]};let i=Mp(n.spec,r.query,{cwd:e,maxTokens:r.max_tokens});return{isError:"not_found"in i,content:[{type:"text",text:JSON.stringify({schema_version:mr,...i},null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_get_impact",{title:"Get the blast radius for a change (reverse / impact slice)",description:"Returns what a change to ONE feature or file could break: the transitive dependents (id+title+status), the scenarios bound to any of them, the deduped union of their test_refs (the regression set to re-run), and the modules in the radius. Look up by feature id (F-\u2026), slug, or a module path \u2014 a module fans out to ALL features that touch it. The backward complement of clad_get_context: forward = what this needs, impact = what depends on this. Prefer this over grepping to scope a safe refactor.",inputSchema:{query:oe.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/spec/load.ts)"),max_depth:oe.number().int().positive().max(6).optional().describe("Bound the dependent walk to N hops (default: unbounded \u2014 the full transitive radius)")}},async r=>{try{let n=ac(e);if("error"in n)return{isError:!0,content:[{type:"text",text:n.error}]};let i=Jr(n.spec,r.query,{depth:r.max_depth});return{isError:"not_found"in i,content:[{type:"text",text:JSON.stringify({schema_version:mr,...i},null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_get_graph",{title:"Get the live knowledge graph (focused neighborhood, or a stats summary)",description:"With query: the focus node\u2019s N-hop neighborhood \u2014 nodes (feature/module/skill/test/scenario/capability/doc, tier-classified A/B/C/D, features labeled by slug) + typed edges (depends_on/touches/covers/binds/implements/references/links); a path query unions all its kind-twins (module/test/doc nodes of one file). WITHOUT query: a compact summary (node/edge counts by kind + top hubs) \u2014 the full graph is tens of thousands of tokens, use `clad graph export --format json` for a complete dump. Recomputed live \u2014 never stale.",inputSchema:{query:oe.string().optional().describe("Focus node: feature id (F-\u2026), slug, or module path. Omit for the stats summary."),max_depth:oe.number().int().positive().max(6).optional().describe("Neighborhood radius around the focus node (default: full reachable subgraph from the focus)")}},async r=>{try{let n=ac(e);if("error"in n)return{isError:!0,content:[{type:"text",text:n.error}]};let i=n.spec,o=Pa(i,e);if(!r.query)return{content:[{type:"text",text:JSON.stringify({schema_version:mr,summary:!0,stats:tw(o),hint:"pass query (feature id, slug, or module path) for a neighborhood subgraph; `clad graph export --format json` dumps the full graph"},null,2)}]};let s=WS(i,o,r.query);if(s.length===0)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:mr,not_found:r.query,accepted_forms:["feature id (F-\u2026)","slug","module path"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); if the query is a file, fall back to normal code search"},null,2)}]};let a=VS(o,s,r.max_depth??1/0);return{content:[{type:"text",text:JSON.stringify({schema_version:mr,...a},null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_changelog",{title:"Collect shipped changes since a git ref (changelog manifest)",description:"Returns the deterministic shipped-changes manifest for ..HEAD (default since: the latest tag): feature shards classified (added-as-done / flipped-to-done / modified-while-done / archived) grouped by capability with an uncategorized bucket, the spec inventory count diff, and conventional feat:/fix: commits that name no feature id (work that shipped outside the spec). For HUMAN-FACING release notes, render from the manifest in the project's language(s), sourcing every claim from a feature title or acceptance-criterion sentence \u2014 never invent a change the manifest does not carry. format:'markdown' is the deterministic English fallback (no internal ids), 'audit' the id-keeping verification table (refs marked resolved \u2713/\u2717), 'catalog' the full capability \u2192 feature \u2192 acceptance listing (no git range).",inputSchema:{since:oe.string().optional().describe("Git ref to diff from (default: latest tag via `git describe --tags --abbrev=0`)"),format:oe.enum(["manifest","markdown","catalog","audit"]).optional().describe("Payload format (default 'manifest')")}},async r=>{try{let n=r.format??"manifest";if(n==="catalog"){let a=ay(Y(e));return{content:[{type:"text",text:JSON.stringify({schema_version:mr,format:n,content:a},null,2)}]}}let i=r.since??ry(e),o=ny(e,i);if(n==="manifest")return{content:[{type:"text",text:JSON.stringify({schema_version:mr,...o},null,2)}]};let s=n==="audit"?sy(o,Y(e),e):oy(o);return{content:[{type:"text",text:JSON.stringify({schema_version:mr,format:n,content:s},null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_get_events",{title:"Get recent cladding events",description:"Reads .cladding/events.log and returns the most recent entries.",inputSchema:{limit:oe.number().int().positive().max(500).optional().describe("Maximum entries to return (default 50)")}},async r=>{let n=r.limit??50,i=Ls(e,".cladding","events.log.jsonl");if(!ed(i))return{content:[{type:"text",text:JSON.stringify({events:[],note:"no events log yet"})}]};let a=x2(i,"utf8").split(` +`,"utf8");let i=sc({featureId:t.featureId,acId:t.acId,stage:"stage_2.3",identity:{author:"llm",name:t.authorName??"oracle-author"},kind:"oracle",content:`impl-blind oracle authored for ${t.featureId}.${t.acId} (blind=${t.blind===!0})`,artifact:r,readManifest:t.readManifest,blind:t.blind===!0});return ua(e,i),XHe(e,t.featureId,t.acId,r)?{ok:!0,oraclePath:r,evidenceId:i.id}:{ok:!1,oraclePath:r,evidenceId:i.id,reason:`oracle + provenance written, but could not stamp oracle_refs (no shard for ${t.featureId}.${t.acId}) \u2014 add 'oracle_refs: [${r}]' to the AC manually`}}var qi,KHe,Wse=y(()=>{"use strict";qi=kt(or(),1);Hn();Nk();KHe="tests/oracle"});var Xse={};Er(Xse,{PERSONA_IDS:()=>Jse,PERSONA_PROMPT_ALIASES:()=>Yse,RESOURCE_URIS:()=>zs,TOOL_NAMES:()=>rZe,buildServer:()=>nZe});import{spawnSync as QHe}from"node:child_process";import{readFileSync as x2,existsSync as ed,statSync as eZe}from"node:fs";import{dirname as Kse,join as Ls}from"node:path";import{fileURLToPath as tZe}from"node:url";function nZe(t={}){let e=t.cwd??".",r=new Ck({name:t.name??"cladding",version:t.version??"0.7.1"},{capabilities:{resources:{subscribe:!0}}});return aZe(r,e),lZe(r,e),uZe(r,e),iZe(r),oZe(r,e),r}function iZe(t){t.server.setRequestHandler(EF,async()=>({})),t.server.setRequestHandler(AF,async()=>({}))}function oZe(t,e){AK(r=>{r===e&&t.server.sendResourceUpdated({uri:zs.audit})})}function ac(t){try{return{spec:Y(t)}}catch(e){return{error:`cladding: spec not loaded \u2014 ${e.message}. Run \`clad init\` to scaffold spec.yaml first.`}}}function jk(t){try{let e=so({cwd:t}),r=e.findings.filter(n=>n.severity!=="info").slice(0,3).map(n=>({detector:n.detector,severity:n.severity,message:n.message.slice(0,220)}));return e.pass?{pass:!0,findings:r}:{pass:!1,findings:r,next:"Resolve these findings, then verify with clad_run_gate (or `clad check --strict`) before `clad done`."}}catch{return{pass:!1,unavailable:!0,findings:[],next:"gate could not run \u2014 verify with `clad check --strict`."}}}function sZe(){let t=Kse(tZe(import.meta.url));for(let e=0;e<5;e++){let r=Ls(t,"bin","clad");if(ed(r))return r;t=Kse(t)}return null}function aZe(t,e){t.registerTool("clad_list_features",{title:"List cladding features",description:"List features from spec.yaml. Optionally filter by status or slug substring, and sort alphabetically (default) or by recent file mtime.",inputSchema:{statusFilter:oe.enum(["planned","in_progress","done","archived"]).optional().describe("Limit to features with this status"),slugSubstring:oe.string().optional().describe("Case-insensitive substring match on slug (e.g. 'auth')"),sort:oe.enum(["alphabetical","recent"]).optional().describe("'alphabetical' (default \u2014 by id) or 'recent' (by file mtime, newest first)")}},async r=>{let n=ac(e);if("error"in n)return{isError:!0,content:[{type:"text",text:n.error}]};let o=n.spec.features;if(r.statusFilter&&(o=o.filter(c=>c.status===r.statusFilter)),r.slugSubstring){let c=r.slugSubstring.toLowerCase();o=o.filter(l=>{let u=l.slug;return u?u.toLowerCase().includes(c):!1})}let a=(r.sort==="recent"?cZe(o,e):o).map(c=>({id:c.id,slug:c.slug,title:c.title,status:c.status}));return{content:[{type:"text",text:JSON.stringify({total:a.length,features:a},null,2)}]}}),t.registerTool("clad_get_feature",{title:"Get a cladding feature",description:'Returns one feature record by id (e.g. "F-049" or "F-a3f9c2") or by slug (e.g. "login-flow"). When a slug matches multiple features, all matches are returned.',inputSchema:{id:oe.string().optional().describe('Feature id such as "F-049" or "F-a3f9c2"'),slug:oe.string().optional().describe("Feature slug such as 'login-flow'")}},async r=>{if(!r.id&&!r.slug)return{isError:!0,content:[{type:"text",text:"provide either id or slug"}]};let n=ac(e);if("error"in n)return{isError:!0,content:[{type:"text",text:n.error}]};let i=n.spec.features.filter(s=>!!(r.id&&s.id===r.id||r.slug&&s.slug===r.slug));if(i.length===0)return{isError:!0,content:[{type:"text",text:`no feature with ${r.id?`id "${r.id}"`:`slug "${r.slug}"`} found`}]};let o=i.length===1?i[0]:{matches:i};return{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}),t.registerTool("clad_run_check",{title:"Run cladding drift check",description:"Runs `clad check` drift detection. Returns a TERSE report by default (pass, error/warn counts, top 3 blocking findings) to keep the agent loop cheap; pass verbose:true for every finding incl. info-severity + suggestions.",inputSchema:{strict:oe.boolean().optional().describe("Treat warnings as errors when true"),verbose:oe.boolean().optional().describe("Return the full report (all findings incl. info + suggestions) instead of the terse top-3 summary")}},async r=>{let n=so({strict:r.strict,cwd:e});if(r.verbose)return{content:[{type:"text",text:JSON.stringify(n,null,2)}],isError:!n.pass};let i=n.findings??[],o=i.filter(l=>l.severity==="error"),s=i.filter(l=>l.severity==="warn"),a=(o.length>0?o:s).slice(0,3).map(l=>({detector:l.detector,severity:l.severity,message:l.message,...l.path?{path:l.path}:{},...l.line?{line:l.line}:{}})),c={stage:n.stage,pass:n.pass,errorCount:o.length,warnCount:s.length,findings:a,...o.length+s.length>a.length?{truncated:!0,hint:"call clad_run_check with verbose:true for all findings"}:{}};return{content:[{type:"text",text:JSON.stringify(c,null,2)}],isError:!n.pass}}),t.registerTool("clad_run_gate",{title:"Run the full Iron Law gate",description:"Runs the real `clad check` pipeline for a tier (default pre-commit for latency; pre-push runs type/lint/tests/coverage/conformance/smoke) and returns the untruncated JSON outcome. Strict by default \u2014 this is the verification surface; use clad_run_check for the cheap drift-only view.",inputSchema:{tier:oe.enum(["pre-commit","pre-push","all"]).optional().describe("Stage tier (default pre-commit)"),strict:oe.boolean().optional().describe("Promote warn findings to blocking (default true)")}},async r=>{let n=sZe();if(!n)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:mr,error:"cladding engine shim (bin/clad) not found relative to the running server"})}]};let i=r.tier??"pre-commit",o=r.strict!==!1,s=QHe(n,["check",`--tier=${i}`,...o?["--strict"]:[],"--json"],{cwd:e,encoding:"utf8",timeout:3e5});try{let a=JSON.parse(s.stdout||"");return{isError:(a.worst??1)!==0,content:[{type:"text",text:JSON.stringify({schema_version:mr,...a},null,2)}]}}catch{return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:mr,error:"gate produced no parseable JSON",stderr:(s.stderr??"").slice(0,400)})}]}}}),t.registerTool("clad_get_context",{title:"Get the context slice for one feature",description:"Returns the working set for ONE feature in one call: the focus feature (full), its transitive depends_on ancestors (title+status), bound scenarios, the matching ai_hints patterns, and the union of the feature's test_refs. Look up by feature id (F-\u2026), slug, or a module path. Prefer this over reading shards by hand \u2014 dispatch the slice, never the whole spec.",inputSchema:{query:oe.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/auth/login.ts)")}},async r=>{try{let n=ac(e);if("error"in n)return{isError:!0,content:[{type:"text",text:n.error}]};let i=Ol(n.spec,r.query);return{isError:"not_found"in i,content:[{type:"text",text:JSON.stringify({schema_version:mr,...i},null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_get_working_set",{title:"Get the token-budgeted working set for one feature (code + needs + breaks)",description:"Returns ONE token-budgeted working set for a feature/module: must_edit (focus + full ACs + the ACTUAL source code of its modules), needs (forward depends_on), breaks_if_changed (direct dependents + the regression test set), verify (scenarios + tests + oracle_refs + EARS unwanted/state high-risk ACs), guidance (ai_hints), and budget (what was clipped to fit). One call replaces reading the shard + opening each module file + grepping deps/tests. Look up by feature id (F-\u2026), slug, or module path.",inputSchema:{query:oe.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/auth/login.ts)"),max_tokens:oe.number().int().positive().max(2e4).optional().describe("Token budget for the payload (default 3000); distant deps then code then tests are clipped to fit")}},async r=>{try{let n=ac(e);if("error"in n)return{isError:!0,content:[{type:"text",text:n.error}]};let i=Mp(n.spec,r.query,{cwd:e,maxTokens:r.max_tokens});return{isError:"not_found"in i,content:[{type:"text",text:JSON.stringify({schema_version:mr,...i},null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_get_impact",{title:"Get the blast radius for a change (reverse / impact slice)",description:"Returns what a change to ONE feature or file could break: the transitive dependents (id+title+status), the scenarios bound to any of them, the deduped union of their test_refs (the regression set to re-run), and the modules in the radius. Look up by feature id (F-\u2026), slug, or a module path \u2014 a module fans out to ALL features that touch it. The backward complement of clad_get_context: forward = what this needs, impact = what depends on this. Prefer this over grepping to scope a safe refactor.",inputSchema:{query:oe.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/spec/load.ts)"),max_depth:oe.number().int().positive().max(6).optional().describe("Bound the dependent walk to N hops (default: unbounded \u2014 the full transitive radius)")}},async r=>{try{let n=ac(e);if("error"in n)return{isError:!0,content:[{type:"text",text:n.error}]};let i=Jr(n.spec,r.query,{depth:r.max_depth});return{isError:"not_found"in i,content:[{type:"text",text:JSON.stringify({schema_version:mr,...i},null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_get_graph",{title:"Get the live knowledge graph (focused neighborhood, or a stats summary)",description:"With query: the focus node\u2019s N-hop neighborhood \u2014 nodes (feature/module/skill/test/scenario/capability/doc, tier-classified A/B/C/D, features labeled by slug) + typed edges (depends_on/touches/covers/binds/implements/references/links); a path query unions all its kind-twins (module/test/doc nodes of one file). WITHOUT query: a compact summary (node/edge counts by kind + top hubs) \u2014 the full graph is tens of thousands of tokens, use `clad graph export --format json` for a complete dump. Recomputed live \u2014 never stale.",inputSchema:{query:oe.string().optional().describe("Focus node: feature id (F-\u2026), slug, or module path. Omit for the stats summary."),max_depth:oe.number().int().positive().max(6).optional().describe("Neighborhood radius around the focus node (default: full reachable subgraph from the focus)")}},async r=>{try{let n=ac(e);if("error"in n)return{isError:!0,content:[{type:"text",text:n.error}]};let i=n.spec,o=Pa(i,e);if(!r.query)return{content:[{type:"text",text:JSON.stringify({schema_version:mr,summary:!0,stats:tw(o),hint:"pass query (feature id, slug, or module path) for a neighborhood subgraph; `clad graph export --format json` dumps the full graph"},null,2)}]};let s=WS(i,o,r.query);if(s.length===0)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:mr,not_found:r.query,accepted_forms:["feature id (F-\u2026)","slug","module path"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); if the query is a file, fall back to normal code search"},null,2)}]};let a=VS(o,s,r.max_depth??1/0);return{content:[{type:"text",text:JSON.stringify({schema_version:mr,...a},null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_changelog",{title:"Collect shipped changes since a git ref (changelog manifest)",description:"Returns the deterministic shipped-changes manifest for ..HEAD (default since: the latest tag): feature shards classified (added-as-done / flipped-to-done / modified-while-done / archived) grouped by capability with an uncategorized bucket, the spec inventory count diff, and conventional feat:/fix: commits that name no feature id (work that shipped outside the spec). For HUMAN-FACING release notes, render from the manifest in the project's language(s), sourcing every claim from a feature title or acceptance-criterion sentence \u2014 never invent a change the manifest does not carry. format:'markdown' is the deterministic English fallback (no internal ids), 'audit' the id-keeping verification table (refs marked resolved \u2713/\u2717), 'catalog' the full capability \u2192 feature \u2192 acceptance listing (no git range).",inputSchema:{since:oe.string().optional().describe("Git ref to diff from (default: latest tag via `git describe --tags --abbrev=0`)"),format:oe.enum(["manifest","markdown","catalog","audit"]).optional().describe("Payload format (default 'manifest')")}},async r=>{try{let n=r.format??"manifest";if(n==="catalog"){let a=ay(Y(e));return{content:[{type:"text",text:JSON.stringify({schema_version:mr,format:n,content:a},null,2)}]}}let i=r.since??ry(e),o=ny(e,i);if(n==="manifest")return{content:[{type:"text",text:JSON.stringify({schema_version:mr,...o},null,2)}]};let s=n==="audit"?sy(o,Y(e),e):oy(o);return{content:[{type:"text",text:JSON.stringify({schema_version:mr,format:n,content:s},null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_get_events",{title:"Get recent cladding events",description:"Reads .cladding/events.log and returns the most recent entries.",inputSchema:{limit:oe.number().int().positive().max(500).optional().describe("Maximum entries to return (default 50)")}},async r=>{let n=r.limit??50,i=Ls(e,".cladding","events.log.jsonl");if(!ed(i))return{content:[{type:"text",text:JSON.stringify({events:[],note:"no events log yet"})}]};let a=x2(i,"utf8").split(` `).filter(c=>c.trim().length>0).slice(-n).map(c=>{try{return JSON.parse(c)}catch{return{unparseable:c.slice(0,200)}}});return{content:[{type:"text",text:JSON.stringify({events:a},null,2)}]}}),t.registerTool("clad_create_feature",{title:"Create a new cladding feature",description:"Creates spec/features/.yaml with an auto-generated F- id. Author the feature WITH its acceptance_criteria (and modules) in this one call \u2014 a feature created with no acceptance_criteria is a hollow stub that governs nothing. Two concurrent invocations on separate branches produce distinct hash ids by construction, so multi-developer concurrency is safe.",inputSchema:{slug:oe.string().regex(/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/).describe("Kebab-case slug \u2014 filename + spec.slug field (e.g. 'login-flow')"),title:oe.string().optional().describe("Optional human-readable title; defaults to slug"),status:oe.enum(["planned","in_progress","done","blocked","archived"]).optional().describe("Optional status; defaults to 'planned'"),modules:oe.array(oe.string()).optional().describe('Module paths the feature binds to (e.g. ["src/auth/login.ts"]).'),acceptance_criteria:oe.array(oe.object({ears:oe.enum(["ubiquitous","event","state","optional","unwanted","complex"]).optional(),text:oe.string().optional().describe('The "The system shall \u2026" statement.'),action:oe.string().optional(),response:oe.string().optional(),condition:oe.string().optional().describe("Trigger/precondition for event/state EARS."),test_refs:oe.array(oe.string()).optional().describe("Paths to verifying tests."),evidence_refs:oe.array(oe.string()).optional(),notes:oe.string().optional()})).optional().describe("Acceptance criteria authored now (ids auto-assigned AC-001\u2026). Strongly preferred over an empty feature \u2014 this is what makes the feature governable.")}},async r=>{try{let n=Use({slug:r.slug,title:r.title,status:r.status,modules:r.modules,acceptance_criteria:r.acceptance_criteria,cwd:e});Mk(e);let i={schema_version:mr,...n,gate:jk(e),hint:`If this feature is user-facing, link it to a capability with clad_link_capability (capability: , feature: ${n.id}) so the Tier-B design SSoT grows with development instead of being left an empty seed.`};return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_author_oracle",{title:"Record an impl-blind spec-conformance oracle",description:"Records a host-authored conformance oracle for a feature AC + its impl-blind PROVENANCE, writes the test under tests/oracle/, and stamps oracle_refs so the SPEC_CONFORMANCE gate verifies it. cladding does NOT author the oracle. AUTHOR ONLY ACs on the policy worklist (`clad oracle --required`) \u2014 an empty worklist means do not author unless the user explicitly asks (out-of-policy recordings are labeled voluntary). FIRST run `clad oracle --ac ` for the spec-only brief; spawn a FRESH sub-agent given ONLY that brief (never the implementation); have it write the test; then call this with the body + the manifest of exactly what the sub-agent saw. Blindness is your discipline \u2014 the gate audits the manifest (manifest\u2229modules must be empty) and the author\u2260implementer identity, and records whether you attested a clean (blind) context.",inputSchema:{featureId:oe.string().describe("The F- feature id."),acId:oe.string().describe("The AC- the oracle verifies."),body:oe.string().describe("The authored vitest oracle source (imports the module under test)."),readManifest:oe.array(oe.string()).describe("EXACTLY what the blind sub-agent was shown (the clad oracle brief: spec/AC + signatures). MUST NOT include an implementation file the feature owns."),blind:oe.boolean().optional().describe("True only if the sub-agent saw the spec-only brief and nothing else."),authorName:oe.string().optional().describe("Oracle author identity (sub-agent / model id) \u2014 must differ from the implementer for the gate to pass.")}},async r=>{try{let n=Vse({featureId:r.featureId,acId:r.acId,body:r.body,readManifest:r.readManifest,blind:r.blind,authorName:r.authorName,cwd:e});Mk(e);let i={};try{let o=Y(e),s=$f(o.project,kf(o)),c=o.features.find(l=>l.id===r.featureId)?.acceptance_criteria?.find(l=>l.id===r.acId);(!c||!Ef(s,r.featureId,c))&&(i={voluntary:!0,cost_note:"this AC is not on the project's oracle worklist (`clad oracle --required`) \u2014 recording anyway as voluntary; prefer policy-listed ACs to keep token spend inside the declared verification budget."})}catch{}return{content:[{type:"text",text:JSON.stringify({schema_version:mr,...n,...i,gate:jk(e)},null,2)}],isError:!n.ok}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_create_scenario",{title:"Create a new cladding scenario",description:"Creates spec/scenarios/-.yaml with an auto-generated S- id. Same multi-dev safety property as clad_create_feature: two concurrent invocations on separate branches produce distinct hash ids by construction.",inputSchema:{slug:oe.string().regex(/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/).describe("Kebab-case slug (e.g. 'checkout-happy-path')"),title:oe.string().optional().describe("Optional human-readable title; defaults to slug"),flow:oe.string().optional().describe("Prose user-journey flow (what the user does, step by step)."),features:oe.array(oe.string().regex(/^F-(\d{3,}|[a-f0-9]{6,})$/)).optional().describe("Optional list of feature ids the scenario touches")}},async r=>{try{let n=qse({slug:r.slug,title:r.title,flow:r.flow,features:r.features,cwd:e});return Mk(e),{content:[{type:"text",text:JSON.stringify({schema_version:mr,...n,gate:jk(e)},null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}}),t.registerTool("clad_link_capability",{title:"Link a feature to a capability",description:"Upserts a feature into spec/capabilities.yaml: creates the capability if absent, else appends the feature to its features[] (deduped). A capability is ACCUMULATIVE, so the verb is link, not create. Use this when a user-facing feature lands so the design tier grows with development instead of being left an empty seed.",inputSchema:{capability:oe.string().regex(/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/).describe("Capability id (kebab-slug, e.g. 'auth'). Created if it does not exist yet."),feature:oe.string().regex(/^F-(\d{3,}|[a-f0-9]{6,})$/).describe("Feature id to add to the capability"),title:oe.string().optional().describe("Title, used only when the capability is newly created"),summary:oe.string().optional().describe("Summary, used only when newly created"),surface:oe.enum(["feature","platform","tool","infrastructure"]).optional().describe("Surface, used only when newly created")}},async r=>{try{let n=Bse({capability:r.capability,feature:r.feature,title:r.title,summary:r.summary,surface:r.surface,cwd:e});return Mk(e),{content:[{type:"text",text:JSON.stringify({schema_version:mr,...n,gate:jk(e)},null,2)}]}}catch(n){return{isError:!0,content:[{type:"text",text:n.message}]}}})}function Mk(t){try{ed(Ls(t,"spec.yaml"))&&(Kc(t,Wo(t)),fa(t),yw(t))}catch{}}function cZe(t,e){let r=Ls(e,"spec","features"),n=t.map(i=>{let o=i.slug,s=[o?Ls(r,`${o}-${i.id.slice(2)}.yaml`):null,Ls(r,`${i.id}.yaml`)].filter(c=>c!==null),a=0;for(let c of s)try{if(ed(c)){a=eZe(c).mtimeMs;break}}catch{}return{feature:i,mtime:a}});return n.sort((i,o)=>o.mtime-i.mtime),n.map(i=>i.feature)}function lZe(t,e){t.registerResource("spec",zs.spec,{title:"Cladding spec",description:"The active spec.yaml \u2014 aggregated when sharded.",mimeType:"application/json"},async()=>{let r=ac(e),n="error"in r?JSON.stringify({error:r.error},null,2):JSON.stringify(r.spec,null,2);return{contents:[{uri:zs.spec,mimeType:"application/json",text:n}]}}),t.registerResource("events",zs.events,{title:"Cladding events log",description:"Raw JSONL stream of feature_activated, evidence_appended, gate_run, \u2026",mimeType:"application/x-ndjson"},async()=>{let r=Ls(e,".cladding","events.log.jsonl"),n=ed(r)?x2(r,"utf8"):"";return{contents:[{uri:zs.events,mimeType:"application/x-ndjson",text:n}]}}),t.registerResource("audit",zs.audit,{title:"Cladding audit log",description:"HITL audit log \u2014 every persona dispatch and human signoff.",mimeType:"application/x-ndjson"},async()=>{let r=Ls(e,".cladding","audit.log.jsonl"),n=ed(r)?x2(r,"utf8"):"";return{contents:[{uri:zs.audit,mimeType:"application/x-ndjson",text:n}]}})}function uZe(t,e){let r=(n,i,o)=>{t.registerPrompt(n,{title:`Cladding persona \u2014 ${i}`,description:o,argsSchema:{featureId:oe.string().optional().describe("Optional feature id to interpolate into the persona context")}},s=>{let a=Kh(i),c=s.featureId?` Active feature: ${s.featureId} `:"";return{messages:[{role:"user",content:{type:"text",text:`${a.body}${c}`}}]}})};for(let n of Jse)r(n,n,`Persona prompt body for the ${n} agent.`);for(let[n,i]of Object.entries(Yse))r(n,i,`Persona prompt body for the ${i} agent. (Renamed: '${n}' is now '${i}' in 0.6.0 \u2014 this alias is removed in 0.8.)`)}var Jse,Yse,rZe,zs,mr,Qse=y(()=>{"use strict";Nse();Wa();p2();h2();iy();qA();Hn();at();Hse();Wse();Eb();AD();_f();BS();Qc();nD();Fp();cD();Nb();Jse=["orchestrator","planner","reviewer","observability","developer"],Yse={librarian:"planner",specialists:"developer"},rZe=["clad_list_features","clad_get_feature","clad_run_check","clad_get_events","clad_create_feature","clad_create_scenario","clad_link_capability","clad_author_oracle","clad_run_gate","clad_get_context","clad_get_working_set","clad_get_impact","clad_get_graph","clad_changelog"],zs={spec:"cladding://spec",events:"cladding://events",audit:"cladding://audit"};mr=1});function dZe(t){return Rre.parse(JSON.parse(t))}function eae(t){return JSON.stringify(t)+` @@ -749,4 +749,4 @@ ${o.length} AC(s) required, ${s.length} missing an oracle. `).find(r=>r.trim().length>0);e&&K.stdout.write(` ${Iae(e.trim(),160)} `)}}function Iae(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function aGe(t){let e=Y();K.stdout.write(`${YX(e,".",{internal:t.internal})} `),K.exit(0)}function cGe(t){let e=oE(t);B("note",`route \u2192 ${e}`,t),K.exit(e==="unknown"?1:0)}var lGe={refine:"clarify",panel:"status",drive:"run"};function uGe(t){let e=t?lGe[t]:void 0;e&&K.stderr.write(`cladding: '${t}' is now '${e}' \u2014 the old verb is removed in 0.8 -`)}function dGe(){let t=new Y2;t.name("clad").description("Reference Ironclad CLI").version("0.7.0"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init \uACB0\uC81C SaaS for B2B`) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").action(ZZe),t.command("run [goal]").alias("drive").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(GZe),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(VZe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(JZe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(YZe),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(nGe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(WZe),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(iGe),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>oGe(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(KZe),t.command("status").alias("panel").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").action(aGe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(QZe),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>eGe(r,n)),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>tGe(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full per-feature report as JSON").action(r=>rGe(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>gX(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>yX()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{_X(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").action(r=>h6(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(cGe),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(fJ),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(HZe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").action($6),t.command("clarify [answer...]").alias("refine").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, e.g. `clad clarify \uBC95\uC778 \uC0AC\uC5C5\uC790\uB9CC`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(eX),t}var fGe=!!globalThis.__CLADDING_BUNDLED,pGe=fGe||import.meta.url===`file://${K.argv[1]}`;pGe&&(uGe(K.argv[2]),dGe().parse());export{lGe as RENAMED_VERBS,XZe as TIER_STAGES,dGe as createProgram,uGe as printVerbDeprecationNotice,nGe as runCheckCommand,M2 as runCheckStages,WZe as runCheckpointCommand,QZe as runContextCommand,iGe as runDoneCommand,eGe as runImpactCommand,tGe as runInferDepsCommand,ZZe as runInitCommand,rGe as runMeasureCommand,oGe as runOracleCommand,KZe as runRollbackCommand,cGe as runRouteCommand,GZe as runRunCommand,HZe as runServeCommand,JZe as runSetupCommand,aGe as runStatusCommand,VZe as runSyncCommand,YZe as runUpdateCommand}; +`)}function dGe(){let t=new Y2;t.name("clad").description("Reference Ironclad CLI").version("0.7.1"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init \uACB0\uC81C SaaS for B2B`) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").action(ZZe),t.command("run [goal]").alias("drive").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(GZe),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(VZe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(JZe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(YZe),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(nGe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(WZe),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(iGe),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>oGe(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(KZe),t.command("status").alias("panel").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").action(aGe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(QZe),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>eGe(r,n)),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>tGe(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full per-feature report as JSON").action(r=>rGe(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>gX(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>yX()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{_X(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").action(r=>h6(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(cGe),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(fJ),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(HZe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").action($6),t.command("clarify [answer...]").alias("refine").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, e.g. `clad clarify \uBC95\uC778 \uC0AC\uC5C5\uC790\uB9CC`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(eX),t}var fGe=!!globalThis.__CLADDING_BUNDLED,pGe=fGe||import.meta.url===`file://${K.argv[1]}`;pGe&&(uGe(K.argv[2]),dGe().parse());export{lGe as RENAMED_VERBS,XZe as TIER_STAGES,dGe as createProgram,uGe as printVerbDeprecationNotice,nGe as runCheckCommand,M2 as runCheckStages,WZe as runCheckpointCommand,QZe as runContextCommand,iGe as runDoneCommand,eGe as runImpactCommand,tGe as runInferDepsCommand,ZZe as runInitCommand,rGe as runMeasureCommand,oGe as runOracleCommand,KZe as runRollbackCommand,cGe as runRouteCommand,GZe as runRunCommand,HZe as runServeCommand,JZe as runSetupCommand,aGe as runStatusCommand,VZe as runSyncCommand,YZe as runUpdateCommand}; diff --git a/plugins/codex/.codex-plugin/plugin.json b/plugins/codex/.codex-plugin/plugin.json index bf4ae8af..bbff6267 100644 --- a/plugins/codex/.codex-plugin/plugin.json +++ b/plugins/codex/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.7.0", + "version": "0.7.1", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for OpenAI Codex CLI / IDE / cloud. Exposes spec validation, drift detection, the Iron Law stage runner, and 5 agent personas as Codex skills + an auto-launched MCP server.", "author": { "name": "qwerfunch", diff --git a/plugins/gemini-cli/gemini-extension.json b/plugins/gemini-cli/gemini-extension.json index 066b3782..4e9187a3 100644 --- a/plugins/gemini-cli/gemini-extension.json +++ b/plugins/gemini-cli/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.7.0", + "version": "0.7.1", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Gemini CLI. Exposes spec validation, drift detection, 15 Iron Law stages, and 5 agent personas as custom commands + an auto-launched MCP server.", "contextFileName": "GEMINI.md", "mcpServers": { diff --git a/spec.yaml b/spec.yaml index 738776f3..6c74ff9a 100644 --- a/spec.yaml +++ b/spec.yaml @@ -11,7 +11,7 @@ project: name: cladding language: typescript description: "Reference implementation of the Ironclad harness for AI-coupled software." - version: "0.7.0" + version: "0.7.1" repository: "https://github.com/qwerfunch/cladding" intent_summary: "Make AI-coupled development measurably safer and more honest — 40 drift detectors + 4-tier SSoT governance + A/B-measurable cladding-vs-vanilla evaluation." deliverable: diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 9af83a4c..c985a4a5 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -28,7 +28,7 @@ attested: F-020: 2c5f4a94e3e57e9b F-021: 8a1a82a59a1c45c7 F-022: 8f596a1c737f6d42 - F-02343cd1: 578290b9ec320991 + F-02343cd1: ef8aab92031314d2 F-023: 0c14948e5a91bb0f F-024: f67a86816b06f8ee F-025: 187339b684896b8e @@ -46,17 +46,17 @@ attested: F-037: 7f811c5c8bc0e8e3 F-038: 1338100beadb15a6 F-039: 2e60f3d899b72d7f - F-040: fb89f810140a4a91 + F-040: 0022fc69f6ab5be9 F-041: cddb50fc41e49066 F-042: d1f661281bb9fb6e F-043: 2c5f4a94e3e57e9b - F-044: 1bf702635dbbf92a + F-044: c695f1e075720068 F-045: b494c9a80442ac20 F-046: 4b563fce74b6bb4b F-047: baf5a2dbb9bb5a4b - F-048: 2b7e21a3ed5c32b6 + F-048: 53be306a5be0c15c F-049: 46e2ac1a6cce6a91 - F-051: 098fd3879abffe4d + F-051: 1608ae5d01801633 F-052: 61e043371b9f7c71 F-053: 13a90cd08aec07ae F-054: 5f5d30500bd8cd7f @@ -69,94 +69,94 @@ attested: F-061: c16123610e8fe7fc F-062: 0ab83282a7f7b1ef F-063: d1aa5d1a0e591012 - F-064: 231f01f694cb46b5 + F-064: e4f9fdc234fff67e F-065: e6ed3ef916201947 - F-066: b5de473db7a89eff + F-066: a65820bfcb3568ba F-067: 6e6dbd05bf314b56 F-068: 058091774fa65ef8 - F-069: 9cf62671c6057a36 - F-06dfdad6: f2046016be8f0937 + F-069: 6cf36cd44b52f42b + F-06dfdad6: a552110bf0b40469 F-070: e50bb5d3addc7720 F-071: 3183a483a8015d4c F-072: 44e1d39139c816cc - F-073: 1461ea9027fd955f - F-074: c35e987c6de7f53f - F-075: 4d8346cb6a1bbd14 - F-076: 0061ab2d4b4991a8 - F-077: 7aac44757146b695 - F-078: c6af3d128b98f4e6 - F-079: 2450b633a8a11ebc + F-073: a8a4d62847d4421d + F-074: 2f9e24856e9409cb + F-075: d56a5678b54aa783 + F-076: a1a83ee1367c9a62 + F-077: b05585ff764719ca + F-078: b00a896e952776b8 + F-079: c4a31cfa2a639cdd F-080: 1c19da74d32894e6 F-081: 248f9660cfb1b02b F-098d3b: 42d61bf806ce462b - F-09d68b: 378483eabe4ee4d8 + F-09d68b: 9625119c4e3530ee F-0ed2db: f94e2f45a16ff99c - F-0f2984d0: a85294b0b4128d5d + F-0f2984d0: 9a54160a1ad31390 F-12d740: 84ad71574d306c81 F-15999130: 894b484b7a93690c - F-16138071: b6dd70f1d2840a50 + F-16138071: d59e2605e3dcaba5 F-16746b: 2f98a1261b9b1fc2 F-17df0a: 915d13b33258d3fc F-18e951: d907c170a230e052 - F-1c9166: 09dad0dc6b0be87d - F-1d23a6: 6b019e8fe121c8e7 + F-1c9166: 2ce80010271bbbed + F-1d23a6: 9f6255b60fea3094 F-1edb38: 64283112a3ab96ce - F-24062d: 54e8fc1e30006a78 + F-24062d: 805125645f7661ff F-245bd5: a8372aeb83acc411 - F-2be3e3bb: a85294b0b4128d5d + F-2be3e3bb: 9a54160a1ad31390 F-2de65d: 84ad71574d306c81 F-315fd7: c3b042c80fa7c187 F-31eeb8: d88a9880d29ae411 - F-32b1e0: 4cc7240778eaae75 + F-32b1e0: c1fc15020d878236 F-3788c2: af9778dea8687b29 F-37b4a8: e067655bad681488 - F-3a5339: 7d790460b97b35a7 + F-3a5339: 73f69ea99b45711e F-3b3690: 6a36aad282d36f3a F-40327b: 8295358f7b813c8a - F-417ff0: dde21c2716b745dc + F-417ff0: f438ae2713e9bfbf F-42af48: 7702447a407758a1 F-43d8e3: bbea25941e2b675d F-4747ef: c255a18b6849d002 F-4db939: b2c386ca4e18c117 F-50ff43: fac674314685a912 - F-551a1c: b3df5ef23910b386 - F-569f4b37: b65f8d46b6e57af7 - F-56abaa: 34257a997efcb048 - F-570a3f: dfb4267629a84295 + F-551a1c: 29d021f9f2993cca + F-569f4b37: 9d7cf792bf270ce5 + F-56abaa: a0b445d1dbb2247a + F-570a3f: 5e39856f9d2aa4b1 F-59f093: 26735424fba6308c F-5b188856: d1e2e4184aa76c12 - F-5b9f9f: c9f8b72b10fa5d7c + F-5b9f9f: b5251329ea5686c2 F-5d3ed2: 9452eac28760fb99 F-5f6b45: 15323c4f5b619de7 - F-64a5c159: dd42d7d046380184 + F-64a5c159: a8afca34fb00d0f3 F-65814a: 2136c8b8c94ef535 - F-67d2e9: ad7a8fe2939cd13c - F-67e33f: 80a0b17ae9fc4a2b - F-6d943d: e02e71ed007aded2 + F-67d2e9: d2f84f17aa36ae99 + F-67e33f: 679be18899f2ed8f + F-6d943d: 2b53bfced7b1e70d F-6f80e7: 0c0e5b71ae22cc26 F-7076f7: 7e819e0d440f3ffe - F-7794a6bc: ca831090957472c9 + F-7794a6bc: 01f721a95af19e48 F-77f7ead0: 4fd1ec36a5726fe9 F-78b50d: 688e6afe2352a034 F-7afbd4: 18ce48352bee0fce - F-7ce18e: 7effa760a0661b6a + F-7ce18e: 0cbbcbe6fee8562e F-7fa4a7: 19b7709a0b2202e3 - F-80d19d: 4988733647f7777d - F-836a90: 9e5bbc7ff223634b + F-80d19d: b6f506d5ee3b85c8 + F-836a90: 202d204521160071 F-8f419e: f3473746f4e252bc - F-904495a5: 1684fb1beb040cab - F-9064ff: 9efbbb6021aadfb9 + F-904495a5: b290a98b9decc1f1 + F-9064ff: 410b0478070cdd8f F-94dda4: 8dfb0267c45534f9 F-95a096: e8ed4fb958234914 F-96250595: 41b790c427d2b01b F-96700032: 5ae97b4c82c14acc F-99c6e5: 8a8724852f1d6059 F-9a3b61: 786eeefef2d25138 - F-9b643e: b0672cf024eacf79 - F-9d168287: c78b3fdff9219838 + F-9b643e: 651f27c726dae8d3 + F-9d168287: a7f7788dea42b0d9 F-a04cd9: e65d87671306d305 F-a4b512: d136f2a1bbc4383a - F-a5228c: aaf1d6876a5c7221 + F-a5228c: a577e4a2a2f0c0ff F-aa7197: 7f561e4f3c902716 F-ae61c1: 7c3c8622e5375754 F-aee1da: a6d7525a6c547877 @@ -166,37 +166,37 @@ attested: F-b2094740: f379bf4feef6771a F-b43066: 9402b630adcf1eae F-b61449: 7095ce00662e987d - F-b84c38: 0fe2398b9a9bf903 - F-b99577: e4d31fc716849096 + F-b84c38: 5df890ae36e3d072 + F-b99577: fc7df479ea92f0dd F-ba2e05: 158e77c8af32514a F-ba4b7a: c282e0e915ed547c - F-bb15e6: c8884a476d268166 + F-bb15e6: ea9b217fd8ac6fe0 F-bd07d7: 4bf7e1baddf5d754 - F-bdcd90: 1fd023791a264f34 - F-c037ae: 1d498809c898760d - F-c2c996: c92ab5bb0fbd1367 - F-c48eb2: 9358d7394e88e95c + F-bdcd90: e19b8ee840ef58c4 + F-c037ae: 0601d791da73a6f3 + F-c2c996: d82fdaab2e6ded77 + F-c48eb2: 899bf69592c91775 F-c4c5ae: 18200d79542ae22e - F-c6a32fff: 056320bfd510c090 + F-c6a32fff: 00f44ae222503b95 F-c8aef8: 02e07f929a1d0ded F-cd0415: 9cf6ce40e2a8b381 F-cfba0c: 077c03b8a96f562b F-d12edf: c19aa5d1007e0b8f - F-d2c806: 829db2373596bbdd + F-d2c806: 1cf20a658d36f4db F-d3bde4: 915d13b33258d3fc - F-d49585: f3ef2fc02122533a - F-d6b93648: d272c3163ca37592 - F-d7312b: cdba5500f011277e + F-d49585: ca1e61197a081bd6 + F-d6b93648: 17a042248a45dbcc + F-d7312b: d5592f2eb809487f F-d8223c: 0501e9564231899b F-d980359c: 8f1559276afc5c03 F-dd51b42c: 496eeffa2641169d F-dddb89: f5625354e55eba9b - F-e0f6c7: d5680b929768cc3c + F-e0f6c7: 36f3f085741af993 F-eb732f: d8abb536ff850a7a F-ee47fc2b: adb87c97b8ccf6e1 - F-ee5f643e: ae47c1d5466936fa + F-ee5f643e: cf9efe9caa0956af F-ef2fd9: b3a1dcd1e750a714 F-f334fa: 5207f35968a0c9b2 F-f44d1b: 62e0779d9c0ef11f F-f6d13e: fb5c242416832024 - F-fcece7: eab583d9b33492f7 + F-fcece7: f539ae3efd09efd8 diff --git a/src/cli/clad.ts b/src/cli/clad.ts index 3a6a0a56..edf5ed84 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -833,7 +833,7 @@ export function printVerbDeprecationNotice(verb: string | undefined): void { */ export function createProgram(): Command { const program = new Command(); - program.name('clad').description('Reference Ironclad CLI').version('0.7.0'); + program.name('clad').description('Reference Ironclad CLI').version('0.7.1'); program .command('init [intent...]') diff --git a/src/serve/server.ts b/src/serve/server.ts index 1eb9d16b..b9ef797b 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -116,7 +116,7 @@ export function buildServer(opts: ServerOptions = {}): McpServer { const server = new McpServer( { name: opts.name ?? 'cladding', - version: opts.version ?? '0.7.0', + version: opts.version ?? '0.7.1', }, { // Declare subscribe support so clients can subscribe to diff --git a/tests/cli/clad.test.ts b/tests/cli/clad.test.ts index 4c9bb704..f7cfa6f9 100644 --- a/tests/cli/clad.test.ts +++ b/tests/cli/clad.test.ts @@ -531,7 +531,7 @@ describe('cli/clad — createProgram', () => { test('program version matches current package version', () => { const program = clad.createProgram(); - expect(program.version()).toBe('0.7.0'); + expect(program.version()).toBe('0.7.1'); }); });