diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 6798628..425e76f 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.9.0", + "version": "0.9.1", "author": { "name": "qwerfunch" }, diff --git a/CHANGELOG.md b/CHANGELOG.md index 00b81e6..fc4f7c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,31 @@ All notable changes to Cladding are documented here. Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/). Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). +## [0.9.1] — Adoption keeps approved capabilities + polyglot gate fidelity (2026-07-21) + +**In one line:** adopting an existing project now keeps the capabilities you approved, and the gate reads and reports non-JavaScript projects more faithfully while nudging when the feature cycle isn't being driven. + +### Fixed + +- **Existing-project adoption keeps the capabilities you approved.** When you adopt a project that already has code, the capabilities produced and confirmed during onboarding are now written to `spec/capabilities.yaml`. Previously the observed-scan path re-derived them from README headings — or left `capabilities: []` when the repo had none — silently discarding the approved set. The greenfield path already honored them; the scan path now matches it. Conventions and architecture stay scanner-sourced. + +### Gate and toolchain fidelity + +- **The check-only formatters list every dirty file, not just the first.** `dart format` (and peers like `dotnet format`) print one changed-file line each; those aren't ESLint-shaped, so the lint stage used to collapse them to a single pathless finding — fix one, re-run, the next appears. Each dirty file now surfaces as its own finding with its path, plus a one-line `fix: run \`dart format .\`` hint. +- **Python projects run the test suite once per gate, not twice.** On pytest projects the unit stage and the coverage stage each spawned the whole suite (`pytest`, then `coverage run -m pytest`) — roughly doubling gate time. The unit stage now runs the coverage-instrumented suite once and shares it with the coverage stage, the same dedup vitest already had. The zero-executed-tests guard still applies on the shared pytest run, so the dedup can't turn a vacuous run green. +- **The header-comment convention check understands more languages.** It now recognises `#` comments and Python docstrings (`"""`, `'''`), not only `//` / `/*`. + +### Feature-cycle signals + +- **A non-blocking nudge when sustained source edits are bound to no feature.** When edits to files that no feature tracks accumulate past a small threshold, the post-edit card surfaces one advisory to start a feature — so the spec-first cycle gets triggered instead of silently skipped. Debounced and once-per-window; it never blocks. +- **`clad check` flags unenforced projects.** When a project has features not yet done but neither a git hook nor CI wires the gate, `clad check` prints one advisory that the checks run only when asked — with how to wire enforcement. Informational only; it never changes the exit status. +- **A cold-start signal when a project has code but no feature specs.** `clad check` and session start now say the spec-first cycle hasn't begun, instead of the project looking clean. Advisory only. +- **Onboarding hands off to authoring the first feature spec, not straight to code**, and writing code ahead of its spec is caught both at that handoff and at the resting state. + +### Plain-language output + +- **Soft-shell jargon leaks closed and enforcement tightened.** More user-facing output stays in plain words rather than internal cladding terms; the plain-language guard now also checks the finding lead line and forbids raw internal identifiers. + ## [0.9.0] — Project-scoped natural-language onboarding (2026-07-16) **In one line:** apply Cladding from ordinary conversation without a shell command, while project-local discovery, a read-only preview, an exact approval phrase, and atomic recovery keep onboarding bounded. diff --git a/README.html b/README.html index 38cf2bb..5e7a96b 100644 --- a/README.html +++ b/README.html @@ -233,7 +233,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -548,7 +548,7 @@

Status

tests
-
2561/2561
+
2602/2602
all pass
@@ -558,8 +558,8 @@

Status

features
-
255
-
252 done · self-spec
+
261
+
258 done · self-spec
diff --git a/README.ja.md b/README.ja.md index ca22b93..d6f5ee6 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -339,7 +339,7 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.0(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2561 / 2561 | 15 段階 · 41 detectors | 255(252 done) | +| v0.9.0(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2602 / 2602 | 15 段階 · 41 detectors | 261(258 done) | 236 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック diff --git a/README.ko.html b/README.ko.html index d2a07c1..c304e32 100644 --- a/README.ko.html +++ b/README.ko.html @@ -275,7 +275,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -584,7 +584,7 @@

Status

tests
-
2561/2561
+
2602/2602
all pass
@@ -594,8 +594,8 @@

Status

features
-
255
-
252 done · 자기 스펙
+
261
+
258 done · 자기 스펙
diff --git a/README.ko.md b/README.ko.md index 427e761..3d9db6d 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -338,7 +338,7 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.0 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2561 / 2561 · all pass | 15 단계 · 41 detectors | 255 · 252 done · 자기 스펙 | +| v0.9.0 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2602 / 2602 · all pass | 15 단계 · 41 detectors | 261 · 258 done · 자기 스펙 | 236 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 diff --git a/README.md b/README.md index 5a87432..979e893 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -352,7 +352,7 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.0 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2561 / 2561 | 15 stages · 41 detectors | 255 (252 done) | +| v0.9.0 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2602 / 2602 | 15 stages · 41 detectors | 261 (258 done) | 236 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/README.zh.md b/README.zh.md index 9256197..12839a2 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -335,7 +335,7 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.0(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2561 / 2561 | 15 阶段 · 41 检测器 | 255(252 done) | +| v0.9.0(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2602 / 2602 | 15 阶段 · 41 检测器 | 261(258 done) | 236 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/docs/ab-evaluation/case-existing-adoption.md b/docs/ab-evaluation/case-existing-adoption.md index 54cd639..f062637 100644 --- a/docs/ab-evaluation/case-existing-adoption.md +++ b/docs/ab-evaluation/case-existing-adoption.md @@ -51,8 +51,8 @@ No spec, no architecture invariants — just code on the existing tree. | Test files | 1 | 1 | +0 | | Test LoC | 14 | 14 | +0 | | Test cases | 1 | 1 | +0 | -| Total chars (artifacts + code) | 11268 | 3864 | +7404 | -| Estimated tokens | 2819 | 967 | +1852 | +| Total chars (artifacts + code) | 11104 | 3864 | +7240 | +| Estimated tokens | 2778 | 967 | +1811 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -90,8 +90,8 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 | Test files | 2 | 2 | +0 | | Test LoC | 27 | 27 | +0 | | Test cases | 3 | 3 | +0 | -| Total chars (artifacts + code) | 12811 | 5115 | +7696 | -| Estimated tokens | 3205 | 1280 | +1925 | +| Total chars (artifacts + code) | 12624 | 5115 | +7509 | +| Estimated tokens | 3158 | 1280 | +1878 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -111,7 +111,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 - **Spec ↔ code traceability**: cladding emits 1 feature(s), 2 AC(s), 1 scenario(s), 3 capability(s); vanilla has 0 of each. - **Architecture enforcement**: cladding declares 3 layer(s) with 0 forbidden-import rule(s); vanilla has 0. - **Detector behavior**: cladding-managed tree → 1 error(s) / 1 warn(s) / 11 info(s). Vanilla tree → 1 / 3 / 28. The detectors that gate against spec (REFERENCE_INTEGRITY, MISSING_IMPLEMENTATION, ARCHITECTURE_FROM_SPEC, CAPABILITIES_FEATURE_MAPPING) need cladding's artifacts to evaluate — without them they silently pass. The "0 errors on vanilla" therefore is **absence of signal**, not absence of drift. -- **Token cost**: cladding's cumulative artifact + code consumes ~3205 tokens vs vanilla's ~1280 (heuristic chars/4) — Δ ≈ 1925 tokens, the price of structure. +- **Token cost**: cladding's cumulative artifact + code consumes ~3158 tokens vs vanilla's ~1280 (heuristic chars/4) — Δ ≈ 1878 tokens, the price of structure. - **Code surface**: vanilla writes 9 source file(s) / 144 LoC + 2 test file(s) / 3 test case(s); cladding writes 9 / 128 + 2 / 3. (Vanilla front-loads code, cladding front-loads spec — both converge by M2.) ## Outcome Quality (F-ba2e05) diff --git a/docs/ab-evaluation/case-payment-saas.md b/docs/ab-evaluation/case-payment-saas.md index 549a169..6c64f93 100644 --- a/docs/ab-evaluation/case-payment-saas.md +++ b/docs/ab-evaluation/case-payment-saas.md @@ -50,8 +50,8 @@ no spec, no scenarios, no architecture invariants. | Test files | 0 | 1 | -1 | | Test LoC | 0 | 20 | -20 | | Test cases | 0 | 2 | -2 | -| Total chars (artifacts + code) | 6708 | 3463 | +3245 | -| Estimated tokens | 1679 | 867 | +812 | +| Total chars (artifacts + code) | 6600 | 3463 | +3137 | +| Estimated tokens | 1652 | 867 | +785 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -89,8 +89,8 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 | Test files | 1 | 2 | -1 | | Test LoC | 8 | 33 | -25 | | Test cases | 1 | 4 | -3 | -| Total chars (artifacts + code) | 7872 | 5592 | +2280 | -| Estimated tokens | 1970 | 1399 | +571 | +| Total chars (artifacts + code) | 7764 | 5592 | +2172 | +| Estimated tokens | 1943 | 1399 | +544 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -110,7 +110,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 - **Spec ↔ code traceability**: cladding emits 1 feature(s), 2 AC(s), 2 scenario(s), 3 capability(s); vanilla has 0 of each. - **Architecture enforcement**: cladding declares 3 layer(s) with 2 forbidden-import rule(s); vanilla has 0. - **Detector behavior**: cladding-managed tree → 1 error(s) / 3 warn(s) / 15 info(s). Vanilla tree → 1 / 3 / 28. The detectors that gate against spec (REFERENCE_INTEGRITY, MISSING_IMPLEMENTATION, ARCHITECTURE_FROM_SPEC, CAPABILITIES_FEATURE_MAPPING) need cladding's artifacts to evaluate — without them they silently pass. The "0 errors on vanilla" therefore is **absence of signal**, not absence of drift. -- **Token cost**: cladding's cumulative artifact + code consumes ~1970 tokens vs vanilla's ~1399 (heuristic chars/4) — Δ ≈ 571 tokens, the price of structure. +- **Token cost**: cladding's cumulative artifact + code consumes ~1943 tokens vs vanilla's ~1399 (heuristic chars/4) — Δ ≈ 544 tokens, the price of structure. - **Code surface**: vanilla writes 5 source file(s) / 126 LoC + 2 test file(s) / 4 test case(s); cladding writes 1 / 11 + 1 / 1. (Vanilla front-loads code, cladding front-loads spec — both converge by M2.) ## Outcome Quality (F-ba2e05) diff --git a/package-lock.json b/package-lock.json index 425017f..e102545 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cladding", - "version": "0.9.0", + "version": "0.9.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cladding", - "version": "0.9.0", + "version": "0.9.1", "license": "MIT", "dependencies": { "@anthropic-ai/sdk": "^0.96.0", diff --git a/package.json b/package.json index d63f320..bec402f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.0", + "version": "0.9.1", "description": "Spec-driven verification layer for AI coding agents — Claude Code · Codex · Gemini · Antigravity · Cursor. Intent in before it writes, result verified against your spec after. Reference implementation of the Ironclad standard.", "type": "module", "license": "MIT", diff --git a/plugins/antigravity/skills/init/SKILL.md b/plugins/antigravity/skills/init/SKILL.md index 1de064d..a7cb315 100644 --- a/plugins/antigravity/skills/init/SKILL.md +++ b/plugins/antigravity/skills/init/SKILL.md @@ -19,7 +19,7 @@ If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. 4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. 5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. -6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that onboarding is complete and that the next step is to author the first feature's spec — its acceptance criteria and the files it will cover — before writing any code; the feature cycle starts there, not with scaffolding. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/plugins/claude-code/.claude-plugin/plugin.json b/plugins/claude-code/.claude-plugin/plugin.json index 9afa72c..9a3de43 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.9.0", + "version": "0.9.1", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Claude Code.", "author": { "name": "qwerfunch" diff --git a/plugins/claude-code/commands/init.md b/plugins/claude-code/commands/init.md index 1de064d..a7cb315 100644 --- a/plugins/claude-code/commands/init.md +++ b/plugins/claude-code/commands/init.md @@ -19,7 +19,7 @@ If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. 4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. 5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. -6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that onboarding is complete and that the next step is to author the first feature's spec — its acceptance criteria and the files it will cover — before writing any code; the feature cycle starts there, not with scaffolding. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index fe80975..f7c74bc 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 Rde=Object.create;var $A=Object.defineProperty;var Ide=Object.getOwnPropertyDescriptor;var Pde=Object.getOwnPropertyNames;var Cde=Object.getPrototypeOf,Dde=Object.prototype.hasOwnProperty;var Ge=(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),Pr=(t,e)=>{for(var r in e)$A(t,r,{get:e[r],enumerable:!0})},Nde=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Pde(e))!Dde.call(t,i)&&i!==r&&$A(t,i,{get:()=>e[i],enumerable:!(n=Ide(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Rde(Cde(t)):{},Nde(e||!t||!t.__esModule?$A(r,"default",{value:t,enumerable:!0}):r,t));var rf=v(EA=>{var yy=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}},kA=class extends yy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};EA.CommanderError=yy;EA.InvalidArgumentError=kA});var _y=v(TA=>{var{InvalidArgumentError:jde}=rf(),AA=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 jde(`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 Mde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}TA.Argument=AA;TA.humanReadableArgName=Mde});var IA=v(RA=>{var{humanReadableArgName:Fde}=_y(),OA=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=>Fde(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 i4(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),Pr=(t,e)=>{for(var r in e)EA(t,r,{get:e[r],enumerable:!0})},Bde=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of zde(e))!qde.call(t,i)&&i!==r&&EA(t,i,{get:()=>e[i],enumerable:!(n=Lde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Fde(Ude(t)):{},Bde(e||!t||!t.__esModule?EA(r,"default",{value:t,enumerable:!0}):r,t));var nf=v(TA=>{var by=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}},AA=class extends by{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};TA.CommanderError=by;TA.InvalidArgumentError=AA});var vy=v(RA=>{var{InvalidArgumentError:Hde}=nf(),OA=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 Hde(`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 Gde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}RA.Argument=OA;RA.humanReadableArgName=Gde});var CA=v(PA=>{var{humanReadableArgName:Zde}=vy(),IA=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=>Zde(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 u4(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 i4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}RA.Help=OA;RA.stripColor=i4});var NA=v(DA=>{var{InvalidArgumentError:Lde}=rf(),PA=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=zde(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 Lde(`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?o4(this.name().replace(/^no-/,"")):o4(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}},CA=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 o4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function zde(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 u4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}PA.Help=IA;PA.stripColor=u4});var MA=v(jA=>{var{InvalidArgumentError:Vde}=nf(),DA=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=Wde(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 Vde(`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?d4(this.name().replace(/^no-/,"")):d4(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}},NA=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 d4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Wde(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}}DA.Option=PA;DA.DualOptions=CA});var a4=v(s4=>{function Ude(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 qde(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=Ude(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}}jA.Option=DA;jA.DualOptions=NA});var p4=v(f4=>{function Kde(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 Jde(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=Kde(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]}?)`:""}s4.suggestSimilar=qde});var d4=v(zA=>{var Bde=Ge("node:events").EventEmitter,jA=Ge("node:child_process"),uo=Ge("node:path"),by=Ge("node:fs"),qe=Ge("node:process"),{Argument:Hde,humanReadableArgName:Gde}=_y(),{CommanderError:MA}=rf(),{Help:Zde,stripColor:Vde}=IA(),{Option:c4,DualOptions:Wde}=NA(),{suggestSimilar:l4}=a4(),FA=class t extends Bde{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=>qe.stdout.write(r),writeErr:r=>qe.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>qe.stdout.isTTY?qe.stdout.columns:void 0,getErrHelpWidth:()=>qe.stderr.isTTY?qe.stderr.columns:void 0,getOutHasColors:()=>LA()??(qe.stdout.isTTY&&qe.stdout.hasColors?.()),getErrHasColors:()=>LA()??(qe.stderr.isTTY&&qe.stderr.hasColors?.()),stripColor:r=>Vde(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 Zde,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 Hde(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 MA(e,r,n)),qe.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 c4(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 c4)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){qe.versions?.electron&&(r.from="electron");let i=qe.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=qe.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":qe.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(by.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]}?)`:""}f4.suggestSimilar=Jde});var y4=v(qA=>{var Yde=Ge("node:events").EventEmitter,FA=Ge("node:child_process"),fo=Ge("node:path"),Sy=Ge("node:fs"),Be=Ge("node:process"),{Argument:Xde,humanReadableArgName:Qde}=vy(),{CommanderError:LA}=nf(),{Help:efe,stripColor:tfe}=CA(),{Option:m4,DualOptions:rfe}=MA(),{suggestSimilar:h4}=p4(),zA=class t extends Yde{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=>Be.stdout.write(r),writeErr:r=>Be.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Be.stdout.isTTY?Be.stdout.columns:void 0,getErrHelpWidth:()=>Be.stderr.isTTY?Be.stderr.columns:void 0,getOutHasColors:()=>UA()??(Be.stdout.isTTY&&Be.stdout.hasColors?.()),getErrHasColors:()=>UA()??(Be.stderr.isTTY&&Be.stderr.hasColors?.()),stripColor:r=>tfe(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 efe,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 Xde(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 LA(e,r,n)),Be.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 m4(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 m4)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){Be.versions?.electron&&(r.from="electron");let i=Be.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Be.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":Be.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(Sy.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=uo.resolve(u,d);if(by.existsSync(f))return f;if(i.includes(uo.extname(d)))return;let p=i.find(m=>by.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=by.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=uo.resolve(uo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=uo.basename(this._scriptPath,uo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(uo.extname(s));let c;qe.platform!=="win32"?n?(r.unshift(s),r=u4(qe.execArgv).concat(r),c=jA.spawn(qe.argv[0],r,{stdio:"inherit"})):c=jA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=u4(qe.execArgv).concat(r),c=jA.spawn(qe.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{qe.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 MA(u,"commander.executeSubCommandAsync","(close)")):qe.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)qe.exit(1);else{let d=new MA(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=fo.resolve(u,d);if(Sy.existsSync(f))return f;if(i.includes(fo.extname(d)))return;let p=i.find(m=>Sy.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=Sy.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=fo.resolve(fo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=fo.basename(this._scriptPath,fo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(fo.extname(s));let c;Be.platform!=="win32"?n?(r.unshift(s),r=g4(Be.execArgv).concat(r),c=FA.spawn(Be.argv[0],r,{stdio:"inherit"})):c=FA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=g4(Be.execArgv).concat(r),c=FA.spawn(Be.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Be.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 LA(u,"commander.executeSubCommandAsync","(close)")):Be.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)Be.exit(1);else{let d=new LA(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 qe.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()}`,qe.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Wde(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=l4(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=l4(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=>Gde(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=uo.basename(e,uo.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(qe.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 Be.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()}`,Be.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new rfe(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=h4(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=h4(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=>Qde(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=fo.basename(e,fo.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(Be.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 u4(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 LA(){if(qe.env.NO_COLOR||qe.env.FORCE_COLOR==="0"||qe.env.FORCE_COLOR==="false")return!1;if(qe.env.FORCE_COLOR||qe.env.CLICOLOR_FORCE!==void 0)return!0}zA.Command=FA;zA.useColor=LA});var h4=v($n=>{var{Argument:f4}=_y(),{Command:UA}=d4(),{CommanderError:Kde,InvalidArgumentError:p4}=rf(),{Help:Jde}=IA(),{Option:m4}=NA();$n.program=new UA;$n.createCommand=t=>new UA(t);$n.createOption=(t,e)=>new m4(t,e);$n.createArgument=(t,e)=>new f4(t,e);$n.Command=UA;$n.Option=m4;$n.Argument=f4;$n.Help=Jde;$n.CommanderError=Kde;$n.InvalidArgumentError=p4;$n.InvalidOptionArgumentError=p4});var De=v(Xt=>{"use strict";var BA=Symbol.for("yaml.alias"),b4=Symbol.for("yaml.document"),vy=Symbol.for("yaml.map"),v4=Symbol.for("yaml.pair"),HA=Symbol.for("yaml.scalar"),Sy=Symbol.for("yaml.seq"),fo=Symbol.for("yaml.node.type"),rfe=t=>!!t&&typeof t=="object"&&t[fo]===BA,nfe=t=>!!t&&typeof t=="object"&&t[fo]===b4,ife=t=>!!t&&typeof t=="object"&&t[fo]===vy,ofe=t=>!!t&&typeof t=="object"&&t[fo]===v4,S4=t=>!!t&&typeof t=="object"&&t[fo]===HA,sfe=t=>!!t&&typeof t=="object"&&t[fo]===Sy;function w4(t){if(t&&typeof t=="object")switch(t[fo]){case vy:case Sy:return!0}return!1}function afe(t){if(t&&typeof t=="object")switch(t[fo]){case BA:case vy:case HA:case Sy:return!0}return!1}var cfe=t=>(S4(t)||w4(t))&&!!t.anchor;Xt.ALIAS=BA;Xt.DOC=b4;Xt.MAP=vy;Xt.NODE_TYPE=fo;Xt.PAIR=v4;Xt.SCALAR=HA;Xt.SEQ=Sy;Xt.hasAnchor=cfe;Xt.isAlias=rfe;Xt.isCollection=w4;Xt.isDocument=nfe;Xt.isMap=ife;Xt.isNode=afe;Xt.isPair=ofe;Xt.isScalar=S4;Xt.isSeq=sfe});var nf=v(GA=>{"use strict";var zt=De(),Cr=Symbol("break visit"),x4=Symbol("skip children"),ki=Symbol("remove node");function wy(t,e){let r=$4(e);zt.isDocument(t)?Jc(null,t.contents,r,Object.freeze([t]))===ki&&(t.contents=null):Jc(null,t,r,Object.freeze([]))}wy.BREAK=Cr;wy.SKIP=x4;wy.REMOVE=ki;function Jc(t,e,r,n){let i=k4(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return E4(t,n,i),Jc(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var A4=De(),lfe=nf(),ufe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},dfe=t=>t.replace(/[!,[\]{}]/g,e=>ufe[e]),of=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+dfe(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&&A4.isNode(e.contents)){let o={};lfe.visit(e.contents,(s,a)=>{A4.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(` -`)}};of.defaultYaml={explicit:!1,version:"1.2"};of.defaultTags={"!!":"tag:yaml.org,2002:"};T4.Directives=of});var $y=v(sf=>{"use strict";var O4=De(),ffe=nf();function pfe(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 R4(t){let e=new Set;return ffe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function I4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function mfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=R4(t));let s=I4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(O4.isScalar(s.node)||O4.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}}sf.anchorIsValid=pfe;sf.anchorNames=R4;sf.createNodeAnchors=mfe;sf.findNewAnchor=I4});var VA=v(P4=>{"use strict";function af(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var hfe=De();function C4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>C4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!hfe.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}D4.toJS=C4});var ky=v(j4=>{"use strict";var gfe=VA(),N4=De(),yfe=Zo(),WA=class{constructor(e){Object.defineProperty(this,N4.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(!N4.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=yfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?gfe.applyReviver(o,{"":a},"",a):a}};j4.NodeBase=WA});var cf=v(M4=>{"use strict";var _fe=$y(),bfe=nf(),Xc=De(),vfe=ky(),Sfe=Zo(),KA=class extends vfe.NodeBase{constructor(e){super(Xc.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=[],bfe.visit(e,{Node:(o,s)=>{(Xc.isAlias(s)||Xc.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||(Sfe.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=Ey(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(_fe.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 Ey(t,e,r){if(Xc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Xc.isCollection(e)){let n=0;for(let i of e.items){let o=Ey(t,i,r);o>n&&(n=o)}return n}else if(Xc.isPair(e)){let n=Ey(t,e.key,r),i=Ey(t,e.value,r);return Math.max(n,i)}return 1}M4.Alias=KA});var Dt=v(JA=>{"use strict";var wfe=De(),xfe=ky(),$fe=Zo(),kfe=t=>!t||typeof t!="function"&&typeof t!="object",Vo=class extends xfe.NodeBase{constructor(e){super(wfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:$fe.toJS(this.value,e,r)}toString(){return String(this.value)}};Vo.BLOCK_FOLDED="BLOCK_FOLDED";Vo.BLOCK_LITERAL="BLOCK_LITERAL";Vo.PLAIN="PLAIN";Vo.QUOTE_DOUBLE="QUOTE_DOUBLE";Vo.QUOTE_SINGLE="QUOTE_SINGLE";JA.Scalar=Vo;JA.isScalarValue=kfe});var lf=v(L4=>{"use strict";var Efe=cf(),da=De(),F4=Dt(),Afe="tag:yaml.org,2002:";function Tfe(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 Ofe(t,e,r){if(da.isDocument(t)&&(t=t.contents),da.isNode(t))return t;if(da.isPair(t)){let d=r.schema[da.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 Efe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Afe+e.slice(2));let l=Tfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new F4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[da.MAP]:Symbol.iterator in Object(t)?s[da.SEQ]:s[da.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 F4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}L4.createNode=Ofe});var Ty=v(Ay=>{"use strict";var Rfe=lf(),Ei=De(),Ife=ky();function YA(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 Rfe.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 z4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,XA=class extends Ife.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=>Ei.isNode(n)||Ei.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(z4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Ei.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,YA(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(Ei.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&&Ei.isScalar(o)?o.value:o:Ei.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Ei.isPair(r))return!1;let n=r.value;return n==null||e&&Ei.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 Ei.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(Ei.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,YA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Ay.Collection=XA;Ay.collectionFromPath=YA;Ay.isEmptyPath=z4});var uf=v(Oy=>{"use strict";var Pfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function QA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Cfe=(t,e,r)=>t.endsWith(` -`)?QA(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 g4(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 UA(){if(Be.env.NO_COLOR||Be.env.FORCE_COLOR==="0"||Be.env.FORCE_COLOR==="false")return!1;if(Be.env.FORCE_COLOR||Be.env.CLICOLOR_FORCE!==void 0)return!0}qA.Command=zA;qA.useColor=UA});var S4=v(kn=>{var{Argument:_4}=vy(),{Command:BA}=y4(),{CommanderError:nfe,InvalidArgumentError:b4}=nf(),{Help:ife}=CA(),{Option:v4}=MA();kn.program=new BA;kn.createCommand=t=>new BA(t);kn.createOption=(t,e)=>new v4(t,e);kn.createArgument=(t,e)=>new _4(t,e);kn.Command=BA;kn.Option=v4;kn.Argument=_4;kn.Help=ife;kn.CommanderError=nfe;kn.InvalidArgumentError=b4;kn.InvalidOptionArgumentError=b4});var De=v(Qt=>{"use strict";var GA=Symbol.for("yaml.alias"),k4=Symbol.for("yaml.document"),wy=Symbol.for("yaml.map"),E4=Symbol.for("yaml.pair"),ZA=Symbol.for("yaml.scalar"),xy=Symbol.for("yaml.seq"),po=Symbol.for("yaml.node.type"),ufe=t=>!!t&&typeof t=="object"&&t[po]===GA,dfe=t=>!!t&&typeof t=="object"&&t[po]===k4,ffe=t=>!!t&&typeof t=="object"&&t[po]===wy,pfe=t=>!!t&&typeof t=="object"&&t[po]===E4,A4=t=>!!t&&typeof t=="object"&&t[po]===ZA,mfe=t=>!!t&&typeof t=="object"&&t[po]===xy;function T4(t){if(t&&typeof t=="object")switch(t[po]){case wy:case xy:return!0}return!1}function hfe(t){if(t&&typeof t=="object")switch(t[po]){case GA:case wy:case ZA:case xy:return!0}return!1}var gfe=t=>(A4(t)||T4(t))&&!!t.anchor;Qt.ALIAS=GA;Qt.DOC=k4;Qt.MAP=wy;Qt.NODE_TYPE=po;Qt.PAIR=E4;Qt.SCALAR=ZA;Qt.SEQ=xy;Qt.hasAnchor=gfe;Qt.isAlias=ufe;Qt.isCollection=T4;Qt.isDocument=dfe;Qt.isMap=ffe;Qt.isNode=hfe;Qt.isPair=pfe;Qt.isScalar=A4;Qt.isSeq=mfe});var of=v(VA=>{"use strict";var Ut=De(),Cr=Symbol("break visit"),O4=Symbol("skip children"),Ai=Symbol("remove node");function $y(t,e){let r=R4(e);Ut.isDocument(t)?Qc(null,t.contents,r,Object.freeze([t]))===Ai&&(t.contents=null):Qc(null,t,r,Object.freeze([]))}$y.BREAK=Cr;$y.SKIP=O4;$y.REMOVE=Ai;function Qc(t,e,r,n){let i=I4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return P4(t,n,i),Qc(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var C4=De(),yfe=of(),_fe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},bfe=t=>t.replace(/[!,[\]{}]/g,e=>_fe[e]),sf=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+bfe(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&&C4.isNode(e.contents)){let o={};yfe.visit(e.contents,(s,a)=>{C4.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(` +`)}};sf.defaultYaml={explicit:!1,version:"1.2"};sf.defaultTags={"!!":"tag:yaml.org,2002:"};D4.Directives=sf});var Ey=v(af=>{"use strict";var N4=De(),vfe=of();function Sfe(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 j4(t){let e=new Set;return vfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function M4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function wfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=j4(t));let s=M4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(N4.isScalar(s.node)||N4.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}}af.anchorIsValid=Sfe;af.anchorNames=j4;af.createNodeAnchors=wfe;af.findNewAnchor=M4});var KA=v(F4=>{"use strict";function cf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var xfe=De();function L4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>L4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!xfe.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}z4.toJS=L4});var Ay=v(q4=>{"use strict";var $fe=KA(),U4=De(),kfe=Zo(),JA=class{constructor(e){Object.defineProperty(this,U4.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(!U4.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=kfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?$fe.applyReviver(o,{"":a},"",a):a}};q4.NodeBase=JA});var lf=v(B4=>{"use strict";var Efe=Ey(),Afe=of(),tl=De(),Tfe=Ay(),Ofe=Zo(),YA=class extends Tfe.NodeBase{constructor(e){super(tl.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=[],Afe.visit(e,{Node:(o,s)=>{(tl.isAlias(s)||tl.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||(Ofe.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=Ty(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(Efe.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 Ty(t,e,r){if(tl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(tl.isCollection(e)){let n=0;for(let i of e.items){let o=Ty(t,i,r);o>n&&(n=o)}return n}else if(tl.isPair(e)){let n=Ty(t,e.key,r),i=Ty(t,e.value,r);return Math.max(n,i)}return 1}B4.Alias=YA});var Dt=v(XA=>{"use strict";var Rfe=De(),Ife=Ay(),Pfe=Zo(),Cfe=t=>!t||typeof t!="function"&&typeof t!="object",Vo=class extends Ife.NodeBase{constructor(e){super(Rfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Pfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Vo.BLOCK_FOLDED="BLOCK_FOLDED";Vo.BLOCK_LITERAL="BLOCK_LITERAL";Vo.PLAIN="PLAIN";Vo.QUOTE_DOUBLE="QUOTE_DOUBLE";Vo.QUOTE_SINGLE="QUOTE_SINGLE";XA.Scalar=Vo;XA.isScalarValue=Cfe});var uf=v(G4=>{"use strict";var Dfe=lf(),da=De(),H4=Dt(),Nfe="tag:yaml.org,2002:";function jfe(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 Mfe(t,e,r){if(da.isDocument(t)&&(t=t.contents),da.isNode(t))return t;if(da.isPair(t)){let d=r.schema[da.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 Dfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Nfe+e.slice(2));let l=jfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new H4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[da.MAP]:Symbol.iterator in Object(t)?s[da.SEQ]:s[da.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 H4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}G4.createNode=Mfe});var Ry=v(Oy=>{"use strict";var Ffe=uf(),Ti=De(),Lfe=Ay();function QA(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 Ffe.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 Z4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,eT=class extends Lfe.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=>Ti.isNode(n)||Ti.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Z4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Ti.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,QA(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(Ti.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&&Ti.isScalar(o)?o.value:o:Ti.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Ti.isPair(r))return!1;let n=r.value;return n==null||e&&Ti.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 Ti.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(Ti.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,QA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Oy.Collection=eT;Oy.collectionFromPath=QA;Oy.isEmptyPath=Z4});var df=v(Iy=>{"use strict";var zfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function tT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Ufe=(t,e,r)=>t.endsWith(` +`)?tT(r,e):r.includes(` `)?` -`+QA(r,e):(t.endsWith(" ")?"":" ")+r;Oy.indentComment=QA;Oy.lineComment=Cfe;Oy.stringifyComment=Pfe});var q4=v(df=>{"use strict";var Dfe="flow",eT="block",Ry="quoted";function Nfe(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===eT&&(h=U4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Ry&&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===eT&&(h=U4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+tT(r,e):(t.endsWith(" ")?"":" ")+r;Iy.indentComment=tT;Iy.lineComment=Ufe;Iy.stringifyComment=zfe});var W4=v(ff=>{"use strict";var qfe="flow",rT="block",Py="quoted";function Bfe(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===rT&&(h=V4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Py&&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===rT&&(h=V4(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===Ry){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 Wn=Dt(),Wo=q4(),Py=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Cy=t=>/^(%|---|\.\.\.)/m.test(t);function jfe(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 ff(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Cy(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===Py){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 Kn=Dt(),Wo=W4(),Dy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ny=t=>/^(%|---|\.\.\.)/m.test(t);function Hfe(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 pf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Ny(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(rT,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{O=!0});let A=Wo.foldFlowLines(`${_}${w}${p}`,l,Wo.FOLD_BLOCK,T);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,T=Dy(n,!0);s!=="folded"&&e!==Kn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let A=Wo.foldFlowLines(`${_}${w}${p}`,l,Wo.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function Mfe(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 Qc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?Qc(o,e):Iy(t,e,r,n);if(!a&&!u&&i!==Wn.Scalar.PLAIN&&o.includes(` -`))return Iy(t,e,r,n);if(Cy(o)){if(c==="")return e.forceBlockIndent=!0,Iy(t,e,r,n);if(a&&c===l)return Qc(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 Qc(o,e)}return a?d:Wo.foldFlowLines(d,c,Wo.FOLD_FLOW,Py(e,!1))}function Ffe(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!==Wn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Wn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Wn.Scalar.BLOCK_FOLDED:case Wn.Scalar.BLOCK_LITERAL:return i||o?Qc(s.value,e):Iy(s,e,r,n);case Wn.Scalar.QUOTE_DOUBLE:return ff(s.value,e);case Wn.Scalar.QUOTE_SINGLE:return tT(s.value,e);case Wn.Scalar.PLAIN:return Mfe(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}B4.stringifyString=Ffe});var mf=v(nT=>{"use strict";var Lfe=$y(),Ko=De(),zfe=uf(),Ufe=pf();function qfe(t,e){let r=Object.assign({blockQuote:!0,commentString:zfe.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 Bfe(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 Hfe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Ko.isScalar(t)||Ko.isCollection(t))&&t.anchor;o&&Lfe.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 Gfe(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=Bfe(e.doc.schema.tags,o));let s=Hfe(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)?Ufe.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}nT.createStringifyContext=qfe;nT.stringify=Gfe});var V4=v(Z4=>{"use strict";var po=De(),H4=Dt(),G4=mf(),hf=uf();function Zfe({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=po.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(po.isCollection(t)||!po.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||po.isCollection(t)||(po.isScalar(t)?t.type===H4.Scalar.BLOCK_FOLDED||t.type===H4.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=G4.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+=hf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=hf.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=hf.lineComment(g,r.indent,l(f))));let b,_,S;po.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&&po.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&po.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=G4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +${l}${_}${r}${p}`}function Gfe(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 rl(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?rl(o,e):Cy(t,e,r,n);if(!a&&!u&&i!==Kn.Scalar.PLAIN&&o.includes(` +`))return Cy(t,e,r,n);if(Ny(o)){if(c==="")return e.forceBlockIndent=!0,Cy(t,e,r,n);if(a&&c===l)return rl(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 rl(o,e)}return a?d:Wo.foldFlowLines(d,c,Wo.FOLD_FLOW,Dy(e,!1))}function Zfe(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!==Kn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Kn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Kn.Scalar.BLOCK_FOLDED:case Kn.Scalar.BLOCK_LITERAL:return i||o?rl(s.value,e):Cy(s,e,r,n);case Kn.Scalar.QUOTE_DOUBLE:return pf(s.value,e);case Kn.Scalar.QUOTE_SINGLE:return nT(s.value,e);case Kn.Scalar.PLAIN:return Gfe(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}K4.stringifyString=Zfe});var hf=v(oT=>{"use strict";var Vfe=Ey(),Ko=De(),Wfe=df(),Kfe=mf();function Jfe(t,e){let r=Object.assign({blockQuote:!0,commentString:Wfe.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 Yfe(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 Xfe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Ko.isScalar(t)||Ko.isCollection(t))&&t.anchor;o&&Vfe.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 Qfe(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=Yfe(e.doc.schema.tags,o));let s=Xfe(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)?Kfe.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}oT.createStringifyContext=Jfe;oT.stringify=Qfe});var Q4=v(X4=>{"use strict";var mo=De(),J4=Dt(),Y4=hf(),gf=df();function epe({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=mo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(mo.isCollection(t)||!mo.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||mo.isCollection(t)||(mo.isScalar(t)?t.type===J4.Scalar.BLOCK_FOLDED||t.type===J4.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=Y4.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+=gf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=gf.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=gf.lineComment(g,r.indent,l(f))));let b,_,S;mo.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&&mo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&mo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=Y4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let T=l(_);O+=` -${hf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` +${gf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` `):O+=` -${r.indent}`}else if(!p&&po.isCollection(e)){let T=w[0],A=w.indexOf(` -`),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let ie=!1;if(D&&(T==="&"||T==="!")){let K=w.indexOf(" ");T==="&"&&K!==-1&&K{"use strict";var W4=Ge("process");function Vfe(t,...e){t==="debug"&&console.log(...e)}function Wfe(t,e){(t==="debug"||t==="warn")&&(typeof W4.emitWarning=="function"?W4.emitWarning(e):console.warn(e))}iT.debug=Vfe;iT.warn=Wfe});var Fy=v(My=>{"use strict";var jy=De(),K4=Dt(),Dy="<<",Ny={identify:t=>t===Dy||typeof t=="symbol"&&t.description===Dy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new K4.Scalar(Symbol(Dy)),{addToJSMap:J4}),stringify:()=>Dy},Kfe=(t,e)=>(Ny.identify(e)||jy.isScalar(e)&&(!e.type||e.type===K4.Scalar.PLAIN)&&Ny.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Ny.tag&&r.default);function J4(t,e,r){let n=Y4(t,r);if(jy.isSeq(n))for(let i of n.items)sT(t,e,i);else if(Array.isArray(n))for(let i of n)sT(t,e,i);else sT(t,e,n)}function sT(t,e,r){let n=Y4(t,r);if(!jy.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 Y4(t,e){return t&&jy.isAlias(e)?e.resolve(t.doc,t):e}My.addMergeToJSMap=J4;My.isMergeKey=Kfe;My.merge=Ny});var cT=v(e6=>{"use strict";var Jfe=oT(),X4=Fy(),Yfe=mf(),Q4=De(),aT=Zo();function Xfe(t,e,{key:r,value:n}){if(Q4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(X4.isMergeKey(t,r))X4.addMergeToJSMap(t,e,n);else{let i=aT.toJS(r,"",t);if(e instanceof Map)e.set(i,aT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Qfe(r,i,t),s=aT.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 Qfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(Q4.isNode(t)&&r?.doc){let n=Yfe.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)+'..."'),Jfe.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)}e6.addPairToJSMap=Xfe});var Jo=v(lT=>{"use strict";var t6=lf(),epe=V4(),tpe=cT(),Ly=De();function rpe(t,e,r){let n=t6.createNode(t,void 0,r),i=t6.createNode(e,void 0,r);return new zy(n,i)}var zy=class t{constructor(e,r=null){Object.defineProperty(this,Ly.NODE_TYPE,{value:Ly.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Ly.isNode(r)&&(r=r.clone(e)),Ly.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return tpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?epe.stringifyPair(this,e,r,n):JSON.stringify(this)}};lT.Pair=zy;lT.createPair=rpe});var uT=v(n6=>{"use strict";var fa=De(),r6=mf(),Uy=uf();function npe(t,e,r){return(e.inFlow??t.flow?ope:ipe)(t,e,r)}function ipe({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+=Uy.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 e6=Ge("process");function tpe(t,...e){t==="debug"&&console.log(...e)}function rpe(t,e){(t==="debug"||t==="warn")&&(typeof e6.emitWarning=="function"?e6.emitWarning(e):console.warn(e))}sT.debug=tpe;sT.warn=rpe});var zy=v(Ly=>{"use strict";var Fy=De(),t6=Dt(),jy="<<",My={identify:t=>t===jy||typeof t=="symbol"&&t.description===jy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new t6.Scalar(Symbol(jy)),{addToJSMap:r6}),stringify:()=>jy},npe=(t,e)=>(My.identify(e)||Fy.isScalar(e)&&(!e.type||e.type===t6.Scalar.PLAIN)&&My.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===My.tag&&r.default);function r6(t,e,r){let n=n6(t,r);if(Fy.isSeq(n))for(let i of n.items)cT(t,e,i);else if(Array.isArray(n))for(let i of n)cT(t,e,i);else cT(t,e,n)}function cT(t,e,r){let n=n6(t,r);if(!Fy.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 n6(t,e){return t&&Fy.isAlias(e)?e.resolve(t.doc,t):e}Ly.addMergeToJSMap=r6;Ly.isMergeKey=npe;Ly.merge=My});var uT=v(s6=>{"use strict";var ipe=aT(),i6=zy(),ope=hf(),o6=De(),lT=Zo();function spe(t,e,{key:r,value:n}){if(o6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(i6.isMergeKey(t,r))i6.addMergeToJSMap(t,e,n);else{let i=lT.toJS(r,"",t);if(e instanceof Map)e.set(i,lT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=ape(r,i,t),s=lT.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 ape(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(o6.isNode(t)&&r?.doc){let n=ope.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)+'..."'),ipe.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)}s6.addPairToJSMap=spe});var Jo=v(dT=>{"use strict";var a6=uf(),cpe=Q4(),lpe=uT(),Uy=De();function upe(t,e,r){let n=a6.createNode(t,void 0,r),i=a6.createNode(e,void 0,r);return new qy(n,i)}var qy=class t{constructor(e,r=null){Object.defineProperty(this,Uy.NODE_TYPE,{value:Uy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Uy.isNode(r)&&(r=r.clone(e)),Uy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return lpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?cpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};dT.Pair=qy;dT.createPair=upe});var fT=v(l6=>{"use strict";var fa=De(),c6=hf(),By=df();function dpe(t,e,r){return(e.inFlow??t.flow?ppe:fpe)(t,e,r)}function fpe({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+=By.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+=Uy.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?` +`+By.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function ppe({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+=By.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 qy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Uy.indentComment(e(n),t);r.push(o.trimStart())}}n6.stringifyCollection=npe});var Xo=v(fT=>{"use strict";var spe=uT(),ape=cT(),cpe=Ty(),Yo=De(),By=Jo(),lpe=Dt();function gf(t,e){let r=Yo.isScalar(e)?e.value:e;for(let n of t)if(Yo.isPair(n)&&(n.key===e||n.key===r||Yo.isScalar(n.key)&&n.key.value===r))return n}var dT=class extends cpe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Yo.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(By.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;Yo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new By.Pair(e,e?.value):n=new By.Pair(e.key,e.value);let i=gf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Yo.isScalar(i.value)&&lpe.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=gf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=gf(this.items,e)?.value;return(!r&&Yo.isScalar(i)?i.value:i)??void 0}has(e){return!!gf(this.items,e)}set(e,r){this.add(new By.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)ape.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Yo.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})),spe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};fT.YAMLMap=dT;fT.findPair=gf});var el=v(o6=>{"use strict";var upe=De(),i6=Xo(),dpe={collection:"map",default:!0,nodeClass:i6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return upe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>i6.YAMLMap.from(t,e,r)};o6.map=dpe});var Qo=v(s6=>{"use strict";var fpe=lf(),ppe=uT(),mpe=Ty(),Gy=De(),hpe=Dt(),gpe=Zo(),pT=class extends mpe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Gy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Hy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Hy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Gy.isScalar(i)?i.value:i}has(e){let r=Hy(e);return typeof r=="number"&&r=0?e:null}s6.YAMLSeq=pT});var tl=v(c6=>{"use strict";var ype=De(),a6=Qo(),_pe={collection:"seq",default:!0,nodeClass:a6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return ype.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>a6.YAMLSeq.from(t,e,r)};c6.seq=_pe});var yf=v(l6=>{"use strict";var bpe=pf(),vpe={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),bpe.stringifyString(t,e,r,n)}};l6.string=vpe});var Zy=v(f6=>{"use strict";var u6=Dt(),d6={identify:t=>t==null,createNode:()=>new u6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new u6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&d6.test.test(t)?t:e.options.nullStr};f6.nullTag=d6});var mT=v(m6=>{"use strict";var Spe=Dt(),p6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Spe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&p6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};m6.boolTag=p6});var rl=v(h6=>{"use strict";function wpe({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}h6.stringifyNumber=wpe});var gT=v(Vy=>{"use strict";var xpe=Dt(),hT=rl(),$pe={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:hT.stringifyNumber},kpe={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():hT.stringifyNumber(t)}},Epe={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 xpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:hT.stringifyNumber};Vy.float=Epe;Vy.floatExp=kpe;Vy.floatNaN=$pe});var _T=v(Ky=>{"use strict";var g6=rl(),Wy=t=>typeof t=="bigint"||Number.isInteger(t),yT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function y6(t,e,r){let{value:n}=t;return Wy(n)&&n>=0?r+n.toString(e):g6.stringifyNumber(t)}var Ape={identify:t=>Wy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>yT(t,2,8,r),stringify:t=>y6(t,8,"0o")},Tpe={identify:Wy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>yT(t,0,10,r),stringify:g6.stringifyNumber},Ope={identify:t=>Wy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>yT(t,2,16,r),stringify:t=>y6(t,16,"0x")};Ky.int=Tpe;Ky.intHex=Ope;Ky.intOct=Ape});var b6=v(_6=>{"use strict";var Rpe=el(),Ipe=Zy(),Ppe=tl(),Cpe=yf(),Dpe=mT(),bT=gT(),vT=_T(),Npe=[Rpe.map,Ppe.seq,Cpe.string,Ipe.nullTag,Dpe.boolTag,vT.intOct,vT.int,vT.intHex,bT.floatNaN,bT.floatExp,bT.float];_6.schema=Npe});var w6=v(S6=>{"use strict";var jpe=Dt(),Mpe=el(),Fpe=tl();function v6(t){return typeof t=="bigint"||Number.isInteger(t)}var Jy=({value:t})=>JSON.stringify(t),Lpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Jy},{identify:t=>t==null,createNode:()=>new jpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Jy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Jy},{identify:v6,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})=>v6(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:Jy}],zpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Upe=[Mpe.map,Fpe.seq].concat(Lpe,zpe);S6.schema=Upe});var wT=v(x6=>{"use strict";var _f=Ge("buffer"),ST=Dt(),qpe=pf(),Bpe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof _f.Buffer=="function")return _f.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 Yy=De(),xT=Jo(),Hpe=Dt(),Gpe=Qo();function $6(t,e){if(Yy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new xT.Pair(new Hpe.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Hy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=By.indentComment(e(n),t);r.push(o.trimStart())}}l6.stringifyCollection=dpe});var Xo=v(mT=>{"use strict";var mpe=fT(),hpe=uT(),gpe=Ry(),Yo=De(),Gy=Jo(),ype=Dt();function yf(t,e){let r=Yo.isScalar(e)?e.value:e;for(let n of t)if(Yo.isPair(n)&&(n.key===e||n.key===r||Yo.isScalar(n.key)&&n.key.value===r))return n}var pT=class extends gpe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Yo.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(Gy.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;Yo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Gy.Pair(e,e?.value):n=new Gy.Pair(e.key,e.value);let i=yf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Yo.isScalar(i.value)&&ype.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=yf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=yf(this.items,e)?.value;return(!r&&Yo.isScalar(i)?i.value:i)??void 0}has(e){return!!yf(this.items,e)}set(e,r){this.add(new Gy.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)hpe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Yo.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})),mpe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};mT.YAMLMap=pT;mT.findPair=yf});var nl=v(d6=>{"use strict";var _pe=De(),u6=Xo(),bpe={collection:"map",default:!0,nodeClass:u6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return _pe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>u6.YAMLMap.from(t,e,r)};d6.map=bpe});var Qo=v(f6=>{"use strict";var vpe=uf(),Spe=fT(),wpe=Ry(),Vy=De(),xpe=Dt(),$pe=Zo(),hT=class extends wpe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Vy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Zy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Zy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Vy.isScalar(i)?i.value:i}has(e){let r=Zy(e);return typeof r=="number"&&r=0?e:null}f6.YAMLSeq=hT});var il=v(m6=>{"use strict";var kpe=De(),p6=Qo(),Epe={collection:"seq",default:!0,nodeClass:p6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return kpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>p6.YAMLSeq.from(t,e,r)};m6.seq=Epe});var _f=v(h6=>{"use strict";var Ape=mf(),Tpe={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),Ape.stringifyString(t,e,r,n)}};h6.string=Tpe});var Wy=v(_6=>{"use strict";var g6=Dt(),y6={identify:t=>t==null,createNode:()=>new g6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new g6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&y6.test.test(t)?t:e.options.nullStr};_6.nullTag=y6});var gT=v(v6=>{"use strict";var Ope=Dt(),b6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Ope.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&b6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};v6.boolTag=b6});var ol=v(S6=>{"use strict";function Rpe({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}S6.stringifyNumber=Rpe});var _T=v(Ky=>{"use strict";var Ipe=Dt(),yT=ol(),Ppe={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:yT.stringifyNumber},Cpe={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():yT.stringifyNumber(t)}},Dpe={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 Ipe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:yT.stringifyNumber};Ky.float=Dpe;Ky.floatExp=Cpe;Ky.floatNaN=Ppe});var vT=v(Yy=>{"use strict";var w6=ol(),Jy=t=>typeof t=="bigint"||Number.isInteger(t),bT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function x6(t,e,r){let{value:n}=t;return Jy(n)&&n>=0?r+n.toString(e):w6.stringifyNumber(t)}var Npe={identify:t=>Jy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>bT(t,2,8,r),stringify:t=>x6(t,8,"0o")},jpe={identify:Jy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>bT(t,0,10,r),stringify:w6.stringifyNumber},Mpe={identify:t=>Jy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>bT(t,2,16,r),stringify:t=>x6(t,16,"0x")};Yy.int=jpe;Yy.intHex=Mpe;Yy.intOct=Npe});var k6=v($6=>{"use strict";var Fpe=nl(),Lpe=Wy(),zpe=il(),Upe=_f(),qpe=gT(),ST=_T(),wT=vT(),Bpe=[Fpe.map,zpe.seq,Upe.string,Lpe.nullTag,qpe.boolTag,wT.intOct,wT.int,wT.intHex,ST.floatNaN,ST.floatExp,ST.float];$6.schema=Bpe});var T6=v(A6=>{"use strict";var Hpe=Dt(),Gpe=nl(),Zpe=il();function E6(t){return typeof t=="bigint"||Number.isInteger(t)}var Xy=({value:t})=>JSON.stringify(t),Vpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Xy},{identify:t=>t==null,createNode:()=>new Hpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Xy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Xy},{identify:E6,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})=>E6(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:Xy}],Wpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Kpe=[Gpe.map,Zpe.seq].concat(Vpe,Wpe);A6.schema=Kpe});var $T=v(O6=>{"use strict";var bf=Ge("buffer"),xT=Dt(),Jpe=mf(),Ype={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof bf.Buffer=="function")return bf.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 Qy=De(),kT=Jo(),Xpe=Dt(),Qpe=Qo();function R6(t,e){if(Qy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new kT.Pair(new Xpe.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]=Yy.isPair(n)?n:new xT.Pair(n)}}else e("Expected a sequence for this tag");return t}function k6(t,e,r){let{replacer:n}=r,i=new Gpe.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(xT.createPair(a,c,r))}return i}var Zpe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:$6,createNode:k6};Xy.createPairs=k6;Xy.pairs=Zpe;Xy.resolvePairs=$6});var ET=v(kT=>{"use strict";var E6=De(),$T=Zo(),bf=Xo(),Vpe=Qo(),A6=Qy(),pa=class t extends Vpe.YAMLSeq{constructor(){super(),this.add=bf.YAMLMap.prototype.add.bind(this),this.delete=bf.YAMLMap.prototype.delete.bind(this),this.get=bf.YAMLMap.prototype.get.bind(this),this.has=bf.YAMLMap.prototype.has.bind(this),this.set=bf.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(E6.isPair(i)?(o=$T.toJS(i.key,"",r),s=$T.toJS(i.value,o,r)):o=$T.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=A6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};pa.tag="tag:yaml.org,2002:omap";var Wpe={collection:"seq",identify:t=>t instanceof Map,nodeClass:pa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=A6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)E6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new pa,r)},createNode:(t,e,r)=>pa.from(t,e,r)};kT.YAMLOMap=pa;kT.omap=Wpe});var P6=v(AT=>{"use strict";var T6=Dt();function O6({value:t,source:e},r){return e&&(t?R6:I6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var R6={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 T6.Scalar(!0),stringify:O6},I6={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 T6.Scalar(!1),stringify:O6};AT.falseTag=I6;AT.trueTag=R6});var C6=v(e_=>{"use strict";var Kpe=Dt(),TT=rl(),Jpe={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:TT.stringifyNumber},Ype={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():TT.stringifyNumber(t)}},Xpe={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 Kpe.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:TT.stringifyNumber};e_.float=Xpe;e_.floatExp=Ype;e_.floatNaN=Jpe});var N6=v(Sf=>{"use strict";var D6=rl(),vf=t=>typeof t=="bigint"||Number.isInteger(t);function t_(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 OT(t,e,r){let{value:n}=t;if(vf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return D6.stringifyNumber(t)}var Qpe={identify:vf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>t_(t,2,2,r),stringify:t=>OT(t,2,"0b")},eme={identify:vf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>t_(t,1,8,r),stringify:t=>OT(t,8,"0")},tme={identify:vf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>t_(t,0,10,r),stringify:D6.stringifyNumber},rme={identify:vf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>t_(t,2,16,r),stringify:t=>OT(t,16,"0x")};Sf.int=tme;Sf.intBin=Qpe;Sf.intHex=rme;Sf.intOct=eme});var IT=v(RT=>{"use strict";var i_=De(),r_=Jo(),n_=Xo(),ma=class t extends n_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;i_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new r_.Pair(e.key,null):r=new r_.Pair(e,null),n_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=n_.findPair(this.items,e);return!r&&i_.isPair(n)?i_.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=n_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new r_.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(r_.createPair(s,null,n));return o}};ma.tag="tag:yaml.org,2002:set";var nme={collection:"map",identify:t=>t instanceof Set,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ma.from(t,e,r),resolve(t,e){if(i_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ma,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};RT.YAMLSet=ma;RT.set=nme});var CT=v(o_=>{"use strict";var ime=rl();function PT(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 j6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return ime.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 ome={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})=>PT(t,r),stringify:j6},sme={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=>PT(t,!1),stringify:j6},M6={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(M6.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=PT(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$/,"")??""};o_.floatTime=sme;o_.intTime=ome;o_.timestamp=M6});var z6=v(L6=>{"use strict";var ame=el(),cme=Zy(),lme=tl(),ume=yf(),dme=wT(),F6=P6(),DT=C6(),s_=N6(),fme=Fy(),pme=ET(),mme=Qy(),hme=IT(),NT=CT(),gme=[ame.map,lme.seq,ume.string,cme.nullTag,F6.trueTag,F6.falseTag,s_.intBin,s_.intOct,s_.int,s_.intHex,DT.floatNaN,DT.floatExp,DT.float,dme.binary,fme.merge,pme.omap,mme.pairs,hme.set,NT.intTime,NT.floatTime,NT.timestamp];L6.schema=gme});var J6=v(FT=>{"use strict";var H6=el(),yme=Zy(),G6=tl(),_me=yf(),bme=mT(),jT=gT(),MT=_T(),vme=b6(),Sme=w6(),Z6=wT(),wf=Fy(),V6=ET(),W6=Qy(),U6=z6(),K6=IT(),a_=CT(),q6=new Map([["core",vme.schema],["failsafe",[H6.map,G6.seq,_me.string]],["json",Sme.schema],["yaml11",U6.schema],["yaml-1.1",U6.schema]]),B6={binary:Z6.binary,bool:bme.boolTag,float:jT.float,floatExp:jT.floatExp,floatNaN:jT.floatNaN,floatTime:a_.floatTime,int:MT.int,intHex:MT.intHex,intOct:MT.intOct,intTime:a_.intTime,map:H6.map,merge:wf.merge,null:yme.nullTag,omap:V6.omap,pairs:W6.pairs,seq:G6.seq,set:K6.set,timestamp:a_.timestamp},wme={"tag:yaml.org,2002:binary":Z6.binary,"tag:yaml.org,2002:merge":wf.merge,"tag:yaml.org,2002:omap":V6.omap,"tag:yaml.org,2002:pairs":W6.pairs,"tag:yaml.org,2002:set":K6.set,"tag:yaml.org,2002:timestamp":a_.timestamp};function xme(t,e,r){let n=q6.get(e);if(n&&!t)return r&&!n.includes(wf.merge)?n.concat(wf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(q6.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(wf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?B6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(B6).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},[])}FT.coreKnownTags=wme;FT.getTags=xme});var UT=v(Y6=>{"use strict";var LT=De(),$me=el(),kme=tl(),Eme=yf(),c_=J6(),Ame=(t,e)=>t.keye.key?1:0,zT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?c_.getTags(e,"compat"):e?c_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?c_.coreKnownTags:{},this.tags=c_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,LT.MAP,{value:$me.map}),Object.defineProperty(this,LT.SCALAR,{value:Eme.string}),Object.defineProperty(this,LT.SEQ,{value:kme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Ame:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Y6.Schema=zT});var Q6=v(X6=>{"use strict";var Tme=De(),qT=mf(),xf=uf();function Ome(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=qT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(xf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Tme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(xf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=qT.stringify(t.contents,i,()=>a=null,c);a&&(l+=xf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(qT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(xf.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(xf.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=Qy.isPair(n)?n:new kT.Pair(n)}}else e("Expected a sequence for this tag");return t}function I6(t,e,r){let{replacer:n}=r,i=new Qpe.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(kT.createPair(a,c,r))}return i}var eme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:R6,createNode:I6};e_.createPairs=I6;e_.pairs=eme;e_.resolvePairs=R6});var TT=v(AT=>{"use strict";var P6=De(),ET=Zo(),vf=Xo(),tme=Qo(),C6=t_(),pa=class t extends tme.YAMLSeq{constructor(){super(),this.add=vf.YAMLMap.prototype.add.bind(this),this.delete=vf.YAMLMap.prototype.delete.bind(this),this.get=vf.YAMLMap.prototype.get.bind(this),this.has=vf.YAMLMap.prototype.has.bind(this),this.set=vf.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(P6.isPair(i)?(o=ET.toJS(i.key,"",r),s=ET.toJS(i.value,o,r)):o=ET.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=C6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};pa.tag="tag:yaml.org,2002:omap";var rme={collection:"seq",identify:t=>t instanceof Map,nodeClass:pa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=C6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)P6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new pa,r)},createNode:(t,e,r)=>pa.from(t,e,r)};AT.YAMLOMap=pa;AT.omap=rme});var F6=v(OT=>{"use strict";var D6=Dt();function N6({value:t,source:e},r){return e&&(t?j6:M6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var j6={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 D6.Scalar(!0),stringify:N6},M6={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 D6.Scalar(!1),stringify:N6};OT.falseTag=M6;OT.trueTag=j6});var L6=v(r_=>{"use strict";var nme=Dt(),RT=ol(),ime={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:RT.stringifyNumber},ome={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():RT.stringifyNumber(t)}},sme={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 nme.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:RT.stringifyNumber};r_.float=sme;r_.floatExp=ome;r_.floatNaN=ime});var U6=v(wf=>{"use strict";var z6=ol(),Sf=t=>typeof t=="bigint"||Number.isInteger(t);function n_(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 IT(t,e,r){let{value:n}=t;if(Sf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return z6.stringifyNumber(t)}var ame={identify:Sf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>n_(t,2,2,r),stringify:t=>IT(t,2,"0b")},cme={identify:Sf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>n_(t,1,8,r),stringify:t=>IT(t,8,"0")},lme={identify:Sf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>n_(t,0,10,r),stringify:z6.stringifyNumber},ume={identify:Sf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>n_(t,2,16,r),stringify:t=>IT(t,16,"0x")};wf.int=lme;wf.intBin=ame;wf.intHex=ume;wf.intOct=cme});var CT=v(PT=>{"use strict";var s_=De(),i_=Jo(),o_=Xo(),ma=class t extends o_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;s_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new i_.Pair(e.key,null):r=new i_.Pair(e,null),o_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=o_.findPair(this.items,e);return!r&&s_.isPair(n)?s_.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=o_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new i_.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(i_.createPair(s,null,n));return o}};ma.tag="tag:yaml.org,2002:set";var dme={collection:"map",identify:t=>t instanceof Set,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ma.from(t,e,r),resolve(t,e){if(s_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ma,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};PT.YAMLSet=ma;PT.set=dme});var NT=v(a_=>{"use strict";var fme=ol();function DT(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 q6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return fme.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 pme={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})=>DT(t,r),stringify:q6},mme={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=>DT(t,!1),stringify:q6},B6={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(B6.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=DT(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$/,"")??""};a_.floatTime=mme;a_.intTime=pme;a_.timestamp=B6});var Z6=v(G6=>{"use strict";var hme=nl(),gme=Wy(),yme=il(),_me=_f(),bme=$T(),H6=F6(),jT=L6(),c_=U6(),vme=zy(),Sme=TT(),wme=t_(),xme=CT(),MT=NT(),$me=[hme.map,yme.seq,_me.string,gme.nullTag,H6.trueTag,H6.falseTag,c_.intBin,c_.intOct,c_.int,c_.intHex,jT.floatNaN,jT.floatExp,jT.float,bme.binary,vme.merge,Sme.omap,wme.pairs,xme.set,MT.intTime,MT.floatTime,MT.timestamp];G6.schema=$me});var rB=v(zT=>{"use strict";var J6=nl(),kme=Wy(),Y6=il(),Eme=_f(),Ame=gT(),FT=_T(),LT=vT(),Tme=k6(),Ome=T6(),X6=$T(),xf=zy(),Q6=TT(),eB=t_(),V6=Z6(),tB=CT(),l_=NT(),W6=new Map([["core",Tme.schema],["failsafe",[J6.map,Y6.seq,Eme.string]],["json",Ome.schema],["yaml11",V6.schema],["yaml-1.1",V6.schema]]),K6={binary:X6.binary,bool:Ame.boolTag,float:FT.float,floatExp:FT.floatExp,floatNaN:FT.floatNaN,floatTime:l_.floatTime,int:LT.int,intHex:LT.intHex,intOct:LT.intOct,intTime:l_.intTime,map:J6.map,merge:xf.merge,null:kme.nullTag,omap:Q6.omap,pairs:eB.pairs,seq:Y6.seq,set:tB.set,timestamp:l_.timestamp},Rme={"tag:yaml.org,2002:binary":X6.binary,"tag:yaml.org,2002:merge":xf.merge,"tag:yaml.org,2002:omap":Q6.omap,"tag:yaml.org,2002:pairs":eB.pairs,"tag:yaml.org,2002:set":tB.set,"tag:yaml.org,2002:timestamp":l_.timestamp};function Ime(t,e,r){let n=W6.get(e);if(n&&!t)return r&&!n.includes(xf.merge)?n.concat(xf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(W6.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(xf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?K6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(K6).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},[])}zT.coreKnownTags=Rme;zT.getTags=Ime});var BT=v(nB=>{"use strict";var UT=De(),Pme=nl(),Cme=il(),Dme=_f(),u_=rB(),Nme=(t,e)=>t.keye.key?1:0,qT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?u_.getTags(e,"compat"):e?u_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?u_.coreKnownTags:{},this.tags=u_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,UT.MAP,{value:Pme.map}),Object.defineProperty(this,UT.SCALAR,{value:Dme.string}),Object.defineProperty(this,UT.SEQ,{value:Cme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Nme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};nB.Schema=qT});var oB=v(iB=>{"use strict";var jme=De(),HT=hf(),$f=df();function Mme(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=HT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift($f.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(jme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push($f.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=HT.stringify(t.contents,i,()=>a=null,c);a&&(l+=$f.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(HT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push($f.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($f.indentComment(o(c),"")))}return r.join(` `)+` -`}X6.stringifyDocument=Ome});var $f=v(eB=>{"use strict";var Rme=cf(),nl=Ty(),kn=De(),Ime=Jo(),Pme=Zo(),Cme=UT(),Dme=Q6(),BT=$y(),Nme=VA(),jme=lf(),HT=ZA(),GT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,kn.NODE_TYPE,{value:kn.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 HT.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,{[kn.NODE_TYPE]:{value:kn.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=kn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){il(this.contents)&&this.contents.add(e)}addIn(e,r){il(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=BT.anchorNames(this);e.anchor=!r||n.has(r)?BT.findNewAnchor(r||"a",n):r}return new Rme.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}=BT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=jme.createNode(e,u,m);return a&&kn.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 Ime.Pair(i,o)}delete(e){return il(this.contents)?this.contents.delete(e):!1}deleteIn(e){return nl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):il(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return kn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return nl.isEmptyPath(e)?!r&&kn.isScalar(this.contents)?this.contents.value:this.contents:kn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return kn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return nl.isEmptyPath(e)?this.contents!==void 0:kn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=nl.collectionFromPath(this.schema,[e],r):il(this.contents)&&this.contents.set(e,r)}setIn(e,r){nl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=nl.collectionFromPath(this.schema,Array.from(e),r):il(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 HT.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 HT.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 Cme.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=Pme.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"?Nme.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 Dme.stringifyDocument(this,e)}};function il(t){if(kn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}eB.Document=GT});var Af=v(Ef=>{"use strict";var kf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},ZT=class extends kf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},VT=class extends kf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Mme=(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 +`}iB.stringifyDocument=Mme});var kf=v(sB=>{"use strict";var Fme=lf(),sl=Ry(),En=De(),Lme=Jo(),zme=Zo(),Ume=BT(),qme=oB(),GT=Ey(),Bme=KA(),Hme=uf(),ZT=WA(),VT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,En.NODE_TYPE,{value:En.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 ZT.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,{[En.NODE_TYPE]:{value:En.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=En.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){al(this.contents)&&this.contents.add(e)}addIn(e,r){al(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=GT.anchorNames(this);e.anchor=!r||n.has(r)?GT.findNewAnchor(r||"a",n):r}return new Fme.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}=GT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Hme.createNode(e,u,m);return a&&En.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 Lme.Pair(i,o)}delete(e){return al(this.contents)?this.contents.delete(e):!1}deleteIn(e){return sl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):al(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return En.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return sl.isEmptyPath(e)?!r&&En.isScalar(this.contents)?this.contents.value:this.contents:En.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return En.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return sl.isEmptyPath(e)?this.contents!==void 0:En.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=sl.collectionFromPath(this.schema,[e],r):al(this.contents)&&this.contents.set(e,r)}setIn(e,r){sl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=sl.collectionFromPath(this.schema,Array.from(e),r):al(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 ZT.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 ZT.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 Ume.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=zme.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"?Bme.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 qme.stringifyDocument(this,e)}};function al(t){if(En.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}sB.Document=VT});var Tf=v(Af=>{"use strict";var Ef=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},WT=class extends Ef{constructor(e,r,n){super("YAMLParseError",e,r,n)}},KT=class extends Ef{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Gme=(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} -`}};Ef.YAMLError=kf;Ef.YAMLParseError=ZT;Ef.YAMLWarning=VT;Ef.prettifyError=Mme});var Tf=v(tB=>{"use strict";function Fme(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 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 D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||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`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}tB.resolveProps=Fme});var l_=v(rB=>{"use strict";function WT(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(WT(e.key)||WT(e.value))return!0}return!1;default:return!0}}rB.containsNewline=WT});var KT=v(nB=>{"use strict";var Lme=l_();function zme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Lme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}nB.flowIndentCheck=zme});var JT=v(oB=>{"use strict";var iB=De();function Ume(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||iB.isScalar(o)&&iB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}oB.mapIncludes=Ume});var dB=v(uB=>{"use strict";var sB=Jo(),qme=Xo(),aB=Tf(),Bme=l_(),cB=KT(),Hme=JT(),lB="All mapping items must start at the same column";function Gme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??qme.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=aB.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",lB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Bme.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",lB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&cB.flowIndentCheck(n.indent,f,i),r.atKey=!1,Hme.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=aB.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 Zme=Qo(),Vme=Tf(),Wme=KT();function Kme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Zme.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=Vme.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&&Wme.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}fB.resolveBlockSeq=Kme});var ol=v(mB=>{"use strict";function Jme(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}}mB.resolveEnd=Jme});var _B=v(yB=>{"use strict";var Yme=De(),Xme=Jo(),hB=Xo(),Qme=Qo(),ehe=ol(),gB=Tf(),the=l_(),rhe=JT(),YT="Block collections are not allowed within flow collections",XT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function nhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?hB.YAMLMap:Qme.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=ehe.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}yB.resolveFlowCollection=nhe});var vB=v(bB=>{"use strict";var ihe=De(),ohe=Dt(),she=Xo(),ahe=Qo(),che=dB(),lhe=pB(),uhe=_B();function QT(t,e,r,n,i,o){let s=r.type==="block-map"?che.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?lhe.resolveBlockSeq(t,e,r,n,o):uhe.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 dhe(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),QT(t,e,r,i,s)}let l=QT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=ihe.isNode(u)?u:new ohe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}bB.composeCollection=dhe});var tO=v(SB=>{"use strict";var eO=Dt();function fhe(t,e,r){let n=e.offset,i=phe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?eO.Scalar.BLOCK_FOLDED:eO.Scalar.BLOCK_LITERAL,s=e.source?mhe(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?` +`}};Af.YAMLError=Ef;Af.YAMLParseError=WT;Af.YAMLWarning=KT;Af.prettifyError=Gme});var Of=v(aB=>{"use strict";function Zme(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 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 D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||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`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}aB.resolveProps=Zme});var d_=v(cB=>{"use strict";function JT(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(JT(e.key)||JT(e.value))return!0}return!1;default:return!0}}cB.containsNewline=JT});var YT=v(lB=>{"use strict";var Vme=d_();function Wme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Vme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}lB.flowIndentCheck=Wme});var XT=v(dB=>{"use strict";var uB=De();function Kme(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||uB.isScalar(o)&&uB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}dB.mapIncludes=Kme});var yB=v(gB=>{"use strict";var fB=Jo(),Jme=Xo(),pB=Of(),Yme=d_(),mB=YT(),Xme=XT(),hB="All mapping items must start at the same column";function Qme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Jme.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=pB.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",hB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Yme.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",hB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&mB.flowIndentCheck(n.indent,f,i),r.atKey=!1,Xme.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=pB.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 ehe=Qo(),the=Of(),rhe=YT();function nhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??ehe.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=the.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&&rhe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}_B.resolveBlockSeq=nhe});var cl=v(vB=>{"use strict";function ihe(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}}vB.resolveEnd=ihe});var $B=v(xB=>{"use strict";var ohe=De(),she=Jo(),SB=Xo(),ahe=Qo(),che=cl(),wB=Of(),lhe=d_(),uhe=XT(),QT="Block collections are not allowed within flow collections",eO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function dhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?SB.YAMLMap:ahe.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=che.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}xB.resolveFlowCollection=dhe});var EB=v(kB=>{"use strict";var fhe=De(),phe=Dt(),mhe=Xo(),hhe=Qo(),ghe=yB(),yhe=bB(),_he=$B();function tO(t,e,r,n,i,o){let s=r.type==="block-map"?ghe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?yhe.resolveBlockSeq(t,e,r,n,o):_he.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 bhe(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),tO(t,e,r,i,s)}let l=tO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=fhe.isNode(u)?u:new phe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}kB.composeCollection=bhe});var nO=v(AB=>{"use strict";var rO=Dt();function vhe(t,e,r){let n=e.offset,i=She(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?rO.Scalar.BLOCK_FOLDED:rO.Scalar.BLOCK_LITERAL,s=e.source?whe(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,91 +112,91 @@ ${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 phe({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 rO=Dt(),hhe=ol();function ghe(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=rO.Scalar.PLAIN,c=yhe(o,l);break;case"single-quoted-scalar":a=rO.Scalar.QUOTE_SINGLE,c=_he(o,l);break;case"double-quoted-scalar":a=rO.Scalar.QUOTE_DOUBLE,c=bhe(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=hhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function yhe(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}`),wB(t)}function _he(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),wB(t.slice(1,-1)).replace(/''/g,"'")}function wB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var iO=Dt(),xhe=cl();function $he(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=iO.Scalar.PLAIN,c=khe(o,l);break;case"single-quoted-scalar":a=iO.Scalar.QUOTE_SINGLE,c=Ehe(o,l);break;case"double-quoted-scalar":a=iO.Scalar.QUOTE_DOUBLE,c=Ahe(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=xhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function khe(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}`),TB(t)}function Ehe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),TB(t.slice(1,-1)).replace(/''/g,"'")}function TB(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 vhe(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 The(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 She={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function whe(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}}xB.resolveFlowScalar=ghe});var EB=v(kB=>{"use strict";var ha=De(),$B=Dt(),xhe=tO(),$he=nO();function khe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?xhe.resolveBlockScalar(t,e,n):$he.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[ha.SCALAR]:c?l=Ehe(t.schema,i,c,r,n):e.type==="scalar"?l=Ahe(t,i,e,n):l=t.schema[ha.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ha.isScalar(d)?d:new $B.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new $B.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 Ehe(t,e,r,n,i){if(r==="!")return t[ha.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[ha.SCALAR])}function Ahe({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[ha.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ha.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}kB.composeScalar=khe});var TB=v(AB=>{"use strict";function The(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}AB.emptyScalarPosition=The});var IB=v(oO=>{"use strict";var Ohe=cf(),Rhe=De(),Ihe=vB(),OB=EB(),Phe=ol(),Che=TB(),Dhe={composeNode:RB,composeEmptyNode:iO};function RB(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=Nhe(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=OB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Ihe.composeCollection(Dhe,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=iO(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&&(!Rhe.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 iO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Che.emptyScalarPosition(e,r,n),indent:-1,source:""},d=OB.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 Nhe({options:t},{offset:e,source:r,end:n},i){let o=new Ohe.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=Phe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}oO.composeEmptyNode=iO;oO.composeNode=RB});var DB=v(CB=>{"use strict";var jhe=$f(),PB=IB(),Mhe=ol(),Fhe=Tf();function Lhe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new jhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Fhe.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?PB.composeNode(l,i,u,s):PB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Mhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}CB.composeDoc=Lhe});var aO=v(MB=>{"use strict";var zhe=Ge("process"),Uhe=ZA(),qhe=$f(),Of=Af(),NB=De(),Bhe=DB(),Hhe=ol();function Rf(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 jB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ha=De(),RB=Dt(),Ihe=nO(),Phe=oO();function Che(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Ihe.resolveBlockScalar(t,e,n):Phe.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[ha.SCALAR]:c?l=Dhe(t.schema,i,c,r,n):e.type==="scalar"?l=Nhe(t,i,e,n):l=t.schema[ha.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ha.isScalar(d)?d:new RB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new RB.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 Dhe(t,e,r,n,i){if(r==="!")return t[ha.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[ha.SCALAR])}function Nhe({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[ha.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ha.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}IB.composeScalar=Che});var DB=v(CB=>{"use strict";function jhe(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}CB.emptyScalarPosition=jhe});var MB=v(aO=>{"use strict";var Mhe=lf(),Fhe=De(),Lhe=EB(),NB=PB(),zhe=cl(),Uhe=DB(),qhe={composeNode:jB,composeEmptyNode:sO};function jB(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=Bhe(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=NB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Lhe.composeCollection(qhe,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=sO(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&&(!Fhe.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 sO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Uhe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=NB.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 Bhe({options:t},{offset:e,source:r,end:n},i){let o=new Mhe.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=zhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}aO.composeEmptyNode=sO;aO.composeNode=jB});var zB=v(LB=>{"use strict";var Hhe=kf(),FB=MB(),Ghe=cl(),Zhe=Of();function Vhe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Hhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Zhe.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?FB.composeNode(l,i,u,s):FB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Ghe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}LB.composeDoc=Vhe});var lO=v(BB=>{"use strict";var Whe=Ge("process"),Khe=WA(),Jhe=kf(),Rf=Tf(),UB=De(),Yhe=zB(),Xhe=cl();function If(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 qB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=Rf(r);o?this.warnings.push(new Of.YAMLWarning(s,n,i)):this.errors.push(new Of.YAMLParseError(s,n,i))},this.directives=new Uhe.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=jB(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(NB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];NB.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 cO=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=If(r);o?this.warnings.push(new Rf.YAMLWarning(s,n,i)):this.errors.push(new Rf.YAMLParseError(s,n,i))},this.directives=new Khe.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=qB(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(UB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];UB.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=Rf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Bhe.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 Of.YAMLParseError(Rf(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 Of.YAMLParseError(Rf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Hhe.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 Of.YAMLParseError(Rf(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 qhe.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}}};MB.Composer=sO});var zB=v(u_=>{"use strict";var Ghe=tO(),Zhe=nO(),Vhe=Af(),FB=pf();function Whe(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 Vhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Zhe.resolveFlowScalar(t,e,n);case"block-scalar":return Ghe.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Khe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=FB.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=If(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Yhe.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 Rf.YAMLParseError(If(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 Rf.YAMLParseError(If(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Xhe.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 Rf.YAMLParseError(If(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 Jhe.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}}};BB.Composer=cO});var ZB=v(f_=>{"use strict";var Qhe=nO(),ege=oO(),tge=Tf(),HB=mf();function rge(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 tge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return ege.resolveFlowScalar(t,e,n);case"block-scalar":return Qhe.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function nge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=HB.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 LB(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 Jhe(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=FB.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">":Yhe(t,c);break;case'"':cO(t,c,"double-quoted-scalar");break;case"'":cO(t,c,"single-quoted-scalar");break;default:cO(t,c,"scalar")}}function Yhe(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return GB(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 ige(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=HB.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">":oge(t,c);break;case'"':uO(t,c,"double-quoted-scalar");break;case"'":uO(t,c,"single-quoted-scalar");break;default:uO(t,c,"scalar")}}function oge(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}];LB(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 LB(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 cO(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})}}}u_.createScalarToken=Khe;u_.resolveAsScalar=Whe;u_.setScalarValue=Jhe});var qB=v(UB=>{"use strict";var Xhe=t=>"type"in t?f_(t):d_(t);function f_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=f_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=d_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=d_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=d_(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 d_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=f_(e)),r)for(let o of r)i+=o.source;return n&&(i+=f_(n)),i}UB.stringify=Xhe});var ZB=v(GB=>{"use strict";var lO=Symbol("break visit"),Qhe=Symbol("skip children"),BB=Symbol("remove item");function ga(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),HB(Object.freeze([]),t,e)}ga.BREAK=lO;ga.SKIP=Qhe;ga.REMOVE=BB;ga.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};ga.parentCollection=(t,e)=>{let r=ga.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 HB(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 uO=zB(),ege=qB(),tge=ZB(),dO="\uFEFF",fO="",pO="",mO="",rge=t=>!!t&&"items"in t,nge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function ige(t){switch(t){case dO:return"";case fO:return"";case pO:return"";case mO:return"";default:return JSON.stringify(t)}}function oge(t){switch(t){case dO:return"byte-order-mark";case fO:return"doc-mode";case pO:return"flow-error-end";case mO: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}];GB(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 GB(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 uO(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})}}}f_.createScalarToken=nge;f_.resolveAsScalar=rge;f_.setScalarValue=ige});var WB=v(VB=>{"use strict";var sge=t=>"type"in t?m_(t):p_(t);function m_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=m_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=p_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=p_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=p_(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 p_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=m_(e)),r)for(let o of r)i+=o.source;return n&&(i+=m_(n)),i}VB.stringify=sge});var XB=v(YB=>{"use strict";var dO=Symbol("break visit"),age=Symbol("skip children"),KB=Symbol("remove item");function ga(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),JB(Object.freeze([]),t,e)}ga.BREAK=dO;ga.SKIP=age;ga.REMOVE=KB;ga.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};ga.parentCollection=(t,e)=>{let r=ga.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 JB(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 fO=ZB(),cge=WB(),lge=XB(),pO="\uFEFF",mO="",hO="",gO="",uge=t=>!!t&&"items"in t,dge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function fge(t){switch(t){case pO:return"";case mO:return"";case hO:return"";case gO:return"";default:return JSON.stringify(t)}}function pge(t){switch(t){case pO:return"byte-order-mark";case mO:return"doc-mode";case hO:return"flow-error-end";case gO: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}Dr.createScalarToken=uO.createScalarToken;Dr.resolveAsScalar=uO.resolveAsScalar;Dr.setScalarValue=uO.setScalarValue;Dr.stringify=ege.stringify;Dr.visit=tge.visit;Dr.BOM=dO;Dr.DOCUMENT=fO;Dr.FLOW_END=pO;Dr.SCALAR=mO;Dr.isCollection=rge;Dr.isScalar=nge;Dr.prettyToken=ige;Dr.tokenType=oge});var yO=v(WB=>{"use strict";var If=p_();function Kn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var VB=new Set("0123456789ABCDEFabcdef"),sge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),m_=new Set(",[]{}"),age=new Set(` ,[]{} -\r `),hO=t=>!t||age.has(t),gO=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}Dr.createScalarToken=fO.createScalarToken;Dr.resolveAsScalar=fO.resolveAsScalar;Dr.setScalarValue=fO.setScalarValue;Dr.stringify=cge.stringify;Dr.visit=lge.visit;Dr.BOM=pO;Dr.DOCUMENT=mO;Dr.FLOW_END=hO;Dr.SCALAR=gO;Dr.isCollection=uge;Dr.isScalar=dge;Dr.prettyToken=fge;Dr.tokenType=pge});var bO=v(eH=>{"use strict";var Pf=h_();function Jn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var QB=new Set("0123456789ABCDEFabcdef"),mge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),g_=new Set(",[]{}"),hge=new Set(` ,[]{} +\r `),yO=t=>!t||hge.has(t),_O=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==="...")&&Kn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Kn(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===":")&&Kn(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(hO),"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==="...")&&Jn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Jn(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===":")&&Jn(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(yO),"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=>Kn(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=>Jn(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 If.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(Kn(o)||e&&m_.has(o))break;r=n}else if(Kn(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 Pf.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(Jn(o)||e&&g_.has(o))break;r=n}else if(Jn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&m_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&m_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield If.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(hO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Kn(n)||r&&m_.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(;!Kn(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(sge.has(r))r=this.buffer[++e];else if(r==="%"&&VB.has(this.buffer[e+1])&&VB.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&&g_.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&g_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Pf.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(yO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Jn(n)||r&&g_.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(;!Jn(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(mge.has(r))r=this.buffer[++e];else if(r==="%"&&QB.has(this.buffer[e+1])&&QB.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)}};WB.Lexer=gO});var bO=v(KB=>{"use strict";var _O=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 cge=Ge("process"),JB=p_(),lge=yO();function es(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 g_(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"&&XB(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&&YB(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)}};eH.Lexer=_O});var SO=v(tH=>{"use strict";var vO=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 gge=Ge("process"),rH=h_(),yge=bO();function es(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 __(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"&&iH(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&&nH(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(es(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(QB(r.key)&&!es(r.sep,"newline")){let s=sl(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(es(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=sl(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]}):es(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&&!es(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)){g_(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||es(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=h_(n),o=sl(i);XB(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)){__(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(es(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(oH(r.key)&&!es(r.sep,"newline")){let s=ll(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(es(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=ll(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]}):es(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&&!es(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)){__(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||es(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=y_(n),o=ll(i);iH(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=h_(e),n=sl(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=h_(e),n=sl(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())}}};eH.Parser=vO});var oH=v(Cf=>{"use strict";var tH=aO(),uge=$f(),Pf=Af(),dge=oT(),fge=De(),pge=bO(),rH=SO();function nH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new pge.LineCounter||null,prettyErrors:e}}function mge(t,e={}){let{lineCounter:r,prettyErrors:n}=nH(e),i=new rH.Parser(r?.addNewLine),o=new tH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Pf.prettifyError(t,r)),a.warnings.forEach(Pf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function iH(t,e={}){let{lineCounter:r,prettyErrors:n}=nH(e),i=new rH.Parser(r?.addNewLine),o=new tH.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 Pf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Pf.prettifyError(t,r)),s.warnings.forEach(Pf.prettifyError(t,r))),s}function hge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=iH(t,r);if(!i)return null;if(i.warnings.forEach(o=>dge.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 gge(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 fge.isDocument(t)&&!n?t.toString(r):new uge.Document(t,n,r).toString(r)}Cf.parse=hge;Cf.parseAllDocuments=mge;Cf.parseDocument=iH;Cf.stringify=gge});var Qt=v(Ze=>{"use strict";var yge=aO(),_ge=$f(),bge=UT(),wO=Af(),vge=cf(),ts=De(),Sge=Jo(),wge=Dt(),xge=Xo(),$ge=Qo(),kge=p_(),Ege=yO(),Age=bO(),Tge=SO(),y_=oH(),sH=nf();Ze.Composer=yge.Composer;Ze.Document=_ge.Document;Ze.Schema=bge.Schema;Ze.YAMLError=wO.YAMLError;Ze.YAMLParseError=wO.YAMLParseError;Ze.YAMLWarning=wO.YAMLWarning;Ze.Alias=vge.Alias;Ze.isAlias=ts.isAlias;Ze.isCollection=ts.isCollection;Ze.isDocument=ts.isDocument;Ze.isMap=ts.isMap;Ze.isNode=ts.isNode;Ze.isPair=ts.isPair;Ze.isScalar=ts.isScalar;Ze.isSeq=ts.isSeq;Ze.Pair=Sge.Pair;Ze.Scalar=wge.Scalar;Ze.YAMLMap=xge.YAMLMap;Ze.YAMLSeq=$ge.YAMLSeq;Ze.CST=kge;Ze.Lexer=Ege.Lexer;Ze.LineCounter=Age.LineCounter;Ze.Parser=Tge.Parser;Ze.parse=y_.parse;Ze.parseAllDocuments=y_.parseAllDocuments;Ze.parseDocument=y_.parseDocument;Ze.stringify=y_.stringify;Ze.visit=sH.visit;Ze.visitAsync=sH.visitAsync});import{execFileSync as aH}from"node:child_process";import{existsSync as __}from"node:fs";import{join as b_,resolve as Oge}from"node:path";function Rge(t){try{let e=aH("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Oge(t,e):null}catch{return null}}function xO(t){let e=Rge(t);if(!e)return null;try{if(__(b_(e,"MERGE_HEAD")))return"merge";if(__(b_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(__(b_(e,"rebase-merge"))||__(b_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ya(t){return xO(t)!==null}function $O(t,e){try{let r=aH("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function v_(t,e){return $O(t,e)!==null}var _a=y(()=>{"use strict"});import{execFileSync as Ige}from"node:child_process";import{existsSync as Pge,readFileSync as Cge}from"node:fs";import{join as uH}from"node:path";function Df(t,e){return Ige("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function rs(t){try{let e=Df(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 ns(t,e){Dge(t,e);let r=Df(t,["rev-parse","HEAD"]).trim(),n=Nge(t,e);return{groups:jge(t,n),head:r,inventory:{after:lH(w_(t,"spec.yaml")),before:lH(kO(t,e,"spec.yaml"))},since:e,unsharded_commits:zge(t,e)}}function EO(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 Dge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!v_(t,r))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 Nge(t,e){let r=Df(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(!(!cH(c)&&!cH(a)))if(s.startsWith("A")){let l=S_(w_(t,c));if(!l)continue;l.status==="done"?n.push(al(l,"added-as-done")):l.status==="archived"&&n.push(al(l,"archived"))}else if(s.startsWith("D")){let l=S_(kO(t,e,a));l&&n.push(al(l,"archived"))}else{let l=S_(w_(t,c));if(!l)continue;let d=S_(kO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(al(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(al(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(al(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function cH(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function al(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>EO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function S_(t){if(t===null)return null;let e;try{e=(0,x_.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 w_(t,e){let r=uH(t,e);if(!Pge(r))return null;try{return Cge(r,"utf8")}catch{return null}}function kO(t,e,r){try{return Df(t,["show",`${e}:${r}`])}catch{return null}}function jge(t,e){let r=Mge(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 Mge(t){let e=w_(t,uH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,x_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function lH(t){let e={};if(t!==null)try{let n=(0,x_.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 zge(t,e){let r=Df(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);Fge.test(a)&&(Lge.test(a)||n.push({hash:s,subject:a}))}return n}var x_,Fge,Lge,cl=y(()=>{"use strict";x_=St(Qt(),1);_a();Fge=/^(feat|fix)(\([^)]*\))?!?:/,Lge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as dH}from"node:child_process";import{appendFileSync as Uge,existsSync as AO,mkdirSync as qge,readFileSync as Bge,renameSync as Hge,statSync as Gge}from"node:fs";import{userInfo as Zge}from"node:os";import{dirname as Vge,join as OO}from"node:path";function RO(t){return OO(t,fH,Wge)}function Xr(t,e){let r=RO(t),n=Vge(r);AO(n)||qge(n,{recursive:!0});try{AO(r)&&Gge(r).size>Kge&&Hge(r,OO(n,pH))}catch{}Uge(r,`${JSON.stringify(e)} -`,"utf8")}function TO(t){if(!AO(t))return[];let e=Bge(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ba(t){return TO(RO(t))}function $_(t){return[...TO(OO(t,fH,pH)),...TO(RO(t))]}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 Jge(t){let e;try{e=dH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Zge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Yge(t){try{return dH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Nf(t,e){try{let r=ba(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Yge(t),i=Jge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Nf(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}Xr(t,Qr(e,o))}catch{}}var fH,Wge,pH,Kge,Nr=y(()=>{"use strict";fH=".cladding",Wge="events.log.jsonl",pH="events.log.1.jsonl",Kge=5*1024*1024});import{execFileSync as Xge}from"node:child_process";import{existsSync as mH,readdirSync as Qge,readFileSync as eye,statSync as hH}from"node:fs";import{createHash as tye}from"node:crypto";import{join as IO}from"node:path";function va(t){try{return Xge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function PO(t){let e=[],r=IO(t,"spec.yaml");mH(r)&&hH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=IO(t,"spec",i);if(!(!mH(o)||!hH(o).isDirectory()))for(let s of Qge(o))s.endsWith(".yaml")&&e.push(IO(o,s))}e.sort();let n=tye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(eye(i)),n.update("\0")}return n.digest("hex")}function k_(t,e){let r={featureId:e,gitHead:va(t),specDigest:PO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function E_(t,e){let r=ba(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function A_(t,e,r,n){let i=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var jf=y(()=>{"use strict";Nr()});import{readFileSync as rye,statSync as nye}from"node:fs";import{extname as iye,resolve as CO,sep as oye}from"node:path";function en(t){return Math.ceil(t.length/4)}function cye(t,e){let r=CO(e),n=CO(r,t);return n===r||n.startsWith(r+oye)}function yH(t,e,r,n){if(!cye(t,e))return{path:t,omitted:"unsafe-path"};if(!sye.has(iye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>gH)return{path:t,omitted:"too-large",bytes:o}}else{let l=CO(e,t);try{o=nye(l).size}catch{return{path:t,omitted:"missing"}}if(o>gH)return{path:t,omitted:"too-large",bytes:o};try{i=rye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(aye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` +`,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=y_(e),n=ll(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=y_(e),n=ll(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())}}};sH.Parser=wO});var dH=v(Df=>{"use strict";var aH=lO(),_ge=kf(),Cf=Tf(),bge=aT(),vge=De(),Sge=SO(),cH=xO();function lH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Sge.LineCounter||null,prettyErrors:e}}function wge(t,e={}){let{lineCounter:r,prettyErrors:n}=lH(e),i=new cH.Parser(r?.addNewLine),o=new aH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Cf.prettifyError(t,r)),a.warnings.forEach(Cf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function uH(t,e={}){let{lineCounter:r,prettyErrors:n}=lH(e),i=new cH.Parser(r?.addNewLine),o=new aH.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 Cf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Cf.prettifyError(t,r)),s.warnings.forEach(Cf.prettifyError(t,r))),s}function xge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=uH(t,r);if(!i)return null;if(i.warnings.forEach(o=>bge.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 $ge(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 vge.isDocument(t)&&!n?t.toString(r):new _ge.Document(t,n,r).toString(r)}Df.parse=xge;Df.parseAllDocuments=wge;Df.parseDocument=uH;Df.stringify=$ge});var er=v(Ze=>{"use strict";var kge=lO(),Ege=kf(),Age=BT(),$O=Tf(),Tge=lf(),ts=De(),Oge=Jo(),Rge=Dt(),Ige=Xo(),Pge=Qo(),Cge=h_(),Dge=bO(),Nge=SO(),jge=xO(),b_=dH(),fH=of();Ze.Composer=kge.Composer;Ze.Document=Ege.Document;Ze.Schema=Age.Schema;Ze.YAMLError=$O.YAMLError;Ze.YAMLParseError=$O.YAMLParseError;Ze.YAMLWarning=$O.YAMLWarning;Ze.Alias=Tge.Alias;Ze.isAlias=ts.isAlias;Ze.isCollection=ts.isCollection;Ze.isDocument=ts.isDocument;Ze.isMap=ts.isMap;Ze.isNode=ts.isNode;Ze.isPair=ts.isPair;Ze.isScalar=ts.isScalar;Ze.isSeq=ts.isSeq;Ze.Pair=Oge.Pair;Ze.Scalar=Rge.Scalar;Ze.YAMLMap=Ige.YAMLMap;Ze.YAMLSeq=Pge.YAMLSeq;Ze.CST=Cge;Ze.Lexer=Dge.Lexer;Ze.LineCounter=Nge.LineCounter;Ze.Parser=jge.Parser;Ze.parse=b_.parse;Ze.parseAllDocuments=b_.parseAllDocuments;Ze.parseDocument=b_.parseDocument;Ze.stringify=b_.stringify;Ze.visit=fH.visit;Ze.visitAsync=fH.visitAsync});import{execFileSync as pH}from"node:child_process";import{existsSync as v_}from"node:fs";import{join as S_,resolve as Mge}from"node:path";function Fge(t){try{let e=pH("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Mge(t,e):null}catch{return null}}function kO(t){let e=Fge(t);if(!e)return null;try{if(v_(S_(e,"MERGE_HEAD")))return"merge";if(v_(S_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(v_(S_(e,"rebase-merge"))||v_(S_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ya(t){return kO(t)!==null}function EO(t,e){try{let r=pH("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function w_(t,e){return EO(t,e)!==null}var _a=y(()=>{"use strict"});import{execFileSync as Lge}from"node:child_process";import{existsSync as zge,readFileSync as Uge}from"node:fs";import{join as gH}from"node:path";function Nf(t,e){return Lge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function rs(t){try{let e=Nf(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 ns(t,e){qge(t,e);let r=Nf(t,["rev-parse","HEAD"]).trim(),n=Bge(t,e);return{groups:Hge(t,n),head:r,inventory:{after:hH($_(t,"spec.yaml")),before:hH(AO(t,e,"spec.yaml"))},since:e,unsharded_commits:Wge(t,e)}}function TO(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 qge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!w_(t,r))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 Bge(t,e){let r=Nf(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(!(!mH(c)&&!mH(a)))if(s.startsWith("A")){let l=x_($_(t,c));if(!l)continue;l.status==="done"?n.push(ul(l,"added-as-done")):l.status==="archived"&&n.push(ul(l,"archived"))}else if(s.startsWith("D")){let l=x_(AO(t,e,a));l&&n.push(ul(l,"archived"))}else{let l=x_($_(t,c));if(!l)continue;let d=x_(AO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(ul(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(ul(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(ul(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function mH(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function ul(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>TO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function x_(t){if(t===null)return null;let e;try{e=(0,k_.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 $_(t,e){let r=gH(t,e);if(!zge(r))return null;try{return Uge(r,"utf8")}catch{return null}}function AO(t,e,r){try{return Nf(t,["show",`${e}:${r}`])}catch{return null}}function Hge(t,e){let r=Gge(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 Gge(t){let e=$_(t,gH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,k_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function hH(t){let e={};if(t!==null)try{let n=(0,k_.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 Wge(t,e){let r=Nf(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);Zge.test(a)&&(Vge.test(a)||n.push({hash:s,subject:a}))}return n}var k_,Zge,Vge,dl=y(()=>{"use strict";k_=St(er(),1);_a();Zge=/^(feat|fix)(\([^)]*\))?!?:/,Vge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as yH}from"node:child_process";import{appendFileSync as Kge,existsSync as OO,mkdirSync as Jge,readFileSync as Yge,renameSync as Xge,statSync as Qge}from"node:fs";import{userInfo as eye}from"node:os";import{dirname as tye,join as IO}from"node:path";function PO(t){return IO(t,_H,rye)}function Qr(t,e){let r=PO(t),n=tye(r);OO(n)||Jge(n,{recursive:!0});try{OO(r)&&Qge(r).size>nye&&Xge(r,IO(n,bH))}catch{}Kge(r,`${JSON.stringify(e)} +`,"utf8")}function RO(t){if(!OO(t))return[];let e=Yge(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ba(t){return RO(PO(t))}function E_(t){return[...RO(IO(t,_H,bH)),...RO(PO(t))]}function en(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 iye(t){let e;try{e=yH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=eye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function oye(t){try{return yH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function jf(t,e){try{let r=ba(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function tr(t,e,r){try{let n=oye(t),i=iye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=jf(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}Qr(t,en(e,o))}catch{}}var _H,rye,bH,nye,Nr=y(()=>{"use strict";_H=".cladding",rye="events.log.jsonl",bH="events.log.1.jsonl",nye=5*1024*1024});import{execFileSync as sye}from"node:child_process";import{existsSync as vH,readdirSync as aye,readFileSync as cye,statSync as SH}from"node:fs";import{createHash as lye}from"node:crypto";import{join as CO}from"node:path";function va(t){try{return sye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function DO(t){let e=[],r=CO(t,"spec.yaml");vH(r)&&SH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=CO(t,"spec",i);if(!(!vH(o)||!SH(o).isDirectory()))for(let s of aye(o))s.endsWith(".yaml")&&e.push(CO(o,s))}e.sort();let n=lye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(cye(i)),n.update("\0")}return n.digest("hex")}function A_(t,e){let r={featureId:e,gitHead:va(t),specDigest:DO(t),timestamp:new Date().toISOString()};return Qr(t,en("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function T_(t,e){let r=ba(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function O_(t,e,r,n){let i=en("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Qr(t,i),i}var Mf=y(()=>{"use strict";Nr()});import{readFileSync as uye,statSync as dye}from"node:fs";import{extname as fye,resolve as NO,sep as pye}from"node:path";function tn(t){return Math.ceil(t.length/4)}function gye(t,e){let r=NO(e),n=NO(r,t);return n===r||n.startsWith(r+pye)}function xH(t,e,r,n){if(!gye(t,e))return{path:t,omitted:"unsafe-path"};if(!mye.has(fye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>wH)return{path:t,omitted:"too-large",bytes:o}}else{let l=NO(e,t);try{o=dye(l).size}catch{return{path:t,omitted:"missing"}}if(o>wH)return{path:t,omitted:"too-large",bytes:o};try{i=uye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(hye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` /* ... clipped (${o} bytes total) ... */ -`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var sye,gH,aye,T_=y(()=>{"use strict";sye=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"]),gH=2e6,aye="\0"});function uye(t){for(let i of lye)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function DO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function dye(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])DO(e,s,o);for(let s of i.modules??[])DO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=uye(a);c&&DO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function En(t){let e=_H.get(t);return e||(e=dye(t),_H.set(t,e)),e}var lye,_H,Sa=y(()=>{"use strict";lye=["derived:","fixture:","script:","self-dogfood:"];_H=new WeakMap});function NO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function br(t,e,r={}){let n=r.depth??1/0,i=En(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=fye(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=NO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:jO(i)}}var wa=y(()=>{"use strict";Sa()});function bH(t){return t.impacted.length}function R_(t,e,r={}){let n=r.initialDepth??O_.initialDepth,i=r.maxDepth??O_.maxDepth,o=r.coverageThreshold??O_.coverageThreshold,s=r.marginYieldThreshold??O_.marginYieldThreshold,a=En(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=br(t,e,{depth:1});return"not_found"in b,b}let d=NO(l,a.dependents,1/0).size;if(d===0){let b=br(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=bH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var O_,MO=y(()=>{"use strict";wa();Sa();O_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function pye(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function vH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=pye(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var SH=y(()=>{"use strict"});function mye(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function ll(t,e){let r=mye(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=vH(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var I_=y(()=>{"use strict";SH()});import{existsSync as xH,readdirSync as hye,readFileSync as gye}from"node:fs";import{join as LO}from"node:path";function zO(t,e=_ye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function bye(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:zO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:zO(`done reverted \u2014 pre-push strict gate red${r}`)}}function wH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function vye(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return zO(n)}function Sye(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>wH(m)-wH(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-yye).map(bye),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?vye(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function FO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function wye(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` -`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function xye(t,e,r){let n=FO(t,/_Rolled back at_\s*`([^`]+)`/),i=FO(t,/Last failed gate:\s*`([^`]+)`/),o=FO(t,/Retry attempts:\s*(\d+)/),s=wye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function $ye(t,e){let r=LO(t,".cladding","post-mortems");if(!xH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of hye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(xye(gye(LO(r,o),"utf8"),e,o))}catch{}return i}function $H(t,e){try{let r=$_(t),n=$ye(t,e),i=xH(LO(t,".cladding","events.log.1.jsonl"));return Sye(r,n,e,{truncated:i})}catch{return}}var yye,_ye,kH=y(()=>{"use strict";Nr();yye=5,_ye=120});function P_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:kye,o=e,s,a=En(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=ll(t,o);if("not_found"in c)return c;let l=c.focus,u=$H(n,l.id),d=a&&a.size>0?e:l.id,f=R_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},O=[...c.ancestors];for(;O.length>Eye&&P_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Ce,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],co={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(co))>i},ie=m,K=h;if($(ie,K,0,0)){let se=br(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Yt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],co=0;for(;Yt.length>Ce.size&&$(Yt,K,co,0);)Yt=Yt.slice(0,-1),co++;let wi=[...h],Yr=0;for(;$(Yt,wi,co,Yr);){let de=-1;for(let lo=wi.length-1;lo>=0;lo--)if(!Kt.has(wi[lo])){de=lo;break}if(de<0)break;wi.splice(de,1),Yr++}ie=Yt,K=wi,co+Yr>0&&x.push(`breaks: omitted ${co} feature(s) / ${Yr} test(s)`),$(ie,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(ie,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};en(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var kye,Eye,C_=y(()=>{"use strict";T_();I_();MO();kH();wa();Sa();kye=3e3,Eye=3});function Jn(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function Aye(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function EH(t,e,r="."){let n=En(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=R_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(Jn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Jn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Jn(a(c))*10)/10,medianShrinkTruncated:Math.round(Jn(a(l))*10)/10,medianStructuralRatio:Math.round(Jn(u)*100)/100,medianSliceTokens:Math.round(Jn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Jn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Jn(o.map(f=>f.searchDepth)),p95Depth:Aye(o.map(f=>f.searchDepth),95),medianEdges:Jn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Jn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Jn(o.map(f=>f.regressionTests))},features:o}}var ul,D_=y(()=>{"use strict";T_();MO();C_();Sa();ul="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Tye,existsSync as UO,mkdirSync as Oye,readFileSync as AH}from"node:fs";import{dirname as Rye,join as Iye}from"node:path";function qO(t){return Iye(t,Pye,Cye)}function Dye(t,e){return{timestamp:new Date().toISOString(),head:va(t),spec_digest:PO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function TH(t,e){try{let r=Dye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=BO(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=qO(t),s=Rye(o);return UO(s)||Oye(s,{recursive:!0}),Tye(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function OH(t){let e=[];for(let r of t.split(` -`)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function BO(t,e){let r=qO(t);if(!UO(r))return[];let n;try{n=AH(r,"utf8")}catch{return[]}let i=OH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function RH(t){let e=qO(t);if(!UO(e))return{snapshots:[],unreadable:!1};let r;try{r=AH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=OH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Mf(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function IH(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${Mf(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${ul}`),i.join(` -`)}var Pye,Cye,Ff=y(()=>{"use strict";jf();D_();Pye=".cladding",Cye="measure.jsonl"});import{existsSync as Nye}from"node:fs";import{join as jye}from"node:path";function dl(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}** (${Mye[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 CH(t){let e=t.snapshot,r=["## Measured (this release)",""];if(!e||!e.head)return r.push("not measured at this commit \u2014 run clad measure before tagging"),r.join(` -`);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${Mf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Mf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Mf(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",ul),r.join(` -`)}function fl(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"} | ${Lye(l,r)} |`)}return n.join(` -`)}function Lye(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 Fye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Nye(jye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function pl(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),PH(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)PH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function PH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=EO(r);n&&t.push(`- ${n}`)}t.push("")}var Mye,Fye,N_=y(()=>{"use strict";Ff();D_();cl();Mye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Fye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as zye}from"node:fs";function Ai(t="./spec.yaml"){let e=zye(t,"utf8");return(0,DH.parse)(e)}var DH,j_=y(()=>{"use strict";DH=St(Qt(),1)});var is=v((jr,VO)=>{"use strict";var HO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+jH(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()};HO.prototype.toString=function(){return this.property+" "+this.message};var M_=jr.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};M_.prototype.addError=function(e){var r;if(typeof e=="string")r=new HO(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 HO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};M_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Uye(t,e){return e+": "+t.toString()+` -`}M_.prototype.toString=function(e){return this.errors.map(Uye).join("")};Object.defineProperty(M_.prototype,"valid",{get:function(){return!this.errors.length}});VO.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var NH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};NH.prototype=Object.create(Error.prototype,{constructor:{value:NH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var GO=jr.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+jH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};GO.prototype.resolve=function(e){return MH(this.base,e)};GO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=MH(this.base,i||"");var s=new GO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Yn=jr.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]+$/};Yn.regexp=Yn.regex;Yn.pattern=Yn.regex;Yn.ipv4=Yn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Yn[r]!==void 0){if(Yn[r]instanceof RegExp)return Yn[r].test(e);if(typeof Yn[r]=="function")return Yn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var jH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 qye(t,e,r,n){typeof r=="object"?e[n]=ZO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Bye(t,e,r){e[r]=t[r]}function Hye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=ZO(t[n],e[n]):r[n]=e[n]}function ZO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(qye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Bye.bind(null,t,n)),Object.keys(e).forEach(Hye.bind(null,t,e,n))),n}VO.exports.deepMerge=ZO;jr.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 Gye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Gye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var MH=jr.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 UH=v((VXe,zH)=>{"use strict";var tn=is(),Le=tn.ValidatorResult,os=tn.SchemaError,WO={};WO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=WO.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(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 KO(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 Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new os("anyOf must be an array");if(!r.anyOf.some(KO.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 os("allOf must be an array");var o=new Le(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 os("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(KO.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(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=KO.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 JO(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 Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new os('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(JO(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 Le(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 os('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=JO(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 FH(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 Le(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 os('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&&FH.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 Le(e,r,n,i);for(var s in e)FH.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 Le(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 Le(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 Le(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(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(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 Le(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 Le(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 Le(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 Le(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 Le(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 Le(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 Zye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var YO=is();XO.exports.SchemaScanResult=qH;function qH(t,e){this.id=t,this.ref=e}XO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=YO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=YO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!YO.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 BH=UH(),ss=is(),HH=F_().scan,GH=ss.ValidatorResult,Vye=ss.ValidatorResultError,Lf=ss.SchemaError,ZH=ss.SchemaContext,Wye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ti),this.attributes=Object.create(BH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=HH(r||Wye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ss.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Lf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Lf('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 Ti=Jt.prototype.types={};Ti.string=function(e){return typeof e=="string"};Ti.number=function(e){return typeof e=="number"&&isFinite(e)};Ti.integer=function(e){return typeof e=="number"&&e%1===0};Ti.boolean=function(e){return typeof e=="boolean"};Ti.array=function(e){return Array.isArray(e)};Ti.null=function(e){return e===null};Ti.date=function(e){return e instanceof Date};Ti.any=function(e){return!0};Ti.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};WH.exports=Jt});var JH=v((JXe,mo)=>{"use strict";var Kye=mo.exports.Validator=KH();mo.exports.ValidatorResult=is().ValidatorResult;mo.exports.ValidatorResultError=is().ValidatorResultError;mo.exports.ValidationError=is().ValidationError;mo.exports.SchemaError=is().SchemaError;mo.exports.SchemaScanResult=F_().SchemaScanResult;mo.exports.scan=F_().scan;mo.exports.validate=function(t,e,r){var n=new Kye;return n.validate(t,e,r)}});import{readFileSync as Jye}from"node:fs";import{dirname as Yye,join as Xye}from"node:path";import{fileURLToPath as Qye}from"node:url";function i_e(t){let e=n_e.validate(t,r_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function XH(t){let e=i_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var mye,wH,hye,R_=y(()=>{"use strict";mye=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"]),wH=2e6,hye="\0"});function _ye(t){for(let i of yye)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function jO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function bye(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])jO(e,s,o);for(let s of i.modules??[])jO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=_ye(a);c&&jO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function An(t){let e=$H.get(t);return e||(e=bye(t),$H.set(t,e)),e}var yye,$H,Sa=y(()=>{"use strict";yye=["derived:","fixture:","script:","self-dogfood:"];$H=new WeakMap});function MO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function vr(t,e,r={}){let n=r.depth??1/0,i=An(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=vye(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=MO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:FO(i)}}var wa=y(()=>{"use strict";Sa()});function kH(t){return t.impacted.length}function P_(t,e,r={}){let n=r.initialDepth??I_.initialDepth,i=r.maxDepth??I_.maxDepth,o=r.coverageThreshold??I_.coverageThreshold,s=r.marginYieldThreshold??I_.marginYieldThreshold,a=An(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=vr(t,e,{depth:1});return"not_found"in b,b}let d=MO(l,a.dependents,1/0).size;if(d===0){let b=vr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=vr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=kH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var I_,LO=y(()=>{"use strict";wa();Sa();I_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Sye(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function EH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Sye(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var AH=y(()=>{"use strict"});function wye(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function fl(t,e){let r=wye(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=EH(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var C_=y(()=>{"use strict";AH()});import{existsSync as OH,readdirSync as xye,readFileSync as $ye}from"node:fs";import{join as UO}from"node:path";function qO(t,e=Eye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Aye(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:qO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:qO(`done reverted \u2014 pre-push strict gate red${r}`)}}function TH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Tye(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return qO(n)}function Oye(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>TH(m)-TH(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-kye).map(Aye),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?Tye(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function zO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Rye(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` +`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function Iye(t,e,r){let n=zO(t,/_Rolled back at_\s*`([^`]+)`/),i=zO(t,/Last failed gate:\s*`([^`]+)`/),o=zO(t,/Retry attempts:\s*(\d+)/),s=Rye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Pye(t,e){let r=UO(t,".cladding","post-mortems");if(!OH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of xye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(Iye($ye(UO(r,o),"utf8"),e,o))}catch{}return i}function RH(t,e){try{let r=E_(t),n=Pye(t,e),i=OH(UO(t,".cladding","events.log.1.jsonl"));return Oye(r,n,e,{truncated:i})}catch{return}}var kye,Eye,IH=y(()=>{"use strict";Nr();kye=5,Eye=120});function D_(t,e,r){return tn(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:Cye,o=e,s,a=An(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=fl(t,o);if("not_found"in c)return c;let l=c.focus,u=RH(n,l.id),d=a&&a.size>0?e:l.id,f=P_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},O=[...c.ancestors];for(;O.length>Dye&&D_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Ce,Kt,dr)=>{let Xt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],lo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Xt]}};return tn(JSON.stringify(lo))>i},re=m,K=h;if($(re,K,0,0)){let se=vr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Xt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],lo=0;for(;Xt.length>Ce.size&&$(Xt,K,lo,0);)Xt=Xt.slice(0,-1),lo++;let $i=[...h],Xr=0;for(;$(Xt,$i,lo,Xr);){let de=-1;for(let uo=$i.length-1;uo>=0;uo--)if(!Kt.has($i[uo])){de=uo;break}if(de<0)break;$i.splice(de,1),Xr++}re=Xt,K=$i,lo+Xr>0&&x.push(`breaks: omitted ${lo} feature(s) / ${Xr} test(s)`),$(re,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(re,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};tn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Ir=tn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var Cye,Dye,N_=y(()=>{"use strict";R_();C_();LO();IH();wa();Sa();Cye=3e3,Dye=3});function Yn(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function Nye(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function PH(t,e,r="."){let n=An(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=P_(t,f.id),g=!("not_found"in h),b=tn(JSON.stringify(p)),_="not_found"in m?b:tn(JSON.stringify(m)),S=tn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=tn(T))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(Yn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Yn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Yn(a(c))*10)/10,medianShrinkTruncated:Math.round(Yn(a(l))*10)/10,medianStructuralRatio:Math.round(Yn(u)*100)/100,medianSliceTokens:Math.round(Yn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Yn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Yn(o.map(f=>f.searchDepth)),p95Depth:Nye(o.map(f=>f.searchDepth),95),medianEdges:Yn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Yn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Yn(o.map(f=>f.regressionTests))},features:o}}var pl,j_=y(()=>{"use strict";R_();LO();N_();Sa();pl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as jye,existsSync as BO,mkdirSync as Mye,readFileSync as CH}from"node:fs";import{dirname as Fye,join as Lye}from"node:path";function HO(t){return Lye(t,zye,Uye)}function qye(t,e){return{timestamp:new Date().toISOString(),head:va(t),spec_digest:DO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function DH(t,e){try{let r=qye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=GO(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=HO(t),s=Fye(o);return BO(s)||Mye(s,{recursive:!0}),jye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function NH(t){let e=[];for(let r of t.split(` +`)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function GO(t,e){let r=HO(t);if(!BO(r))return[];let n;try{n=CH(r,"utf8")}catch{return[]}let i=NH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function jH(t){let e=HO(t);if(!BO(e))return{snapshots:[],unreadable:!1};let r;try{r=CH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=NH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Ff(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function MH(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${Ff(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${pl}`),i.join(` +`)}var zye,Uye,Lf=y(()=>{"use strict";Mf();j_();zye=".cladding",Uye="measure.jsonl"});import{existsSync as Bye}from"node:fs";import{join as Hye}from"node:path";function ml(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}** (${Gye[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 LH(t){let e=t.snapshot,r=["## Measured (this release)",""];if(!e||!e.head)return r.push("not measured at this commit \u2014 run clad measure before tagging"),r.join(` +`);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${Ff(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Ff(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Ff(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",pl),r.join(` +`)}function hl(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"} | ${Vye(l,r)} |`)}return n.join(` +`)}function Vye(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 Zye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Bye(Hye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function gl(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),FH(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)FH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function FH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=TO(r);n&&t.push(`- ${n}`)}t.push("")}var Gye,Zye,M_=y(()=>{"use strict";Lf();j_();dl();Gye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Zye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Wye}from"node:fs";function Oi(t="./spec.yaml"){let e=Wye(t,"utf8");return(0,zH.parse)(e)}var zH,F_=y(()=>{"use strict";zH=St(er(),1)});var is=v((jr,KO)=>{"use strict";var ZO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+qH(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()};ZO.prototype.toString=function(){return this.property+" "+this.message};var L_=jr.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};L_.prototype.addError=function(e){var r;if(typeof e=="string")r=new ZO(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 ZO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};L_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Kye(t,e){return e+": "+t.toString()+` +`}L_.prototype.toString=function(e){return this.errors.map(Kye).join("")};Object.defineProperty(L_.prototype,"valid",{get:function(){return!this.errors.length}});KO.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var UH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};UH.prototype=Object.create(Error.prototype,{constructor:{value:UH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var VO=jr.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+qH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};VO.prototype.resolve=function(e){return BH(this.base,e)};VO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=BH(this.base,i||"");var s=new VO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Xn=jr.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]+$/};Xn.regexp=Xn.regex;Xn.pattern=Xn.regex;Xn.ipv4=Xn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Xn[r]!==void 0){if(Xn[r]instanceof RegExp)return Xn[r].test(e);if(typeof Xn[r]=="function")return Xn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var qH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 Jye(t,e,r,n){typeof r=="object"?e[n]=WO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Yye(t,e,r){e[r]=t[r]}function Xye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=WO(t[n],e[n]):r[n]=e[n]}function WO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Jye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Yye.bind(null,t,n)),Object.keys(e).forEach(Xye.bind(null,t,e,n))),n}KO.exports.deepMerge=WO;jr.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 Qye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Qye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var BH=jr.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 VH=v((m7e,ZH)=>{"use strict";var rn=is(),Le=rn.ValidatorResult,os=rn.SchemaError,JO={};JO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=JO.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(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 YO(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 Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new os("anyOf must be an array");if(!r.anyOf.some(YO.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 os("allOf must be an array");var o=new Le(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 os("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(YO.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(!rn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=YO.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!rn.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(!rn.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 XO(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 Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!rn.isSchema(s))throw new os('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(XO(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 Le(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 os('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=XO(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 HH(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 Le(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 os('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&&HH.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 Le(e,r,n,i);for(var s in e)HH.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 Le(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 Le(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 Le(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(!rn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(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 Le(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 Le(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 Le(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 Le(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 Le(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 Le(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 e_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var QO=is();eR.exports.SchemaScanResult=WH;function WH(t,e){this.id=t,this.ref=e}eR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=QO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=QO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!QO.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 KH=VH(),ss=is(),JH=z_().scan,YH=ss.ValidatorResult,t_e=ss.ValidatorResultError,zf=ss.SchemaError,XH=ss.SchemaContext,r_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ri),this.attributes=Object.create(KH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=JH(r||r_e,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ss.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new zf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new zf('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 Ri=Jt.prototype.types={};Ri.string=function(e){return typeof e=="string"};Ri.number=function(e){return typeof e=="number"&&isFinite(e)};Ri.integer=function(e){return typeof e=="number"&&e%1===0};Ri.boolean=function(e){return typeof e=="boolean"};Ri.array=function(e){return Array.isArray(e)};Ri.null=function(e){return e===null};Ri.date=function(e){return e instanceof Date};Ri.any=function(e){return!0};Ri.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};eG.exports=Jt});var rG=v((y7e,ho)=>{"use strict";var n_e=ho.exports.Validator=tG();ho.exports.ValidatorResult=is().ValidatorResult;ho.exports.ValidatorResultError=is().ValidatorResultError;ho.exports.ValidationError=is().ValidationError;ho.exports.SchemaError=is().SchemaError;ho.exports.SchemaScanResult=z_().SchemaScanResult;ho.exports.scan=z_().scan;ho.exports.validate=function(t,e,r){var n=new n_e;return n.validate(t,e,r)}});import{readFileSync as i_e}from"node:fs";import{dirname as o_e,join as s_e}from"node:path";import{fileURLToPath as a_e}from"node:url";function f_e(t){let e=d_e.validate(t,u_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function iG(t){let e=f_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var YH,e_e,t_e,r_e,n_e,QH=y(()=>{"use strict";YH=St(JH(),1),e_e=Yye(Qye(import.meta.url)),t_e=Xye(e_e,"schema.json"),r_e=JSON.parse(Jye(t_e,"utf8")),n_e=new YH.Validator});import{existsSync as QO,readdirSync as o_e}from"node:fs";import{dirname as s_e,join as ka,resolve as tG}from"node:path";function eG(t){return QO(t)?o_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ai(ka(t,r))):[]}function Ea(t,e){L_=e?{cwd:tG(t),spec:e}:null}function H(t=".",e="spec.yaml"){return L_&&e==="spec.yaml"&&tG(t)===L_.cwd?L_.spec:a_e(t,e)}function a_e(t,e){let r=ka(t,e),n=Ai(r),i=ka(t,s_e(e),"spec");if(!n.features||n.features.length===0){let o=eG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=eG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");QO(o)&&(n.architecture=Ai(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(QO(o)){let s=Ai(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return XH(n),n}var L_,Be=y(()=>{"use strict";j_();QH();L_=null});import ml from"node:process";function rR(){return!!ml.stdout.isTTY}function L(t,e,r=""){let n=rG[t],i=r?` ${r}`:"";rR()?ml.stdout.write(`${eR[t]}${n}${tR} ${e}${i} -`):ml.stdout.write(`${n} ${e}${i} -`)}function zf(t,e,r=""){if(!rR())return;let n=r?` ${r}`:"";ml.stdout.write(`${nG}${eR.start}\xB7${tR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=rG[t],i=r?` ${r}`:"";rR()?ml.stdout.write(`${nG}${eR[t]}${n}${tR} ${e}${i} -`):ml.stdout.write(`${n} ${e}${i} -`)}var rG,eR,tR,nG,Oi=y(()=>{"use strict";rG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},eR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},tR="\x1B[0m",nG="\r\x1B[K"});import{createHash as $G}from"node:crypto";import{existsSync as L_e,readFileSync as oR,writeFileSync as z_e}from"node:fs";import{join as z_}from"node:path";function U_e(t,e){let r=$G("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(oR(z_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function EG(t,e){let r=$G("sha256");try{r.update(oR(z_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function as(t){let e=z_(t,...kG);if(!L_e(e))return null;let r;try{r=oR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function U_(t){return t.features?.size??t.v1?.size??0}function q_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==EG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===U_e(e,n)?{state:"fresh"}:{state:"stale"}}function AG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${EG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=q_e+`attested_modules: + `)}`)}var nG,c_e,l_e,u_e,d_e,oG=y(()=>{"use strict";nG=St(rG(),1),c_e=o_e(a_e(import.meta.url)),l_e=s_e(c_e,"schema.json"),u_e=JSON.parse(i_e(l_e,"utf8")),d_e=new nG.Validator});import{existsSync as tR,readdirSync as p_e}from"node:fs";import{dirname as m_e,join as ka,resolve as aG}from"node:path";function sG(t){return tR(t)?p_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Oi(ka(t,r))):[]}function Ea(t,e){U_=e?{cwd:aG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return U_&&e==="spec.yaml"&&aG(t)===U_.cwd?U_.spec:h_e(t,e)}function h_e(t,e){let r=ka(t,e),n=Oi(r),i=ka(t,m_e(e),"spec");if(!n.features||n.features.length===0){let o=sG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=sG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");tR(o)&&(n.architecture=Oi(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(tR(o)){let s=Oi(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return iG(n),n}var U_,Ue=y(()=>{"use strict";F_();oG();U_=null});import yl from"node:process";function iR(){return!!yl.stdout.isTTY}function L(t,e,r=""){let n=cG[t],i=r?` ${r}`:"";iR()?yl.stdout.write(`${rR[t]}${n}${nR} ${e}${i} +`):yl.stdout.write(`${n} ${e}${i} +`)}function Uf(t,e,r=""){if(!iR())return;let n=r?` ${r}`:"";yl.stdout.write(`${lG}${rR.start}\xB7${nR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=cG[t],i=r?` ${r}`:"";iR()?yl.stdout.write(`${lG}${rR[t]}${n}${nR} ${e}${i} +`):yl.stdout.write(`${n} ${e}${i} +`)}var cG,rR,nR,lG,Ii=y(()=>{"use strict";cG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},rR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},nR="\x1B[0m",lG="\r\x1B[K"});import{createHash as RG}from"node:crypto";import{existsSync as V_e,readFileSync as aR,writeFileSync as W_e}from"node:fs";import{join as q_}from"node:path";function K_e(t,e){let r=RG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(aR(q_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function PG(t,e){let r=RG("sha256");try{r.update(aR(q_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function as(t){let e=q_(t,...IG);if(!V_e(e))return null;let r;try{r=aR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function B_(t){return t.features?.size??t.v1?.size??0}function H_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==PG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===K_e(e,n)?{state:"fresh"}:{state:"stale"}}function CG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${PG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=J_e+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return z_e(z_(t,...kG),s,"utf8"),!0}var kG,q_e,gl=y(()=>{"use strict";kG=["spec","attestation.yaml"];q_e=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return W_e(q_(t,...IG),s,"utf8"),!0}var IG,J_e,vl=y(()=>{"use strict";IG=["spec","attestation.yaml"];J_e=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN # \`clad check --tier=pre-push --strict\` gate \u2014 the file's one honest author. # Do not edit by hand. # @@ -211,53 +211,53 @@ attested_features: # Merge conflict here? NEVER hand-resolve the hashes \u2014 keep either side and run # \`clad check --tier=pre-push --strict\`; the GREEN gate rewrites the truth. # Content-anchored: survives fresh clones and squash/rebase. -`});import{resolve as sR}from"node:path";function B_(t){cs={cwd:sR(t),results:new Map}}function TG(t,e,r){!cs||cs.cwd!==sR(e)||cs.results.set(t,r)}function H_(t,e){return!cs||cs.cwd!==sR(e)?null:cs.results.get(t)??null}function G_(){cs=null}var cs,yl=y(()=>{"use strict";cs=null});function Ot(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 go=y(()=>{});import{fileURLToPath as B_e}from"node:url";var _l,H_e,aR,cR,bl=y(()=>{_l=(t,e)=>{let r=cR(H_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},H_e=t=>aR(t)?t.toString():t,aR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,cR=t=>t instanceof URL?B_e(t):t});var Z_,lR=y(()=>{go();bl();Z_=(t,e=[],r={})=>{let n=_l(t,"First argument"),[i,o]=Ot(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(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as G_e}from"node:string_decoder";var OG,RG,Ut,yo,Z_e,IG,V_e,V_,PG,W_e,Bf,K_e,uR,J_e,rn=y(()=>{({toString:OG}=Object.prototype),RG=t=>OG.call(t)==="[object ArrayBuffer]",Ut=t=>OG.call(t)==="[object Uint8Array]",yo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Z_e=new TextEncoder,IG=t=>Z_e.encode(t),V_e=new TextDecoder,V_=t=>V_e.decode(t),PG=(t,e)=>W_e(t,e).join(""),W_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new G_e(e),n=t.map(o=>typeof o=="string"?IG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Bf=t=>t.length===1&&Ut(t[0])?t[0]:uR(K_e(t)),K_e=t=>t.map(e=>typeof e=="string"?IG(e):e),uR=t=>{let e=new Uint8Array(J_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},J_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Y_e}from"node:child_process";var jG,MG,X_e,Q_e,CG,ebe,DG,NG,tbe,FG=y(()=>{go();rn();jG=t=>Array.isArray(t)&&Array.isArray(t.raw),MG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=X_e({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,{}]},X_e=({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}=Q_e(i,t.raw[n]),c=DG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>NG(d)):[NG(l)];return DG(c,u,a)},Q_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=CG.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)],NG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return tbe(t);throw t instanceof Y_e||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`)},tbe=({stdout:t})=>{if(typeof t=="string")return t;if(Ut(t))return V_(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 dR from"node:process";var Xn,W_,An,K_,_o=y(()=>{Xn=t=>W_.includes(t),W_=[dR.stdin,dR.stdout,dR.stderr],An=["stdin","stdout","stderr"],K_=t=>An[t]??`stdio[${t}]`});import{debuglog as rbe}from"node:util";var zG,fR,nbe,ibe,obe,sbe,LG,abe,pR,cbe,lbe,ube,dbe,mR,bo,vo=y(()=>{go();_o();zG=t=>{let e={...t};for(let r of mR)e[r]=fR(t,r);return e},fR=(t,e)=>{let r=Array.from({length:nbe(t)+1}),n=ibe(t[e],r,e);return lbe(n,e)},nbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,An.length):An.length,ibe=(t,e,r)=>Ot(t)?obe(t,e,r):e.fill(t),obe=(t,e,r)=>{for(let n of Object.keys(t).sort(sbe))for(let i of abe(n,r,e))e[i]=t[n];return e},sbe=(t,e)=>LG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,abe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=pR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as cR}from"node:path";function G_(t){cs={cwd:cR(t),results:new Map}}function DG(t,e,r){!cs||cs.cwd!==cR(e)||cs.results.set(t,r)}function Z_(t,e){return!cs||cs.cwd!==cR(e)?null:cs.results.get(t)??null}function V_(){cs=null}var cs,Sl=y(()=>{"use strict";cs=null});function Ot(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 yo=y(()=>{});import{fileURLToPath as Y_e}from"node:url";var wl,X_e,lR,uR,xl=y(()=>{wl=(t,e)=>{let r=uR(X_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},X_e=t=>lR(t)?t.toString():t,lR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,uR=t=>t instanceof URL?Y_e(t):t});var W_,dR=y(()=>{yo();xl();W_=(t,e=[],r={})=>{let n=wl(t,"First argument"),[i,o]=Ot(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(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as Q_e}from"node:string_decoder";var NG,jG,qt,_o,ebe,MG,tbe,K_,FG,rbe,Bf,nbe,fR,ibe,nn=y(()=>{({toString:NG}=Object.prototype),jG=t=>NG.call(t)==="[object ArrayBuffer]",qt=t=>NG.call(t)==="[object Uint8Array]",_o=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ebe=new TextEncoder,MG=t=>ebe.encode(t),tbe=new TextDecoder,K_=t=>tbe.decode(t),FG=(t,e)=>rbe(t,e).join(""),rbe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Q_e(e),n=t.map(o=>typeof o=="string"?MG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Bf=t=>t.length===1&&qt(t[0])?t[0]:fR(nbe(t)),nbe=t=>t.map(e=>typeof e=="string"?MG(e):e),fR=t=>{let e=new Uint8Array(ibe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},ibe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as obe}from"node:child_process";var qG,BG,sbe,abe,LG,cbe,zG,UG,lbe,HG=y(()=>{yo();nn();qG=t=>Array.isArray(t)&&Array.isArray(t.raw),BG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=sbe({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,{}]},sbe=({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}=abe(i,t.raw[n]),c=zG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>UG(d)):[UG(l)];return zG(c,u,a)},abe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=LG.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)],UG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return lbe(t);throw t instanceof obe||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`)},lbe=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return K_(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 pR from"node:process";var Qn,J_,Tn,Y_,bo=y(()=>{Qn=t=>J_.includes(t),J_=[pR.stdin,pR.stdout,pR.stderr],Tn=["stdin","stdout","stderr"],Y_=t=>Tn[t]??`stdio[${t}]`});import{debuglog as ube}from"node:util";var ZG,mR,dbe,fbe,pbe,mbe,GG,hbe,hR,gbe,ybe,_be,bbe,gR,vo,So=y(()=>{yo();bo();ZG=t=>{let e={...t};for(let r of gR)e[r]=mR(t,r);return e},mR=(t,e)=>{let r=Array.from({length:dbe(t)+1}),n=fbe(t[e],r,e);return ybe(n,e)},dbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Tn.length):Tn.length,fbe=(t,e,r)=>Ot(t)?pbe(t,e,r):e.fill(t),pbe=(t,e,r)=>{for(let n of Object.keys(t).sort(mbe))for(let i of hbe(n,r,e))e[i]=t[n];return e},mbe=(t,e)=>GG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,hbe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=hR(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]},pR=t=>{if(t==="all")return t;if(An.includes(t))return An.indexOf(t);let e=cbe.exec(t);if(e!==null)return Number(e[1])},cbe=/^fd(\d+)$/,lbe=(t,e)=>t.map(r=>r===void 0?dbe[e]:r),ube=rbe("execa").enabled?"full":"none",dbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:ube,stripFinalNewline:!0},mR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],bo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var vl,Sl,UG,hR,fbe,J_,Y_,ls=y(()=>{vo();vl=({verbose:t},e)=>hR(t,e)!=="none",Sl=({verbose:t},e)=>!["none","short"].includes(hR(t,e)),UG=({verbose:t},e)=>{let r=hR(t,e);return J_(r)?r:void 0},hR=(t,e)=>e===void 0?fbe(t):bo(t,e),fbe=t=>t.find(e=>J_(e))??Y_.findLast(e=>t.includes(e)),J_=t=>typeof t=="function",Y_=["none","short","full"]});import{platform as pbe}from"node:process";import{stripVTControlCharacters as mbe}from"node:util";var qG,Hf,BG,hbe,gbe,ybe,_be,bbe,vbe,Sbe,X_=y(()=>{qG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>vbe(BG(o))).join(" ");return{command:n,escapedCommand:i}},Hf=t=>mbe(t).split(` -`).map(e=>BG(e)).join(` -`),BG=t=>t.replaceAll(ybe,e=>hbe(e)),hbe=t=>{let e=_be[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=bbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},gbe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},ybe=gbe(),_be={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},bbe=65535,vbe=t=>Sbe.test(t)?t:pbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Sbe=/^[\w./-]+$/});import HG from"node:process";function gR(){let{env:t}=HG,{TERM:e,TERM_PROGRAM:r}=t;return HG.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 GG=y(()=>{});var ZG,VG,wbe,xbe,$be,kbe,Ebe,Q_,eQe,WG=y(()=>{GG();ZG={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"},VG={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"},wbe={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"},xbe={...ZG,...VG},$be={...ZG,...wbe},kbe=gR(),Ebe=kbe?xbe:$be,Q_=Ebe,eQe=Object.entries(VG)});import Abe from"node:tty";var Tbe,be,nQe,KG,iQe,oQe,sQe,aQe,cQe,lQe,uQe,dQe,fQe,pQe,mQe,hQe,gQe,yQe,_Qe,eb,bQe,vQe,SQe,wQe,xQe,$Qe,kQe,EQe,AQe,JG,TQe,YG,OQe,RQe,IQe,PQe,CQe,DQe,NQe,jQe,MQe,FQe,LQe,yR=y(()=>{Tbe=Abe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Tbe)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}},nQe=be(0,0),KG=be(1,22),iQe=be(2,22),oQe=be(3,23),sQe=be(4,24),aQe=be(53,55),cQe=be(7,27),lQe=be(8,28),uQe=be(9,29),dQe=be(30,39),fQe=be(31,39),pQe=be(32,39),mQe=be(33,39),hQe=be(34,39),gQe=be(35,39),yQe=be(36,39),_Qe=be(37,39),eb=be(90,39),bQe=be(40,49),vQe=be(41,49),SQe=be(42,49),wQe=be(43,49),xQe=be(44,49),$Qe=be(45,49),kQe=be(46,49),EQe=be(47,49),AQe=be(100,49),JG=be(91,39),TQe=be(92,39),YG=be(93,39),OQe=be(94,39),RQe=be(95,39),IQe=be(96,39),PQe=be(97,39),CQe=be(101,49),DQe=be(102,49),NQe=be(103,49),jQe=be(104,49),MQe=be(105,49),FQe=be(106,49),LQe=be(107,49)});var XG=y(()=>{yR();yR()});var tZ,Rbe,tb,QG,Ibe,eZ,Pbe,rZ=y(()=>{WG();XG();tZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Rbe(r),c=Ibe[t]({failed:o,reject:s,piped:n}),l=Pbe[t]({reject:s});return`${eb(`[${a}]`)} ${eb(`[${i}]`)} ${l(c)} ${l(e)}`},Rbe=t=>`${tb(t.getHours(),2)}:${tb(t.getMinutes(),2)}:${tb(t.getSeconds(),2)}.${tb(t.getMilliseconds(),3)}`,tb=(t,e)=>String(t).padStart(e,"0"),QG=({failed:t,reject:e})=>t?e?Q_.cross:Q_.warning:Q_.tick,Ibe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:QG,duration:QG},eZ=t=>t,Pbe={command:()=>KG,output:()=>eZ,ipc:()=>eZ,error:({reject:t})=>t?JG:YG,duration:()=>eb}});var nZ,Cbe,Dbe,iZ=y(()=>{ls();nZ=(t,e,r)=>{let n=UG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Cbe(i,o,n)).filter(i=>i!==void 0).map(i=>Dbe(i)).join("")},Cbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Dbe=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},hR=t=>{if(t==="all")return t;if(Tn.includes(t))return Tn.indexOf(t);let e=gbe.exec(t);if(e!==null)return Number(e[1])},gbe=/^fd(\d+)$/,ybe=(t,e)=>t.map(r=>r===void 0?bbe[e]:r),_be=ube("execa").enabled?"full":"none",bbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:_be,stripFinalNewline:!0},gR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],vo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var $l,kl,VG,yR,vbe,X_,Q_,ls=y(()=>{So();$l=({verbose:t},e)=>yR(t,e)!=="none",kl=({verbose:t},e)=>!["none","short"].includes(yR(t,e)),VG=({verbose:t},e)=>{let r=yR(t,e);return X_(r)?r:void 0},yR=(t,e)=>e===void 0?vbe(t):vo(t,e),vbe=t=>t.find(e=>X_(e))??Q_.findLast(e=>t.includes(e)),X_=t=>typeof t=="function",Q_=["none","short","full"]});import{platform as Sbe}from"node:process";import{stripVTControlCharacters as wbe}from"node:util";var WG,Hf,KG,xbe,$be,kbe,Ebe,Abe,Tbe,Obe,eb=y(()=>{WG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Tbe(KG(o))).join(" ");return{command:n,escapedCommand:i}},Hf=t=>wbe(t).split(` +`).map(e=>KG(e)).join(` +`),KG=t=>t.replaceAll(kbe,e=>xbe(e)),xbe=t=>{let e=Ebe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Abe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},$be=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},kbe=$be(),Ebe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Abe=65535,Tbe=t=>Obe.test(t)?t:Sbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Obe=/^[\w./-]+$/});import JG from"node:process";function _R(){let{env:t}=JG,{TERM:e,TERM_PROGRAM:r}=t;return JG.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 YG=y(()=>{});var XG,QG,Rbe,Ibe,Pbe,Cbe,Dbe,tb,SQe,eZ=y(()=>{YG();XG={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"},QG={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"},Rbe={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"},Ibe={...XG,...QG},Pbe={...XG,...Rbe},Cbe=_R(),Dbe=Cbe?Ibe:Pbe,tb=Dbe,SQe=Object.entries(QG)});import Nbe from"node:tty";var jbe,be,$Qe,tZ,kQe,EQe,AQe,TQe,OQe,RQe,IQe,PQe,CQe,DQe,NQe,jQe,MQe,FQe,LQe,rb,zQe,UQe,qQe,BQe,HQe,GQe,ZQe,VQe,WQe,rZ,KQe,nZ,JQe,YQe,XQe,QQe,eet,tet,ret,net,iet,oet,set,bR=y(()=>{jbe=Nbe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!jbe)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}},$Qe=be(0,0),tZ=be(1,22),kQe=be(2,22),EQe=be(3,23),AQe=be(4,24),TQe=be(53,55),OQe=be(7,27),RQe=be(8,28),IQe=be(9,29),PQe=be(30,39),CQe=be(31,39),DQe=be(32,39),NQe=be(33,39),jQe=be(34,39),MQe=be(35,39),FQe=be(36,39),LQe=be(37,39),rb=be(90,39),zQe=be(40,49),UQe=be(41,49),qQe=be(42,49),BQe=be(43,49),HQe=be(44,49),GQe=be(45,49),ZQe=be(46,49),VQe=be(47,49),WQe=be(100,49),rZ=be(91,39),KQe=be(92,39),nZ=be(93,39),JQe=be(94,39),YQe=be(95,39),XQe=be(96,39),QQe=be(97,39),eet=be(101,49),tet=be(102,49),ret=be(103,49),net=be(104,49),iet=be(105,49),oet=be(106,49),set=be(107,49)});var iZ=y(()=>{bR();bR()});var aZ,Fbe,nb,oZ,Lbe,sZ,zbe,cZ=y(()=>{eZ();iZ();aZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Fbe(r),c=Lbe[t]({failed:o,reject:s,piped:n}),l=zbe[t]({reject:s});return`${rb(`[${a}]`)} ${rb(`[${i}]`)} ${l(c)} ${l(e)}`},Fbe=t=>`${nb(t.getHours(),2)}:${nb(t.getMinutes(),2)}:${nb(t.getSeconds(),2)}.${nb(t.getMilliseconds(),3)}`,nb=(t,e)=>String(t).padStart(e,"0"),oZ=({failed:t,reject:e})=>t?e?tb.cross:tb.warning:tb.tick,Lbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:oZ,duration:oZ},sZ=t=>t,zbe={command:()=>tZ,output:()=>sZ,ipc:()=>sZ,error:({reject:t})=>t?rZ:nZ,duration:()=>rb}});var lZ,Ube,qbe,uZ=y(()=>{ls();lZ=(t,e,r)=>{let n=VG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Ube(i,o,n)).filter(i=>i!==void 0).map(i=>qbe(i)).join("")},Ube=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},qbe=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as Nbe}from"node:util";var Ri,jbe,Mbe,Fbe,rb,Lbe,wl=y(()=>{X_();rZ();iZ();Ri=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=jbe({type:t,result:i,verboseInfo:n}),s=Mbe(e,o),a=nZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},jbe=({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}),Mbe=(t,e)=>t.split(` -`).map(r=>Fbe({...e,message:r})),Fbe=t=>({verboseLine:tZ(t),verboseObject:t}),rb=t=>{let e=typeof t=="string"?t:Nbe(t);return Hf(e).replaceAll(" "," ".repeat(Lbe))},Lbe=2});var oZ,sZ=y(()=>{ls();wl();oZ=(t,e)=>{vl(e)&&Ri({type:"command",verboseMessage:t,verboseInfo:e})}});var aZ,zbe,Ube,qbe,cZ=y(()=>{ls();aZ=(t,e,r)=>{qbe(t);let n=zbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},zbe=t=>vl({verbose:t})?Ube++:void 0,Ube=0n,qbe=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)&&!J_(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 lZ}from"node:process";var nb,_R,ib=y(()=>{nb=()=>lZ.bigint(),_R=t=>Number(lZ.bigint()-t)/1e6});var ob,bR=y(()=>{sZ();cZ();ib();X_();vo();ob=(t,e,r)=>{let n=nb(),{command:i,escapedCommand:o}=qG(t,e),s=fR(r,"verbose"),a=aZ(s,o,{...r});return oZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var mZ=v((fet,pZ)=>{pZ.exports=fZ;fZ.sync=Hbe;var uZ=Ge("fs");function Bbe(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{_Z.exports=gZ;gZ.sync=Gbe;var hZ=Ge("fs");function gZ(t,e,r){hZ.stat(t,function(n,i){r(n,n?!1:yZ(i,e))})}function Gbe(t,e){return yZ(hZ.statSync(t),e)}function yZ(t,e){return t.isFile()&&Zbe(t,e)}function Zbe(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 SZ=v((het,vZ)=>{var met=Ge("fs"),sb;process.platform==="win32"||global.TESTING_WINDOWS?sb=mZ():sb=bZ();vZ.exports=vR;vR.sync=Vbe;function vR(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){vR(t,e||{},function(o,s){o?i(o):n(s)})})}sb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Vbe(t,e){try{return sb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var TZ=v((get,AZ)=>{var xl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",wZ=Ge("path"),Wbe=xl?";":":",xZ=SZ(),$Z=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),kZ=(t,e)=>{let r=e.colon||Wbe,n=t.match(/\//)||xl&&t.match(/\\/)?[""]:[...xl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=xl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=xl?i.split(r):[""];return xl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},EZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=kZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d($Z(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=wZ.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];xZ(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)},Kbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=kZ(t,e),o=[];for(let s=0;s{"use strict";var OZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};SR.exports=OZ;SR.exports.default=OZ});var DZ=v((_et,CZ)=>{"use strict";var IZ=Ge("path"),Jbe=TZ(),Ybe=RZ();function PZ(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=Jbe.sync(t.command,{path:r[Ybe({env:r})],pathExt:e?IZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=IZ.resolve(i?t.options.cwd:"",s)),s}function Xbe(t){return PZ(t)||PZ(t,!0)}CZ.exports=Xbe});var NZ=v((bet,xR)=>{"use strict";var wR=/([()\][%!^"`<>&|;, *?])/g;function Qbe(t){return t=t.replace(wR,"^$1"),t}function eve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(wR,"^$1"),e&&(t=t.replace(wR,"^$1")),t}xR.exports.command=Qbe;xR.exports.argument=eve});var MZ=v((vet,jZ)=>{"use strict";jZ.exports=/^#!(.*)/});var LZ=v((wet,FZ)=>{"use strict";var tve=MZ();FZ.exports=(t="")=>{let e=t.match(tve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var UZ=v((xet,zZ)=>{"use strict";var $R=Ge("fs"),rve=LZ();function nve(t){let r=Buffer.alloc(150),n;try{n=$R.openSync(t,"r"),$R.readSync(n,r,0,150,0),$R.closeSync(n)}catch{}return rve(r.toString())}zZ.exports=nve});var GZ=v(($et,HZ)=>{"use strict";var ive=Ge("path"),qZ=DZ(),BZ=NZ(),ove=UZ(),sve=process.platform==="win32",ave=/\.(?:com|exe)$/i,cve=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function lve(t){t.file=qZ(t);let e=t.file&&ove(t.file);return e?(t.args.unshift(t.file),t.command=e,qZ(t)):t.file}function uve(t){if(!sve)return t;let e=lve(t),r=!ave.test(e);if(t.options.forceShell||r){let n=cve.test(e);t.command=ive.normalize(t.command),t.command=BZ.command(t.command),t.args=t.args.map(o=>BZ.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 dve(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:uve(n)}HZ.exports=dve});var WZ=v((ket,VZ)=>{"use strict";var kR=process.platform==="win32";function ER(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 fve(t,e){if(!kR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=ZZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function ZZ(t,e){return kR&&t===1&&!e.file?ER(e.original,"spawn"):null}function pve(t,e){return kR&&t===1&&!e.file?ER(e.original,"spawnSync"):null}VZ.exports={hookChildProcess:fve,verifyENOENT:ZZ,verifyENOENTSync:pve,notFoundError:ER}});var YZ=v((Eet,$l)=>{"use strict";var KZ=Ge("child_process"),AR=GZ(),TR=WZ();function JZ(t,e,r){let n=AR(t,e,r),i=KZ.spawn(n.command,n.args,n.options);return TR.hookChildProcess(i,n),i}function mve(t,e,r){let n=AR(t,e,r),i=KZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||TR.verifyENOENTSync(i.status,n),i}$l.exports=JZ;$l.exports.spawn=JZ;$l.exports.sync=mve;$l.exports._parse=AR;$l.exports._enoent=TR});function ab(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 XZ=y(()=>{});var QZ=y(()=>{});import{promisify as hve}from"node:util";import{execFile as gve,execFileSync as Iet}from"node:child_process";import e9 from"node:path";import{fileURLToPath as yve}from"node:url";function cb(t){return t instanceof URL?yve(t):t}function t9(t){return{*[Symbol.iterator](){let e=e9.resolve(cb(t)),r;for(;r!==e;)yield e,r=e,e=e9.resolve(e,"..")}}}var Det,Net,r9=y(()=>{QZ();Det=hve(gve);Net=10*1024*1024});import lb from"node:process";import Oa from"node:path";var _ve,bve,vve,n9,i9=y(()=>{XZ();r9();_ve=({cwd:t=lb.cwd(),path:e=lb.env[ab()],preferLocal:r=!0,execPath:n=lb.execPath,addExecPath:i=!0}={})=>{let o=Oa.resolve(cb(t)),s=[],a=e.split(Oa.delimiter);return r&&bve(s,a,o),i&&vve(s,a,n,o),e===""||e===Oa.delimiter?`${s.join(Oa.delimiter)}${e}`:[...s,e].join(Oa.delimiter)},bve=(t,e,r)=>{for(let n of t9(r)){let i=Oa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},vve=(t,e,r,n)=>{let i=Oa.resolve(n,cb(r),"..");e.includes(i)||t.push(i)},n9=({env:t=lb.env,...e}={})=>{t={...t};let r=ab({env:t});return e.path=t[r],t[r]=_ve(e),t}});var o9,Qn,s9,a9,c9,ub,Gf,Zf,Ra=y(()=>{o9=(t,e,r)=>{let n=r?Zf:Gf,i=t instanceof Qn?{}:{cause:t};return new n(e,i)},Qn=class extends Error{},s9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,c9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},a9=t=>ub(t)&&c9 in t,c9=Symbol("isExecaError"),ub=t=>Object.prototype.toString.call(t)==="[object Error]",Gf=class extends Error{};s9(Gf,Gf.name);Zf=class extends Error{};s9(Zf,Zf.name)});var l9,Sve,u9,d9,f9=y(()=>{l9=()=>{let t=d9-u9+1;return Array.from({length:t},Sve)},Sve=(t,e)=>({name:`SIGRT${e+1}`,number:u9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),u9=34,d9=64});var p9,m9=y(()=>{p9=[{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 wve}from"node:os";var OR,xve,h9=y(()=>{m9();f9();OR=()=>{let t=l9();return[...p9,...t].map(xve)},xve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=wve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as $ve}from"node:os";var kve,Eve,g9,Ave,Tve,Ove,Xet,y9=y(()=>{h9();kve=()=>{let t=OR();return Object.fromEntries(t.map(Eve))},Eve=({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}],g9=kve(),Ave=()=>{let t=OR(),e=65,r=Array.from({length:e},(n,i)=>Tve(i,t));return Object.assign({},...r)},Tve=(t,e)=>{let r=Ove(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}}},Ove=(t,e)=>{let r=e.find(({name:n})=>$ve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Xet=Ave()});import{constants as Vf}from"node:os";var b9,v9,S9,Rve,Ive,_9,Pve,RR,Cve,Dve,db,Wf=y(()=>{y9();b9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return S9(t,e)},v9=t=>t===0?t:S9(t,"`subprocess.kill()`'s argument"),S9=(t,e)=>{if(Number.isInteger(t))return Rve(t,e);if(typeof t=="string")return Pve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${RR()}`)},Rve=(t,e)=>{if(_9.has(t))return _9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${RR()}`)},Ive=()=>new Map(Object.entries(Vf.signals).reverse().map(([t,e])=>[e,t])),_9=Ive(),Pve=(t,e)=>{if(t in Vf.signals)return t;throw t.toUpperCase()in Vf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${RR()}`)},RR=()=>`Available signal names: ${Cve()}. -Available signal numbers: ${Dve()}.`,Cve=()=>Object.keys(Vf.signals).sort().map(t=>`'${t}'`).join(", "),Dve=()=>[...new Set(Object.values(Vf.signals).sort((t,e)=>t-e))].join(", "),db=t=>g9[t].description});import{setTimeout as Nve}from"node:timers/promises";var w9,jve,x9,Mve,Fve,Lve,IR,fb=y(()=>{Ra();Wf();w9=t=>{if(t===!1)return t;if(t===!0)return jve;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},jve=1e3*5,x9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Mve(s,a,r);Fve(l,n);let u=t(c);return Lve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Mve=(t,e,r)=>{let[n=r,i]=ub(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&&!ub(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:v9(n),error:i}},Fve=(t,e)=>{t!==void 0&&e.reject(t)},Lve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&IR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},IR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Nve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as zve}from"node:events";var pb,PR=y(()=>{pb=async(t,e)=>{t.aborted||await zve(t,"abort",{signal:e})}});var $9,k9,Uve,CR=y(()=>{PR();$9=({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)}`)},k9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Uve(t,e,n,i)],Uve=async(t,e,r,{signal:n})=>{throw await pb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var kl,qve,DR,E9,A9,mb,T9,O9,R9,I9,P9,C9,Bve,Hve,Gve,ei,Zve,us,El,Al=y(()=>{kl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{qve(t,e,r),DR(t,e,n)},qve=(t,e,r)=>{if(!r)throw new Error(`${ei(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},DR=(t,e,r)=>{if(!r)throw new Error(`${ei(t,e)} cannot be used: the ${us(e)} has already exited or disconnected.`)},E9=t=>{throw new Error(`${ei("getOneMessage",t)} could not complete: the ${us(t)} exited or disconnected.`)},A9=t=>{throw new Error(`${ei("sendMessage",t)} failed: the ${us(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as Bbe}from"node:util";var Pi,Hbe,Gbe,Zbe,ib,Vbe,El=y(()=>{eb();cZ();uZ();Pi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Hbe({type:t,result:i,verboseInfo:n}),s=Gbe(e,o),a=lZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Hbe=({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}),Gbe=(t,e)=>t.split(` +`).map(r=>Zbe({...e,message:r})),Zbe=t=>({verboseLine:aZ(t),verboseObject:t}),ib=t=>{let e=typeof t=="string"?t:Bbe(t);return Hf(e).replaceAll(" "," ".repeat(Vbe))},Vbe=2});var dZ,fZ=y(()=>{ls();El();dZ=(t,e)=>{$l(e)&&Pi({type:"command",verboseMessage:t,verboseInfo:e})}});var pZ,Wbe,Kbe,Jbe,mZ=y(()=>{ls();pZ=(t,e,r)=>{Jbe(t);let n=Wbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Wbe=t=>$l({verbose:t})?Kbe++:void 0,Kbe=0n,Jbe=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(!Q_.includes(e)&&!X_(e)){let r=Q_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as hZ}from"node:process";var ob,vR,sb=y(()=>{ob=()=>hZ.bigint(),vR=t=>Number(hZ.bigint()-t)/1e6});var ab,SR=y(()=>{fZ();mZ();sb();eb();So();ab=(t,e,r)=>{let n=ob(),{command:i,escapedCommand:o}=WG(t,e),s=mR(r,"verbose"),a=pZ(s,o,{...r});return dZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var vZ=v((Det,bZ)=>{bZ.exports=_Z;_Z.sync=Xbe;var gZ=Ge("fs");function Ybe(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{$Z.exports=wZ;wZ.sync=Qbe;var SZ=Ge("fs");function wZ(t,e,r){SZ.stat(t,function(n,i){r(n,n?!1:xZ(i,e))})}function Qbe(t,e){return xZ(SZ.statSync(t),e)}function xZ(t,e){return t.isFile()&&eve(t,e)}function eve(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 AZ=v((Met,EZ)=>{var jet=Ge("fs"),cb;process.platform==="win32"||global.TESTING_WINDOWS?cb=vZ():cb=kZ();EZ.exports=wR;wR.sync=tve;function wR(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){wR(t,e||{},function(o,s){o?i(o):n(s)})})}cb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function tve(t,e){try{return cb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var DZ=v((Fet,CZ)=>{var Al=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",TZ=Ge("path"),rve=Al?";":":",OZ=AZ(),RZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),IZ=(t,e)=>{let r=e.colon||rve,n=t.match(/\//)||Al&&t.match(/\\/)?[""]:[...Al?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Al?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Al?i.split(r):[""];return Al&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},PZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=IZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(RZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=TZ.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];OZ(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)},nve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=IZ(t,e),o=[];for(let s=0;s{"use strict";var NZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};xR.exports=NZ;xR.exports.default=NZ});var zZ=v((zet,LZ)=>{"use strict";var MZ=Ge("path"),ive=DZ(),ove=jZ();function FZ(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=ive.sync(t.command,{path:r[ove({env:r})],pathExt:e?MZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=MZ.resolve(i?t.options.cwd:"",s)),s}function sve(t){return FZ(t)||FZ(t,!0)}LZ.exports=sve});var UZ=v((Uet,kR)=>{"use strict";var $R=/([()\][%!^"`<>&|;, *?])/g;function ave(t){return t=t.replace($R,"^$1"),t}function cve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace($R,"^$1"),e&&(t=t.replace($R,"^$1")),t}kR.exports.command=ave;kR.exports.argument=cve});var BZ=v((qet,qZ)=>{"use strict";qZ.exports=/^#!(.*)/});var GZ=v((Bet,HZ)=>{"use strict";var lve=BZ();HZ.exports=(t="")=>{let e=t.match(lve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var VZ=v((Het,ZZ)=>{"use strict";var ER=Ge("fs"),uve=GZ();function dve(t){let r=Buffer.alloc(150),n;try{n=ER.openSync(t,"r"),ER.readSync(n,r,0,150,0),ER.closeSync(n)}catch{}return uve(r.toString())}ZZ.exports=dve});var YZ=v((Get,JZ)=>{"use strict";var fve=Ge("path"),WZ=zZ(),KZ=UZ(),pve=VZ(),mve=process.platform==="win32",hve=/\.(?:com|exe)$/i,gve=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function yve(t){t.file=WZ(t);let e=t.file&&pve(t.file);return e?(t.args.unshift(t.file),t.command=e,WZ(t)):t.file}function _ve(t){if(!mve)return t;let e=yve(t),r=!hve.test(e);if(t.options.forceShell||r){let n=gve.test(e);t.command=fve.normalize(t.command),t.command=KZ.command(t.command),t.args=t.args.map(o=>KZ.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 bve(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:_ve(n)}JZ.exports=bve});var e9=v((Zet,QZ)=>{"use strict";var AR=process.platform==="win32";function TR(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 vve(t,e){if(!AR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=XZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function XZ(t,e){return AR&&t===1&&!e.file?TR(e.original,"spawn"):null}function Sve(t,e){return AR&&t===1&&!e.file?TR(e.original,"spawnSync"):null}QZ.exports={hookChildProcess:vve,verifyENOENT:XZ,verifyENOENTSync:Sve,notFoundError:TR}});var n9=v((Vet,Tl)=>{"use strict";var t9=Ge("child_process"),OR=YZ(),RR=e9();function r9(t,e,r){let n=OR(t,e,r),i=t9.spawn(n.command,n.args,n.options);return RR.hookChildProcess(i,n),i}function wve(t,e,r){let n=OR(t,e,r),i=t9.spawnSync(n.command,n.args,n.options);return i.error=i.error||RR.verifyENOENTSync(i.status,n),i}Tl.exports=r9;Tl.exports.spawn=r9;Tl.exports.sync=wve;Tl.exports._parse=OR;Tl.exports._enoent=RR});function lb(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 i9=y(()=>{});var o9=y(()=>{});import{promisify as xve}from"node:util";import{execFile as $ve,execFileSync as Xet}from"node:child_process";import s9 from"node:path";import{fileURLToPath as kve}from"node:url";function ub(t){return t instanceof URL?kve(t):t}function a9(t){return{*[Symbol.iterator](){let e=s9.resolve(ub(t)),r;for(;r!==e;)yield e,r=e,e=s9.resolve(e,"..")}}}var ttt,rtt,c9=y(()=>{o9();ttt=xve($ve);rtt=10*1024*1024});import db from"node:process";import Oa from"node:path";var Eve,Ave,Tve,l9,u9=y(()=>{i9();c9();Eve=({cwd:t=db.cwd(),path:e=db.env[lb()],preferLocal:r=!0,execPath:n=db.execPath,addExecPath:i=!0}={})=>{let o=Oa.resolve(ub(t)),s=[],a=e.split(Oa.delimiter);return r&&Ave(s,a,o),i&&Tve(s,a,n,o),e===""||e===Oa.delimiter?`${s.join(Oa.delimiter)}${e}`:[...s,e].join(Oa.delimiter)},Ave=(t,e,r)=>{for(let n of a9(r)){let i=Oa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Tve=(t,e,r,n)=>{let i=Oa.resolve(n,ub(r),"..");e.includes(i)||t.push(i)},l9=({env:t=db.env,...e}={})=>{t={...t};let r=lb({env:t});return e.path=t[r],t[r]=Eve(e),t}});var d9,ei,f9,p9,m9,fb,Gf,Zf,Ra=y(()=>{d9=(t,e,r)=>{let n=r?Zf:Gf,i=t instanceof ei?{}:{cause:t};return new n(e,i)},ei=class extends Error{},f9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,m9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},p9=t=>fb(t)&&m9 in t,m9=Symbol("isExecaError"),fb=t=>Object.prototype.toString.call(t)==="[object Error]",Gf=class extends Error{};f9(Gf,Gf.name);Zf=class extends Error{};f9(Zf,Zf.name)});var h9,Ove,g9,y9,_9=y(()=>{h9=()=>{let t=y9-g9+1;return Array.from({length:t},Ove)},Ove=(t,e)=>({name:`SIGRT${e+1}`,number:g9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),g9=34,y9=64});var b9,v9=y(()=>{b9=[{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 Rve}from"node:os";var IR,Ive,S9=y(()=>{v9();_9();IR=()=>{let t=h9();return[...b9,...t].map(Ive)},Ive=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Rve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Pve}from"node:os";var Cve,Dve,w9,Nve,jve,Mve,btt,x9=y(()=>{S9();Cve=()=>{let t=IR();return Object.fromEntries(t.map(Dve))},Dve=({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}],w9=Cve(),Nve=()=>{let t=IR(),e=65,r=Array.from({length:e},(n,i)=>jve(i,t));return Object.assign({},...r)},jve=(t,e)=>{let r=Mve(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}}},Mve=(t,e)=>{let r=e.find(({name:n})=>Pve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},btt=Nve()});import{constants as Vf}from"node:os";var k9,E9,A9,Fve,Lve,$9,zve,PR,Uve,qve,pb,Wf=y(()=>{x9();k9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return A9(t,e)},E9=t=>t===0?t:A9(t,"`subprocess.kill()`'s argument"),A9=(t,e)=>{if(Number.isInteger(t))return Fve(t,e);if(typeof t=="string")return zve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${PR()}`)},Fve=(t,e)=>{if($9.has(t))return $9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${PR()}`)},Lve=()=>new Map(Object.entries(Vf.signals).reverse().map(([t,e])=>[e,t])),$9=Lve(),zve=(t,e)=>{if(t in Vf.signals)return t;throw t.toUpperCase()in Vf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${PR()}`)},PR=()=>`Available signal names: ${Uve()}. +Available signal numbers: ${qve()}.`,Uve=()=>Object.keys(Vf.signals).sort().map(t=>`'${t}'`).join(", "),qve=()=>[...new Set(Object.values(Vf.signals).sort((t,e)=>t-e))].join(", "),pb=t=>w9[t].description});import{setTimeout as Bve}from"node:timers/promises";var T9,Hve,O9,Gve,Zve,Vve,CR,mb=y(()=>{Ra();Wf();T9=t=>{if(t===!1)return t;if(t===!0)return Hve;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},Hve=1e3*5,O9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Gve(s,a,r);Zve(l,n);let u=t(c);return Vve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Gve=(t,e,r)=>{let[n=r,i]=fb(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&&!fb(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:E9(n),error:i}},Zve=(t,e)=>{t!==void 0&&e.reject(t)},Vve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&CR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},CR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Bve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Wve}from"node:events";var hb,DR=y(()=>{hb=async(t,e)=>{t.aborted||await Wve(t,"abort",{signal:e})}});var R9,I9,Kve,NR=y(()=>{DR();R9=({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)}`)},I9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Kve(t,e,n,i)],Kve=async(t,e,r,{signal:n})=>{throw await hb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Ol,Jve,jR,P9,C9,gb,D9,N9,j9,M9,F9,L9,Yve,Xve,Qve,ti,eSe,us,Rl,Il=y(()=>{Ol=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Jve(t,e,r),jR(t,e,n)},Jve=(t,e,r)=>{if(!r)throw new Error(`${ti(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},jR=(t,e,r)=>{if(!r)throw new Error(`${ti(t,e)} cannot be used: the ${us(e)} has already exited or disconnected.`)},P9=t=>{throw new Error(`${ti("getOneMessage",t)} could not complete: the ${us(t)} exited or disconnected.`)},C9=t=>{throw new Error(`${ti("sendMessage",t)} failed: the ${us(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([ - ${ei("getOneMessage",t)}, - ${ei("sendMessage",t,"message, {strict: true}")}, -]);`)},mb=(t,e)=>new Error(`${ei("sendMessage",e)} failed when sending an acknowledgment response to the ${us(e)}.`,{cause:t}),T9=t=>{throw new Error(`${ei("sendMessage",t)} failed: the ${us(t)} is not listening to incoming messages.`)},O9=t=>{throw new Error(`${ei("sendMessage",t)} failed: the ${us(t)} exited without listening to incoming messages.`)},R9=()=>new Error(`\`cancelSignal\` aborted: the ${us(!0)} disconnected.`),I9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},P9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ei(e,r)} cannot be used: the ${us(r)} is disconnecting.`,{cause:t})},C9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Bve(t))throw new Error(`${ei(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Bve=({code:t,message:e})=>Hve.has(t)||Gve.some(r=>e.includes(r)),Hve=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Gve=["could not be cloned","circular structure","call stack size exceeded"],ei=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Zve(e)}${t}(${r})`,Zve=t=>t?"":"subprocess.",us=t=>t?"parent process":"subprocess",El=t=>{t.connected&&t.disconnect()}});var Ii,Tl=y(()=>{Ii=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var gb,Ol,Pi,D9,Vve,Wve,N9,Kve,j9,Kf,hb,ds=y(()=>{vo();gb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Pi.get(t),o=D9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(N9(o,e,n,!0));return s},Ol=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Pi.get(t),o=D9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(N9(o,e,n,!1));return s},Pi=new WeakMap,D9=(t,e,r)=>{let n=Vve(e,r);return Wve(n,e,r,t),n},Vve=(t,e)=>{let r=pR(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(`"${Kf(e)}" must not be "${t}". + ${ti("getOneMessage",t)}, + ${ti("sendMessage",t,"message, {strict: true}")}, +]);`)},gb=(t,e)=>new Error(`${ti("sendMessage",e)} failed when sending an acknowledgment response to the ${us(e)}.`,{cause:t}),D9=t=>{throw new Error(`${ti("sendMessage",t)} failed: the ${us(t)} is not listening to incoming messages.`)},N9=t=>{throw new Error(`${ti("sendMessage",t)} failed: the ${us(t)} exited without listening to incoming messages.`)},j9=()=>new Error(`\`cancelSignal\` aborted: the ${us(!0)} disconnected.`),M9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},F9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ti(e,r)} cannot be used: the ${us(r)} is disconnecting.`,{cause:t})},L9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Yve(t))throw new Error(`${ti(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Yve=({code:t,message:e})=>Xve.has(t)||Qve.some(r=>e.includes(r)),Xve=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Qve=["could not be cloned","circular structure","call stack size exceeded"],ti=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${eSe(e)}${t}(${r})`,eSe=t=>t?"":"subprocess.",us=t=>t?"parent process":"subprocess",Rl=t=>{t.connected&&t.disconnect()}});var Ci,Pl=y(()=>{Ci=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var _b,Cl,Di,z9,tSe,rSe,U9,nSe,q9,Kf,yb,ds=y(()=>{So();_b=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=z9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(U9(o,e,n,!0));return s},Cl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=z9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(U9(o,e,n,!1));return s},Di=new WeakMap,z9=(t,e,r)=>{let n=tSe(e,r);return rSe(n,e,r,t),n},tSe=(t,e)=>{let r=hR(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(`"${Kf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},Wve=(t,e,r,n)=>{let i=n[j9(t)];if(i===void 0)throw new TypeError(`"${Kf(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(`"${Kf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Kf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},N9=(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}=Kve(t,r);return`The "${i}: ${hb(o)}" option is incompatible with using "${Kf(n)}: ${hb(e)}". -Please set this option with "pipe" instead.`},Kve=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=j9(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]}},j9=t=>t==="all"?1:t,Kf=t=>t?"to":"from",hb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Jve}from"node:events";var Ia,yb=y(()=>{Ia=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Jve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var _b,NR,bb,jR,M9,F9,Jf=y(()=>{_b=(t,e)=>{e&&NR(t)},NR=t=>{t.refCounted()},bb=(t,e)=>{e&&jR(t)},jR=t=>{t.unrefCounted()},M9=(t,e)=>{e&&(jR(t),jR(t))},F9=(t,e)=>{e&&(NR(t),NR(t))}});import{once as Yve}from"node:events";import{scheduler as Xve}from"node:timers/promises";var L9,z9,vb,U9=y(()=>{wb();Jf();Sb();xb();L9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(B9(i)||G9(i))return;vb.has(t)||vb.set(t,[]);let o=vb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await H9(t,n,i),await Xve.yield();let s=await q9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},z9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{MR();let o=vb.get(t);for(;o?.length>0;)await Yve(n,"message:done");t.removeListener("message",i),F9(e,r),n.connected=!1,n.emit("disconnect")},vb=new WeakMap});import{EventEmitter as Qve}from"node:events";var fs,$b,eSe,kb,Yf=y(()=>{U9();Jf();fs=(t,e,r)=>{if($b.has(t))return $b.get(t);let n=new Qve;return n.connected=!0,$b.set(t,n),eSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},$b=new WeakMap,eSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=L9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",z9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),M9(r,n)},kb=t=>{let e=$b.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as tSe}from"node:events";var Z9,rSe,V9,q9,B9,W9,Eb,nSe,Ab,K9,Sb=y(()=>{Tl();yb();Rb();Al();Yf();wb();Z9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=fs(t,e,r),s=Tb(t,o);return{id:rSe++,type:Ab,message:n,hasListeners:s}},rSe=0n,V9=(t,e)=>{if(!(e?.type!==Ab||e.hasListeners))for(let{id:r}of t)r!==void 0&&Eb[r].resolve({isDeadlock:!0,hasListeners:!1})},q9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Ab||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:K9,message:Tb(e,i)};try{await Ob({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},B9=t=>{if(t?.type!==K9)return!1;let{id:e,message:r}=t;return Eb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},W9=async(t,e,r)=>{if(t?.type!==Ab)return;let n=Ii();Eb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,nSe(e,r,i)]);o&&A9(r),s||T9(r)}finally{i.abort(),delete Eb[t.id]}},Eb={},nSe=async(t,e,{signal:r})=>{Ia(t,1,r),await tSe(t,"disconnect",{signal:r}),O9(e)},Ab="execa:ipc:request",K9="execa:ipc:response"});var J9,Y9,H9,Xf,Tb,iSe,wb=y(()=>{Tl();vo();ds();Sb();J9=(t,e,r)=>{Xf.has(t)||Xf.set(t,new Set);let n=Xf.get(t),i=Ii(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},Y9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},H9=async(t,e,r)=>{for(;!Tb(t,e)&&Xf.get(t)?.size>0;){let n=[...Xf.get(t)];V9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Xf=new WeakMap,Tb=(t,e)=>e.listenerCount("message")>iSe(t),iSe=t=>Pi.has(t)&&!bo(Pi.get(t).options.buffer,"ipc")?1:0});import{promisify as oSe}from"node:util";var Ob,sSe,LR,aSe,FR,Rb=y(()=>{Al();wb();Sb();Ob=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return kl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),sSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},sSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=Z9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=J9(t,s,o);try{await LR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw El(t),c}finally{Y9(a)}},LR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=aSe(t);try{await Promise.all([W9(n,t,r),o(n)])}catch(s){throw P9({error:s,methodName:e,isSubprocess:r}),C9({error:s,methodName:e,isSubprocess:r,message:i}),s}},aSe=t=>{if(FR.has(t))return FR.get(t);let e=oSe(t.send.bind(t));return FR.set(t,e),e},FR=new WeakMap});import{scheduler as cSe}from"node:timers/promises";var Q9,eV,lSe,X9,G9,tV,MR,zR,xb=y(()=>{Rb();Yf();Al();Q9=(t,e)=>{let r="cancelSignal";return DR(r,!1,t.connected),LR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:tV,message:e},message:e})},eV=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await lSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),zR.signal),lSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!X9){if(X9=!0,!n){I9();return}if(e===null){MR();return}fs(t,e,r),await cSe.yield()}},X9=!1,G9=t=>t?.type!==tV?!1:(zR.abort(t.message),!0),tV="execa:ipc:cancel",MR=()=>{zR.abort(R9())},zR=new AbortController});var rV,nV,uSe,dSe,UR=y(()=>{PR();xb();fb();rV=({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.")}},nV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[uSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],uSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await pb(e,i);let o=dSe(e);throw await Q9(t,o),IR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},dSe=({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 fSe}from"node:timers/promises";var iV,oV,pSe,qR=y(()=>{Ra();iV=({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})`)},oV=(t,e,r,n)=>e===0||e===void 0?[]:[pSe(t,e,r,n)],pSe=async(t,e,r,{signal:n})=>{throw await fSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Qn}});import{execPath as mSe,execArgv as hSe}from"node:process";import sV from"node:path";var aV,cV,BR=y(()=>{bl();aV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},cV=(t,e,{node:r=!1,nodePath:n=mSe,nodeOptions:i=hSe.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=_l(n,'The "nodePath" option'),l=sV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(sV.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 gSe}from"node:v8";var lV,ySe,_Se,bSe,uV,HR=y(()=>{lV=({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`.");bSe[r](t)}},ySe=t=>{try{gSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},_Se=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},bSe={advanced:ySe,json:_Se},uV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var fV,vSe,nn,GR,SSe,dV,Ib,Pa=y(()=>{fV=({encoding:t})=>{if(GR.has(t))return;let e=SSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Ib(t)}\`. -Please rename it to ${Ib(e)}.`);let r=[...GR].map(n=>Ib(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Ib(t)}\`. -Please rename it to one of: ${r}.`)},vSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),GR=new Set([...vSe,...nn]),SSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in dV)return dV[e];if(GR.has(e))return e},dV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Ib=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as wSe}from"node:fs";import xSe from"node:path";import $Se from"node:process";var pV,mV,hV,ZR=y(()=>{bl();pV=(t=mV())=>{let e=_l(t,'The "cwd" option');return xSe.resolve(e)},mV=()=>{try{return $Se.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},hV=(t,e)=>{if(e===mV())return t;let r;try{r=wSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},rSe=(t,e,r,n)=>{let i=n[q9(t)];if(i===void 0)throw new TypeError(`"${Kf(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(`"${Kf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Kf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},U9=(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}=nSe(t,r);return`The "${i}: ${yb(o)}" option is incompatible with using "${Kf(n)}: ${yb(e)}". +Please set this option with "pipe" instead.`},nSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=q9(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]}},q9=t=>t==="all"?1:t,Kf=t=>t?"to":"from",yb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as iSe}from"node:events";var Ia,bb=y(()=>{Ia=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),iSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var vb,MR,Sb,FR,B9,H9,Jf=y(()=>{vb=(t,e)=>{e&&MR(t)},MR=t=>{t.refCounted()},Sb=(t,e)=>{e&&FR(t)},FR=t=>{t.unrefCounted()},B9=(t,e)=>{e&&(FR(t),FR(t))},H9=(t,e)=>{e&&(MR(t),MR(t))}});import{once as oSe}from"node:events";import{scheduler as sSe}from"node:timers/promises";var G9,Z9,wb,V9=y(()=>{$b();Jf();xb();kb();G9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(K9(i)||Y9(i))return;wb.has(t)||wb.set(t,[]);let o=wb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await J9(t,n,i),await sSe.yield();let s=await W9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},Z9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{LR();let o=wb.get(t);for(;o?.length>0;)await oSe(n,"message:done");t.removeListener("message",i),H9(e,r),n.connected=!1,n.emit("disconnect")},wb=new WeakMap});import{EventEmitter as aSe}from"node:events";var fs,Eb,cSe,Ab,Yf=y(()=>{V9();Jf();fs=(t,e,r)=>{if(Eb.has(t))return Eb.get(t);let n=new aSe;return n.connected=!0,Eb.set(t,n),cSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Eb=new WeakMap,cSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=G9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",Z9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),B9(r,n)},Ab=t=>{let e=Eb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as lSe}from"node:events";var X9,uSe,Q9,W9,K9,eV,Tb,dSe,Ob,tV,xb=y(()=>{Pl();bb();Pb();Il();Yf();$b();X9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=fs(t,e,r),s=Rb(t,o);return{id:uSe++,type:Ob,message:n,hasListeners:s}},uSe=0n,Q9=(t,e)=>{if(!(e?.type!==Ob||e.hasListeners))for(let{id:r}of t)r!==void 0&&Tb[r].resolve({isDeadlock:!0,hasListeners:!1})},W9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Ob||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:tV,message:Rb(e,i)};try{await Ib({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},K9=t=>{if(t?.type!==tV)return!1;let{id:e,message:r}=t;return Tb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},eV=async(t,e,r)=>{if(t?.type!==Ob)return;let n=Ci();Tb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,dSe(e,r,i)]);o&&C9(r),s||D9(r)}finally{i.abort(),delete Tb[t.id]}},Tb={},dSe=async(t,e,{signal:r})=>{Ia(t,1,r),await lSe(t,"disconnect",{signal:r}),N9(e)},Ob="execa:ipc:request",tV="execa:ipc:response"});var rV,nV,J9,Xf,Rb,fSe,$b=y(()=>{Pl();So();ds();xb();rV=(t,e,r)=>{Xf.has(t)||Xf.set(t,new Set);let n=Xf.get(t),i=Ci(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},nV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},J9=async(t,e,r)=>{for(;!Rb(t,e)&&Xf.get(t)?.size>0;){let n=[...Xf.get(t)];Q9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Xf=new WeakMap,Rb=(t,e)=>e.listenerCount("message")>fSe(t),fSe=t=>Di.has(t)&&!vo(Di.get(t).options.buffer,"ipc")?1:0});import{promisify as pSe}from"node:util";var Ib,mSe,UR,hSe,zR,Pb=y(()=>{Il();$b();xb();Ib=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Ol({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),mSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},mSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=X9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=rV(t,s,o);try{await UR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Rl(t),c}finally{nV(a)}},UR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=hSe(t);try{await Promise.all([eV(n,t,r),o(n)])}catch(s){throw F9({error:s,methodName:e,isSubprocess:r}),L9({error:s,methodName:e,isSubprocess:r,message:i}),s}},hSe=t=>{if(zR.has(t))return zR.get(t);let e=pSe(t.send.bind(t));return zR.set(t,e),e},zR=new WeakMap});import{scheduler as gSe}from"node:timers/promises";var oV,sV,ySe,iV,Y9,aV,LR,qR,kb=y(()=>{Pb();Yf();Il();oV=(t,e)=>{let r="cancelSignal";return jR(r,!1,t.connected),UR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:aV,message:e},message:e})},sV=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await ySe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),qR.signal),ySe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!iV){if(iV=!0,!n){M9();return}if(e===null){LR();return}fs(t,e,r),await gSe.yield()}},iV=!1,Y9=t=>t?.type!==aV?!1:(qR.abort(t.message),!0),aV="execa:ipc:cancel",LR=()=>{qR.abort(j9())},qR=new AbortController});var cV,lV,_Se,bSe,BR=y(()=>{DR();kb();mb();cV=({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.")}},lV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[_Se({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],_Se=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await hb(e,i);let o=bSe(e);throw await oV(t,o),CR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},bSe=({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 vSe}from"node:timers/promises";var uV,dV,SSe,HR=y(()=>{Ra();uV=({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})`)},dV=(t,e,r,n)=>e===0||e===void 0?[]:[SSe(t,e,r,n)],SSe=async(t,e,r,{signal:n})=>{throw await vSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ei}});import{execPath as wSe,execArgv as xSe}from"node:process";import fV from"node:path";var pV,mV,GR=y(()=>{xl();pV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},mV=(t,e,{node:r=!1,nodePath:n=wSe,nodeOptions:i=xSe.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=wl(n,'The "nodePath" option'),l=fV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(fV.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 $Se}from"node:v8";var hV,kSe,ESe,ASe,gV,ZR=y(()=>{hV=({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`.");ASe[r](t)}},kSe=t=>{try{$Se(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},ESe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},ASe={advanced:kSe,json:ESe},gV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var _V,TSe,on,VR,OSe,yV,Cb,Pa=y(()=>{_V=({encoding:t})=>{if(VR.has(t))return;let e=OSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Cb(t)}\`. +Please rename it to ${Cb(e)}.`);let r=[...VR].map(n=>Cb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Cb(t)}\`. +Please rename it to one of: ${r}.`)},TSe=new Set(["utf8","utf16le"]),on=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),VR=new Set([...TSe,...on]),OSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in yV)return yV[e];if(VR.has(e))return e},yV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Cb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as RSe}from"node:fs";import ISe from"node:path";import PSe from"node:process";var bV,vV,SV,WR=y(()=>{xl();bV=(t=vV())=>{let e=wl(t,'The "cwd" option');return ISe.resolve(e)},vV=()=>{try{return PSe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},SV=(t,e)=>{if(e===vV())return t;let r;try{r=RSe(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 kSe from"node:path";import gV from"node:process";var yV,Pb,ESe,ASe,VR=y(()=>{yV=St(YZ(),1);i9();fb();Wf();CR();UR();qR();BR();HR();Pa();ZR();bl();vo();Pb=(t,e,r)=>{r.cwd=pV(r.cwd);let[n,i,o]=cV(t,e,r),{command:s,args:a,options:c}=yV.default._parse(n,i,o),l=zG(c),u=ESe(l);return iV(u),fV(u),lV(u),$9(u),rV(u),u.shell=cR(u.shell),u.env=ASe(u),u.killSignal=b9(u.killSignal),u.forceKillAfterDelay=w9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),gV.platform==="win32"&&kSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},ESe=({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}),ASe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...gV.env,...t}:t;return r||n?n9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Cb,WR=y(()=>{Cb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Rl(t){if(typeof t=="string")return TSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return OSe(t)}var TSe,OSe,_V,RSe,bV,ISe,KR=y(()=>{TSe=t=>t.at(-1)===_V?t.slice(0,t.at(-2)===bV?-2:-1):t,OSe=t=>t.at(-1)===RSe?t.subarray(0,t.at(-2)===ISe?-2:-1):t,_V=` -`,RSe=_V.codePointAt(0),bV="\r",ISe=bV.codePointAt(0)});function ti(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 JR(t,{checkOpen:e=!0}={}){return ti(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 Ca(t,{checkOpen:e=!0}={}){return ti(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 YR(t,e){return JR(t,e)&&Ca(t,e)}var Da=y(()=>{});function vV(){return this[QR].next()}function SV(t){return this[QR].return(t)}function eI({preventCancel:t=!1}={}){let e=this.getReader(),r=new XR(e,t),n=Object.create(CSe);return n[QR]=r,n}var PSe,XR,QR,CSe,wV=y(()=>{PSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),XR=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}}},QR=Symbol();Object.defineProperty(vV,"name",{value:"next"});Object.defineProperty(SV,"name",{value:"return"});CSe=Object.create(PSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:vV},return:{enumerable:!0,configurable:!0,writable:!0,value:SV}})});var xV=y(()=>{});var $V=y(()=>{wV();xV()});var kV,DSe,NSe,jSe,Qf,tI=y(()=>{Da();$V();kV=t=>{if(Ca(t,{checkOpen:!1})&&Qf.on!==void 0)return NSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(DSe.call(t)==="[object ReadableStream]")return eI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:DSe}=Object.prototype,NSe=async function*(t){let e=new AbortController,r={};jSe(t,e,r);try{for await(let[n]of Qf.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()}},jSe=async(t,e,r)=>{try{await Qf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Qf={}});var Il,MSe,TV,EV,FSe,AV,Ci,ep=y(()=>{tI();Il=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=kV(t),u=e();u.length=0;try{for await(let d of l){let f=FSe(d),p=r[f](d,u);TV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return MSe({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}},MSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&TV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},TV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){EV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&EV(c,e,i,o),new Ci},EV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},FSe=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=AV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&AV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:AV}=Object.prototype,Ci=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var So,tp,Db,Nb,jb,Mb=y(()=>{So=t=>t,tp=()=>{},Db=({contents:t})=>t,Nb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},jb=t=>t.length});async function Fb(t,e){return Il(t,qSe,e)}var LSe,zSe,USe,qSe,OV=y(()=>{ep();Mb();LSe=()=>({contents:[]}),zSe=()=>1,USe=(t,{contents:e})=>(e.push(t),e),qSe={init:LSe,convertChunk:{string:So,buffer:So,arrayBuffer:So,dataView:So,typedArray:So,others:So},getSize:zSe,truncateChunk:tp,addChunk:USe,getFinalChunk:tp,finalize:Db}});async function Lb(t,e){return Il(t,YSe,e)}var BSe,HSe,GSe,RV,IV,ZSe,VSe,WSe,KSe,CV,PV,JSe,DV,YSe,NV=y(()=>{ep();Mb();BSe=()=>({contents:new ArrayBuffer(0)}),HSe=t=>GSe.encode(t),GSe=new TextEncoder,RV=t=>new Uint8Array(t),IV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ZSe=(t,e)=>t.slice(0,e),VSe=(t,{contents:e,length:r},n)=>{let i=DV()?KSe(e,n):WSe(e,n);return new Uint8Array(i).set(t,r),i},WSe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(CV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},KSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:CV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},CV=t=>PV**Math.ceil(Math.log(t)/Math.log(PV)),PV=2,JSe=({contents:t,length:e})=>DV()?t:t.slice(0,e),DV=()=>"resize"in ArrayBuffer.prototype,YSe={init:BSe,convertChunk:{string:HSe,buffer:RV,arrayBuffer:RV,dataView:IV,typedArray:IV,others:Nb},getSize:jb,truncateChunk:ZSe,addChunk:VSe,getFinalChunk:tp,finalize:JSe}});async function Ub(t,e){return Il(t,rwe,e)}var XSe,zb,QSe,ewe,twe,rwe,jV=y(()=>{ep();Mb();XSe=()=>({contents:"",textDecoder:new TextDecoder}),zb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),QSe=(t,{contents:e})=>e+t,ewe=(t,e)=>t.slice(0,e),twe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},rwe={init:XSe,convertChunk:{string:So,buffer:zb,arrayBuffer:zb,dataView:zb,typedArray:zb,others:Nb},getSize:jb,truncateChunk:ewe,addChunk:QSe,getFinalChunk:twe,finalize:Db}});var MV=y(()=>{OV();NV();jV();ep()});import{on as nwe}from"node:events";import{finished as iwe}from"node:stream/promises";var qb=y(()=>{tI();MV();Object.assign(Qf,{on:nwe,finished:iwe})});var FV,owe,LV,zV,swe,UV,qV,Bb,Na=y(()=>{qb();_o();vo();FV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ci))throw t;if(o==="all")return t;let s=owe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},owe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",LV=(t,e,r)=>{if(e.length!==r)return;let n=new Ci;throw n.maxBufferInfo={fdNumber:"ipc"},n},zV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=swe(t,e);return`Command's ${r} was larger than ${n} ${i}`},swe=(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=bo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:K_(r),threshold:i,unit:n}},UV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Bb(r)),qV=(t,e,r)=>{if(!e)return t;let n=Bb(r);return t.length>n?t.slice(0,n):t},Bb=([,t])=>t});import{inspect as awe}from"node:util";var HV,cwe,lwe,uwe,dwe,fwe,BV,GV=y(()=>{KR();rn();ZR();X_();Na();Wf();Ra();HV=({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=cwe({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=uwe(n,b),w=x===void 0?"":` -${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>dwe(D)).join(` -`)].map(D=>Hf(Rl(fwe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:A}},cwe=({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=lwe(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?`${zV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${db(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},lwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",uwe=(t,e)=>{if(t instanceof Qn)return;let r=a9(t)?t.originalMessage:String(t?.message??t),n=Hf(hV(r,e));return n===""?void 0:n},dwe=t=>typeof t=="string"?t:awe(t),fwe=t=>Array.isArray(t)?t.map(e=>Rl(BV(e))).filter(Boolean).join(` -`):BV(t),BV=t=>typeof t=="string"?t:Ut(t)?V_(t):""});var Hb,Pl,rp,pwe,ZV,mwe,np=y(()=>{Wf();ib();Ra();GV();Hb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>ZV({command:t,escapedCommand:e,cwd:o,durationMs:_R(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:[]}),Pl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>rp({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}),rp=({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:O,signalDescription:T}=mwe(l,u),{originalMessage:A,shortMessage:D,message:$}=HV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),ie=o9(t,$,x);return Object.assign(ie,pwe({error:ie,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),ie},pwe=({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})=>ZV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:_R(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:[]}),ZV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),mwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:db(e);return{exitCode:r,signal:n,signalDescription:i}}});function hwe(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(VV(t*1e3)%1e3),nanoseconds:Math.trunc(VV(t*1e6)%1e3)}}function gwe(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 rI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return hwe(t);break}case"bigint":return gwe(t)}throw new TypeError("Expected a finite number or bigint")}var VV,WV=y(()=>{VV=t=>Number.isFinite(t)?t:0});function nI(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+bwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ywe(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?" "+_we(d,u):f;i.push(p)}},a=rI(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%vwe):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 ywe,_we,bwe,vwe,KV=y(()=>{WV();ywe=t=>t===0||t===0n,_we=(t,e)=>e===1||e===1n?t:`${t}s`,bwe=1e-7,vwe=24n*60n*60n*1000n});var JV,YV=y(()=>{wl();JV=(t,e)=>{t.failed&&Ri({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var XV,Swe,QV=y(()=>{KV();ls();wl();YV();XV=(t,e)=>{vl(e)&&(JV(t,e),Swe(t,e))},Swe=(t,e)=>{let r=`(done in ${nI(t.durationMs)})`;Ri({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Cl,Gb=y(()=>{QV();Cl=(t,e,{reject:r})=>{if(XV(t,e),t.failed&&r)throw t;return t}});var rW,wwe,xwe,nW,iW,eW,$we,iI,tW,ja,oW,kwe,Zb,sW,Ewe,Awe,oI,aW,Twe,cW,Vb,Owe,sI,Rwe,Iwe,lW,Tn,Wb,aI,uW,dW,ps,vr=y(()=>{Da();go();rn();rW=(t,e)=>ja(t)?"asyncGenerator":oW(t)?"generator":Zb(t)?"fileUrl":Ewe(t)?"filePath":Owe(t)?"webStream":ti(t,{checkOpen:!1})?"native":Ut(t)?"uint8Array":Rwe(t)?"asyncIterable":Iwe(t)?"iterable":sI(t)?nW({transform:t},e):kwe(t)?wwe(t,e):"native",wwe=(t,e)=>YR(t.transform,{checkOpen:!1})?xwe(t,e):sI(t.transform)?nW(t,e):$we(t,e),xwe=(t,e)=>(iW(t,e,"Duplex stream"),"duplex"),nW=(t,e)=>(iW(t,e,"web TransformStream"),"webTransform"),iW=({final:t,binary:e,objectMode:r},n,i)=>{eW(t,`${n}.final`,i),eW(e,`${n}.binary`,i),iI(r,`${n}.objectMode`)},eW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},$we=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!tW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(YR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(sI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!tW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return iI(r,`${i}.binary`),iI(n,`${i}.objectMode`),ja(t)||ja(e)?"asyncGenerator":"generator"},iI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},tW=t=>ja(t)||oW(t),ja=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",oW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",kwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Zb=t=>Object.prototype.toString.call(t)==="[object URL]",sW=t=>Zb(t)&&t.protocol!=="file:",Ewe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Awe.has(e))&&oI(t.file),Awe=new Set(["file","append"]),oI=t=>typeof t=="string",aW=(t,e)=>t==="native"&&typeof e=="string"&&!Twe.has(e),Twe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),cW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Vb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Owe=t=>cW(t)||Vb(t),sI=t=>cW(t?.readable)&&Vb(t?.writable),Rwe=t=>lW(t)&&typeof t[Symbol.asyncIterator]=="function",Iwe=t=>lW(t)&&typeof t[Symbol.iterator]=="function",lW=t=>typeof t=="object"&&t!==null,Tn=new Set(["generator","asyncGenerator","duplex","webTransform"]),Wb=new Set(["fileUrl","filePath","fileNumber"]),aI=new Set(["fileUrl","filePath"]),uW=new Set([...aI,"webStream","nodeStream"]),dW=new Set(["webTransform","duplex"]),ps={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 cI,Pwe,Cwe,fW,lI=y(()=>{vr();cI=(t,e,r,n)=>n==="output"?Pwe(t,e,r):Cwe(t,e,r),Pwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Cwe=(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}},fW=(t,e)=>{let r=t.findLast(({type:n})=>Tn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var pW,Dwe,Nwe,jwe,Mwe,Fwe,Lwe,mW=y(()=>{go();Pa();vr();lI();pW=(t,e,r,n)=>[...t.filter(({type:i})=>!Tn.has(i)),...Dwe(t,e,r,n)],Dwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Tn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Nwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Lwe(o,r)},Nwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?jwe({stdioItem:t,optionName:i}):e==="webTransform"?Mwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Fwe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),jwe=({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}}},Mwe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=cI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Fwe=({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}=Ot(e)?e:{transform:e},d=c||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=cI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Lwe=(t,e)=>e==="input"?t.reverse():t});import uI from"node:process";var hW,zwe,Uwe,Dl,dI,gW,qwe,Bwe,yW=y(()=>{Da();vr();hW=(t,e,r)=>{let n=t.map(i=>zwe(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)??Bwe},zwe=({type:t,value:e},r)=>Uwe[r]??gW[t](e),Uwe=["input","output","output"],Dl=()=>{},dI=()=>"input",gW={generator:Dl,asyncGenerator:Dl,fileUrl:Dl,filePath:Dl,iterable:dI,asyncIterable:dI,uint8Array:dI,webStream:t=>Vb(t)?"output":"input",nodeStream(t){return Ca(t,{checkOpen:!1})?JR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Dl,duplex:Dl,native(t){let e=qwe(t);if(e!==void 0)return e;if(ti(t,{checkOpen:!1}))return gW.nodeStream(t)}},qwe=t=>{if([0,uI.stdin].includes(t))return"input";if([1,2,uI.stdout,uI.stderr].includes(t))return"output"},Bwe="output"});var _W,bW=y(()=>{_W=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var vW,Hwe,Gwe,SW,Zwe,Vwe,wW=y(()=>{_o();bW();ls();vW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Hwe(t,n).map((a,c)=>SW(a,c));return o?Zwe(s,r,i):_W(s,e)},Hwe=(t,e)=>{if(t===void 0)return An.map(n=>e[n]);if(Gwe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${An.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,An.length);return Array.from({length:r},(n,i)=>t[i])},Gwe=t=>An.some(e=>t[e]!==void 0),SW=(t,e)=>Array.isArray(t)?t.map(r=>SW(r,e)):t??(e>=An.length?"ignore":"pipe"),Zwe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Sl(r,i)&&Vwe(n)?"ignore":n),Vwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Wwe}from"node:fs";import Kwe from"node:tty";var $W,Jwe,Ywe,Xwe,Qwe,xW,kW=y(()=>{Da();_o();rn();ds();$W=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Jwe({stdioItem:t,fdNumber:n,direction:i}):Qwe({stdioItem:t,fdNumber:n}),Jwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Ywe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ti(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Ywe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Xwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Kwe.isatty(i))throw new TypeError(`The \`${e}: ${hb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:yo(Wwe(i)),optionName:e}}},Xwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=W_.indexOf(t);if(r!==-1)return r},Qwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:xW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:xW(e,e,r),optionName:r}:ti(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,xW=(t,e,r)=>{let n=W_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var EW,exe,txe,rxe,nxe,AW=y(()=>{Da();rn();vr();EW=({input:t,inputFile:e},r)=>r===0?[...exe(t),...rxe(e)]:[],exe=t=>t===void 0?[]:[{type:txe(t),value:t,optionName:"input"}],txe=t=>{if(Ca(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ut(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},rxe=t=>t===void 0?[]:[{...nxe(t),optionName:"inputFile"}],nxe=t=>{if(Zb(t))return{type:"fileUrl",value:t};if(oI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var TW,OW,ixe,oxe,RW,sxe,axe,IW,PW=y(()=>{vr();TW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),OW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=ixe(i,t);if(s.length!==0){if(o){oxe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(uW.has(t))return RW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});dW.has(t)&&axe({otherStdioItems:s,type:t,value:e,optionName:r})}},ixe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),oxe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{aI.has(e)&&RW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},RW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>sxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return IW(s,n,e),i==="output"?o[0].stream:void 0},sxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,axe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);IW(i,n,e)},IW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${ps[r]} that is the same.`)}});var Kb,cxe,lxe,uxe,dxe,fxe,pxe,mxe,hxe,gxe,yxe,_xe,fI,bxe,Jb=y(()=>{_o();mW();lI();vr();yW();wW();kW();AW();PW();Kb=(t,e,r,n)=>{let o=vW(e,r,n).map((a,c)=>cxe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=gxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>bxe(a)),s},cxe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=K_(e),{stdioItems:o,isStdioArray:s}=lxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=hW(o,e,i),c=o.map(d=>$W({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=pW(c,i,a,r),u=fW(l,a);return hxe(l,u),{direction:a,objectMode:u,stdioItems:l}},lxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>uxe(c,n)),...EW(r,e)],s=TW(o),a=s.length>1;return dxe(s,a,n),pxe(s),{stdioItems:s,isStdioArray:a}},uxe=(t,e)=>({type:rW(t,e),value:t,optionName:e}),dxe=(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(fxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},fxe=new Set(["ignore","ipc"]),pxe=t=>{for(let e of t)mxe(e)},mxe=({type:t,value:e,optionName:r})=>{if(sW(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(aW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},hxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Wb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},gxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(yxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw fI(i),o}},yxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>_xe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},_xe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=OW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},fI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Xn(r)&&r.destroy()},bxe=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 CW}from"node:fs";var NW,Di,vxe,jW,DW,Sxe,MW=y(()=>{rn();Jb();vr();NW=(t,e)=>Kb(Sxe,t,e,!0),Di=({type:t,optionName:e})=>{jW(e,ps[t])},vxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&jW(t,`"${e}"`),{}),jW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},DW={generator(){},asyncGenerator:Di,webStream:Di,nodeStream:Di,webTransform:Di,duplex:Di,asyncIterable:Di,native:vxe},Sxe={input:{...DW,fileUrl:({value:t})=>({contents:[yo(CW(t))]}),filePath:({value:{file:t}})=>({contents:[yo(CW(t))]}),fileNumber:Di,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...DW,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 wo,pI,ip=y(()=>{KR();wo=(t,{stripFinalNewline:e},r)=>pI(e,r)&&t!==void 0&&!Array.isArray(t)?Rl(t):t,pI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Yb,hI,FW,LW,wxe,xxe,$xe,zW,kxe,mI,Exe,Axe,Txe,Xb=y(()=>{Yb=(t,e,r,n)=>t||r?void 0:LW(e,n),hI=(t,e,r)=>r?t.flatMap(n=>FW(n,e)):FW(t,e),FW=(t,e)=>{let{transform:r,final:n}=LW(e,{});return[...r(t),...n()]},LW=(t,e)=>(e.previousChunks="",{transform:wxe.bind(void 0,e,t),final:$xe.bind(void 0,e)}),wxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=mI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=mI(n,r.slice(i+1))),t.previousChunks=n},xxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),$xe=function*({previousChunks:t}){t.length>0&&(yield t)},zW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:kxe.bind(void 0,n)},kxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Exe:Txe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},mI=(t,e)=>`${t}${e}`,Exe={windowsNewline:`\r +${t}`}});import CSe from"node:path";import wV from"node:process";var xV,Db,DSe,NSe,KR=y(()=>{xV=St(n9(),1);u9();mb();Wf();NR();BR();HR();GR();ZR();Pa();WR();xl();So();Db=(t,e,r)=>{r.cwd=bV(r.cwd);let[n,i,o]=mV(t,e,r),{command:s,args:a,options:c}=xV.default._parse(n,i,o),l=ZG(c),u=DSe(l);return uV(u),_V(u),hV(u),R9(u),cV(u),u.shell=uR(u.shell),u.env=NSe(u),u.killSignal=k9(u.killSignal),u.forceKillAfterDelay=T9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!on.has(u.encoding)&&u.buffer[f]),wV.platform==="win32"&&CSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},DSe=({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}),NSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...wV.env,...t}:t;return r||n?l9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Nb,JR=y(()=>{Nb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Dl(t){if(typeof t=="string")return jSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return MSe(t)}var jSe,MSe,$V,FSe,kV,LSe,YR=y(()=>{jSe=t=>t.at(-1)===$V?t.slice(0,t.at(-2)===kV?-2:-1):t,MSe=t=>t.at(-1)===FSe?t.subarray(0,t.at(-2)===LSe?-2:-1):t,$V=` +`,FSe=$V.codePointAt(0),kV="\r",LSe=kV.codePointAt(0)});function ri(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 XR(t,{checkOpen:e=!0}={}){return ri(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 Ca(t,{checkOpen:e=!0}={}){return ri(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 QR(t,e){return XR(t,e)&&Ca(t,e)}var Da=y(()=>{});function EV(){return this[tI].next()}function AV(t){return this[tI].return(t)}function rI({preventCancel:t=!1}={}){let e=this.getReader(),r=new eI(e,t),n=Object.create(USe);return n[tI]=r,n}var zSe,eI,tI,USe,TV=y(()=>{zSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),eI=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}}},tI=Symbol();Object.defineProperty(EV,"name",{value:"next"});Object.defineProperty(AV,"name",{value:"return"});USe=Object.create(zSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:EV},return:{enumerable:!0,configurable:!0,writable:!0,value:AV}})});var OV=y(()=>{});var RV=y(()=>{TV();OV()});var IV,qSe,BSe,HSe,Qf,nI=y(()=>{Da();RV();IV=t=>{if(Ca(t,{checkOpen:!1})&&Qf.on!==void 0)return BSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(qSe.call(t)==="[object ReadableStream]")return rI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:qSe}=Object.prototype,BSe=async function*(t){let e=new AbortController,r={};HSe(t,e,r);try{for await(let[n]of Qf.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()}},HSe=async(t,e,r)=>{try{await Qf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Qf={}});var Nl,GSe,DV,PV,ZSe,CV,Ni,ep=y(()=>{nI();Nl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=IV(t),u=e();u.length=0;try{for await(let d of l){let f=ZSe(d),p=r[f](d,u);DV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return GSe({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}},GSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&DV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},DV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){PV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&PV(c,e,i,o),new Ni},PV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},ZSe=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=CV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&CV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:CV}=Object.prototype,Ni=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var wo,tp,jb,Mb,Fb,Lb=y(()=>{wo=t=>t,tp=()=>{},jb=({contents:t})=>t,Mb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Fb=t=>t.length});async function zb(t,e){return Nl(t,JSe,e)}var VSe,WSe,KSe,JSe,NV=y(()=>{ep();Lb();VSe=()=>({contents:[]}),WSe=()=>1,KSe=(t,{contents:e})=>(e.push(t),e),JSe={init:VSe,convertChunk:{string:wo,buffer:wo,arrayBuffer:wo,dataView:wo,typedArray:wo,others:wo},getSize:WSe,truncateChunk:tp,addChunk:KSe,getFinalChunk:tp,finalize:jb}});async function Ub(t,e){return Nl(t,owe,e)}var YSe,XSe,QSe,jV,MV,ewe,twe,rwe,nwe,LV,FV,iwe,zV,owe,UV=y(()=>{ep();Lb();YSe=()=>({contents:new ArrayBuffer(0)}),XSe=t=>QSe.encode(t),QSe=new TextEncoder,jV=t=>new Uint8Array(t),MV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ewe=(t,e)=>t.slice(0,e),twe=(t,{contents:e,length:r},n)=>{let i=zV()?nwe(e,n):rwe(e,n);return new Uint8Array(i).set(t,r),i},rwe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(LV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},nwe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:LV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},LV=t=>FV**Math.ceil(Math.log(t)/Math.log(FV)),FV=2,iwe=({contents:t,length:e})=>zV()?t:t.slice(0,e),zV=()=>"resize"in ArrayBuffer.prototype,owe={init:YSe,convertChunk:{string:XSe,buffer:jV,arrayBuffer:jV,dataView:MV,typedArray:MV,others:Mb},getSize:Fb,truncateChunk:ewe,addChunk:twe,getFinalChunk:tp,finalize:iwe}});async function Bb(t,e){return Nl(t,uwe,e)}var swe,qb,awe,cwe,lwe,uwe,qV=y(()=>{ep();Lb();swe=()=>({contents:"",textDecoder:new TextDecoder}),qb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),awe=(t,{contents:e})=>e+t,cwe=(t,e)=>t.slice(0,e),lwe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},uwe={init:swe,convertChunk:{string:wo,buffer:qb,arrayBuffer:qb,dataView:qb,typedArray:qb,others:Mb},getSize:Fb,truncateChunk:cwe,addChunk:awe,getFinalChunk:lwe,finalize:jb}});var BV=y(()=>{NV();UV();qV();ep()});import{on as dwe}from"node:events";import{finished as fwe}from"node:stream/promises";var Hb=y(()=>{nI();BV();Object.assign(Qf,{on:dwe,finished:fwe})});var HV,pwe,GV,ZV,mwe,VV,WV,Gb,Na=y(()=>{Hb();bo();So();HV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ni))throw t;if(o==="all")return t;let s=pwe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},pwe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",GV=(t,e,r)=>{if(e.length!==r)return;let n=new Ni;throw n.maxBufferInfo={fdNumber:"ipc"},n},ZV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=mwe(t,e);return`Command's ${r} was larger than ${n} ${i}`},mwe=(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=vo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:Y_(r),threshold:i,unit:n}},VV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Gb(r)),WV=(t,e,r)=>{if(!e)return t;let n=Gb(r);return t.length>n?t.slice(0,n):t},Gb=([,t])=>t});import{inspect as hwe}from"node:util";var JV,gwe,ywe,_we,bwe,vwe,KV,YV=y(()=>{YR();nn();WR();eb();Na();Wf();Ra();JV=({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=gwe({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=_we(n,b),w=x===void 0?"":` +${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>bwe(D)).join(` +`)].map(D=>Hf(Dl(vwe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:O,message:A}},gwe=({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=ywe(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?`${ZV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${pb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},ywe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",_we=(t,e)=>{if(t instanceof ei)return;let r=p9(t)?t.originalMessage:String(t?.message??t),n=Hf(SV(r,e));return n===""?void 0:n},bwe=t=>typeof t=="string"?t:hwe(t),vwe=t=>Array.isArray(t)?t.map(e=>Dl(KV(e))).filter(Boolean).join(` +`):KV(t),KV=t=>typeof t=="string"?t:qt(t)?K_(t):""});var Zb,jl,rp,Swe,XV,wwe,np=y(()=>{Wf();sb();Ra();YV();Zb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>XV({command:t,escapedCommand:e,cwd:o,durationMs:vR(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:[]}),jl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>rp({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}),rp=({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:O,signalDescription:T}=wwe(l,u),{originalMessage:A,shortMessage:D,message:$}=JV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),re=d9(t,$,x);return Object.assign(re,Swe({error:re,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),re},Swe=({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})=>XV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:vR(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:[]}),XV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),wwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:pb(e);return{exitCode:r,signal:n,signalDescription:i}}});function xwe(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(QV(t*1e3)%1e3),nanoseconds:Math.trunc(QV(t*1e6)%1e3)}}function $we(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 iI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return xwe(t);break}case"bigint":return $we(t)}throw new TypeError("Expected a finite number or bigint")}var QV,eW=y(()=>{QV=t=>Number.isFinite(t)?t:0});function oI(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+Awe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&kwe(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?" "+Ewe(d,u):f;i.push(p)}},a=iI(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%Twe):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 kwe,Ewe,Awe,Twe,tW=y(()=>{eW();kwe=t=>t===0||t===0n,Ewe=(t,e)=>e===1||e===1n?t:`${t}s`,Awe=1e-7,Twe=24n*60n*60n*1000n});var rW,nW=y(()=>{El();rW=(t,e)=>{t.failed&&Pi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var iW,Owe,oW=y(()=>{tW();ls();El();nW();iW=(t,e)=>{$l(e)&&(rW(t,e),Owe(t,e))},Owe=(t,e)=>{let r=`(done in ${oI(t.durationMs)})`;Pi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ml,Vb=y(()=>{oW();Ml=(t,e,{reject:r})=>{if(iW(t,e),t.failed&&r)throw t;return t}});var cW,Rwe,Iwe,lW,uW,sW,Pwe,sI,aW,ja,dW,Cwe,Wb,fW,Dwe,Nwe,aI,pW,jwe,mW,Kb,Mwe,cI,Fwe,Lwe,hW,On,Jb,lI,gW,yW,ps,Sr=y(()=>{Da();yo();nn();cW=(t,e)=>ja(t)?"asyncGenerator":dW(t)?"generator":Wb(t)?"fileUrl":Dwe(t)?"filePath":Mwe(t)?"webStream":ri(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Fwe(t)?"asyncIterable":Lwe(t)?"iterable":cI(t)?lW({transform:t},e):Cwe(t)?Rwe(t,e):"native",Rwe=(t,e)=>QR(t.transform,{checkOpen:!1})?Iwe(t,e):cI(t.transform)?lW(t,e):Pwe(t,e),Iwe=(t,e)=>(uW(t,e,"Duplex stream"),"duplex"),lW=(t,e)=>(uW(t,e,"web TransformStream"),"webTransform"),uW=({final:t,binary:e,objectMode:r},n,i)=>{sW(t,`${n}.final`,i),sW(e,`${n}.binary`,i),sI(r,`${n}.objectMode`)},sW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Pwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!aW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(QR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(cI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!aW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return sI(r,`${i}.binary`),sI(n,`${i}.objectMode`),ja(t)||ja(e)?"asyncGenerator":"generator"},sI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},aW=t=>ja(t)||dW(t),ja=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",dW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Cwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Wb=t=>Object.prototype.toString.call(t)==="[object URL]",fW=t=>Wb(t)&&t.protocol!=="file:",Dwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Nwe.has(e))&&aI(t.file),Nwe=new Set(["file","append"]),aI=t=>typeof t=="string",pW=(t,e)=>t==="native"&&typeof e=="string"&&!jwe.has(e),jwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),mW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Kb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Mwe=t=>mW(t)||Kb(t),cI=t=>mW(t?.readable)&&Kb(t?.writable),Fwe=t=>hW(t)&&typeof t[Symbol.asyncIterator]=="function",Lwe=t=>hW(t)&&typeof t[Symbol.iterator]=="function",hW=t=>typeof t=="object"&&t!==null,On=new Set(["generator","asyncGenerator","duplex","webTransform"]),Jb=new Set(["fileUrl","filePath","fileNumber"]),lI=new Set(["fileUrl","filePath"]),gW=new Set([...lI,"webStream","nodeStream"]),yW=new Set(["webTransform","duplex"]),ps={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 uI,zwe,Uwe,_W,dI=y(()=>{Sr();uI=(t,e,r,n)=>n==="output"?zwe(t,e,r):Uwe(t,e,r),zwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Uwe=(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}},_W=(t,e)=>{let r=t.findLast(({type:n})=>On.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var bW,qwe,Bwe,Hwe,Gwe,Zwe,Vwe,vW=y(()=>{yo();Pa();Sr();dI();bW=(t,e,r,n)=>[...t.filter(({type:i})=>!On.has(i)),...qwe(t,e,r,n)],qwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>On.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Bwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Vwe(o,r)},Bwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Hwe({stdioItem:t,optionName:i}):e==="webTransform"?Gwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Zwe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Hwe=({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}}},Gwe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=uI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Zwe=({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}=Ot(e)?e:{transform:e},d=c||on.has(o),{writableObjectMode:f,readableObjectMode:p}=uI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Vwe=(t,e)=>e==="input"?t.reverse():t});import fI from"node:process";var SW,Wwe,Kwe,Fl,pI,wW,Jwe,Ywe,xW=y(()=>{Da();Sr();SW=(t,e,r)=>{let n=t.map(i=>Wwe(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)??Ywe},Wwe=({type:t,value:e},r)=>Kwe[r]??wW[t](e),Kwe=["input","output","output"],Fl=()=>{},pI=()=>"input",wW={generator:Fl,asyncGenerator:Fl,fileUrl:Fl,filePath:Fl,iterable:pI,asyncIterable:pI,uint8Array:pI,webStream:t=>Kb(t)?"output":"input",nodeStream(t){return Ca(t,{checkOpen:!1})?XR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Fl,duplex:Fl,native(t){let e=Jwe(t);if(e!==void 0)return e;if(ri(t,{checkOpen:!1}))return wW.nodeStream(t)}},Jwe=t=>{if([0,fI.stdin].includes(t))return"input";if([1,2,fI.stdout,fI.stderr].includes(t))return"output"},Ywe="output"});var $W,kW=y(()=>{$W=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var EW,Xwe,Qwe,AW,exe,txe,TW=y(()=>{bo();kW();ls();EW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Xwe(t,n).map((a,c)=>AW(a,c));return o?exe(s,r,i):$W(s,e)},Xwe=(t,e)=>{if(t===void 0)return Tn.map(n=>e[n]);if(Qwe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Tn.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,Tn.length);return Array.from({length:r},(n,i)=>t[i])},Qwe=t=>Tn.some(e=>t[e]!==void 0),AW=(t,e)=>Array.isArray(t)?t.map(r=>AW(r,e)):t??(e>=Tn.length?"ignore":"pipe"),exe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!kl(r,i)&&txe(n)?"ignore":n),txe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as rxe}from"node:fs";import nxe from"node:tty";var RW,ixe,oxe,sxe,axe,OW,IW=y(()=>{Da();bo();nn();ds();RW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?ixe({stdioItem:t,fdNumber:n,direction:i}):axe({stdioItem:t,fdNumber:n}),ixe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=oxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ri(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},oxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=sxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(nxe.isatty(i))throw new TypeError(`The \`${e}: ${yb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:_o(rxe(i)),optionName:e}}},sxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=J_.indexOf(t);if(r!==-1)return r},axe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:OW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:OW(e,e,r),optionName:r}:ri(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,OW=(t,e,r)=>{let n=J_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var PW,cxe,lxe,uxe,dxe,CW=y(()=>{Da();nn();Sr();PW=({input:t,inputFile:e},r)=>r===0?[...cxe(t),...uxe(e)]:[],cxe=t=>t===void 0?[]:[{type:lxe(t),value:t,optionName:"input"}],lxe=t=>{if(Ca(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},uxe=t=>t===void 0?[]:[{...dxe(t),optionName:"inputFile"}],dxe=t=>{if(Wb(t))return{type:"fileUrl",value:t};if(aI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var DW,NW,fxe,pxe,jW,mxe,hxe,MW,FW=y(()=>{Sr();DW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),NW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=fxe(i,t);if(s.length!==0){if(o){pxe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(gW.has(t))return jW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});yW.has(t)&&hxe({otherStdioItems:s,type:t,value:e,optionName:r})}},fxe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),pxe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{lI.has(e)&&jW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},jW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>mxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return MW(s,n,e),i==="output"?o[0].stream:void 0},mxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,hxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);MW(i,n,e)},MW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${ps[r]} that is the same.`)}});var Yb,gxe,yxe,_xe,bxe,vxe,Sxe,wxe,xxe,$xe,kxe,Exe,mI,Axe,Xb=y(()=>{bo();vW();dI();Sr();xW();TW();IW();CW();FW();Yb=(t,e,r,n)=>{let o=EW(e,r,n).map((a,c)=>gxe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=$xe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Axe(a)),s},gxe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=Y_(e),{stdioItems:o,isStdioArray:s}=yxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=SW(o,e,i),c=o.map(d=>RW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=bW(c,i,a,r),u=_W(l,a);return xxe(l,u),{direction:a,objectMode:u,stdioItems:l}},yxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>_xe(c,n)),...PW(r,e)],s=DW(o),a=s.length>1;return bxe(s,a,n),Sxe(s),{stdioItems:s,isStdioArray:a}},_xe=(t,e)=>({type:cW(t,e),value:t,optionName:e}),bxe=(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(vxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},vxe=new Set(["ignore","ipc"]),Sxe=t=>{for(let e of t)wxe(e)},wxe=({type:t,value:e,optionName:r})=>{if(fW(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(pW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},xxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Jb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},$xe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(kxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw mI(i),o}},kxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Exe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Exe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=NW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},mI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Qn(r)&&r.destroy()},Axe=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 LW}from"node:fs";var UW,ji,Txe,qW,zW,Oxe,BW=y(()=>{nn();Xb();Sr();UW=(t,e)=>Yb(Oxe,t,e,!0),ji=({type:t,optionName:e})=>{qW(e,ps[t])},Txe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&qW(t,`"${e}"`),{}),qW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},zW={generator(){},asyncGenerator:ji,webStream:ji,nodeStream:ji,webTransform:ji,duplex:ji,asyncIterable:ji,native:Txe},Oxe={input:{...zW,fileUrl:({value:t})=>({contents:[_o(LW(t))]}),filePath:({value:{file:t}})=>({contents:[_o(LW(t))]}),fileNumber:ji,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...zW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:ji,string:ji,uint8Array:ji}}});var xo,hI,ip=y(()=>{YR();xo=(t,{stripFinalNewline:e},r)=>hI(e,r)&&t!==void 0&&!Array.isArray(t)?Dl(t):t,hI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Qb,yI,HW,GW,Rxe,Ixe,Pxe,ZW,Cxe,gI,Dxe,Nxe,jxe,ev=y(()=>{Qb=(t,e,r,n)=>t||r?void 0:GW(e,n),yI=(t,e,r)=>r?t.flatMap(n=>HW(n,e)):HW(t,e),HW=(t,e)=>{let{transform:r,final:n}=GW(e,{});return[...r(t),...n()]},GW=(t,e)=>(e.previousChunks="",{transform:Rxe.bind(void 0,e,t),final:Pxe.bind(void 0,e)}),Rxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=gI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=gI(n,r.slice(i+1))),t.previousChunks=n},Ixe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Pxe=function*({previousChunks:t}){t.length>0&&(yield t)},ZW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:Cxe.bind(void 0,n)},Cxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Dxe:jxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},gI=(t,e)=>`${t}${e}`,Dxe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:mI},Axe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Txe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Axe}});import{Buffer as Oxe}from"node:buffer";var UW,Rxe,qW,Ixe,Pxe,BW,HW=y(()=>{rn();UW=(t,e)=>t?void 0:Rxe.bind(void 0,e),Rxe=function*(t,e){if(typeof e!="string"&&!Ut(e)&&!Oxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},qW=(t,e)=>t?Ixe.bind(void 0,e):Pxe.bind(void 0,e),Ixe=function*(t,e){BW(t,e),yield e},Pxe=function*(t,e){if(BW(t,e),typeof e!="string"&&!Ut(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},BW=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:gI},Nxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},jxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Nxe}});import{Buffer as Mxe}from"node:buffer";var VW,Fxe,WW,Lxe,zxe,KW,JW=y(()=>{nn();VW=(t,e)=>t?void 0:Fxe.bind(void 0,e),Fxe=function*(t,e){if(typeof e!="string"&&!qt(e)&&!Mxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},WW=(t,e)=>t?Lxe.bind(void 0,e):zxe.bind(void 0,e),Lxe=function*(t,e){KW(t,e),yield e},zxe=function*(t,e){if(KW(t,e),typeof e!="string"&&!qt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},KW=(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 Cxe}from"node:buffer";import{StringDecoder as Dxe}from"node:string_decoder";var Qb,Nxe,jxe,Mxe,gI=y(()=>{rn();Qb=(t,e,r)=>{if(r)return;if(t)return{transform:Nxe.bind(void 0,new TextEncoder)};let n=new Dxe(e);return{transform:jxe.bind(void 0,n),final:Mxe.bind(void 0,n)}},Nxe=function*(t,e){Cxe.isBuffer(e)?yield yo(e):typeof e=="string"?yield t.encode(e):yield e},jxe=function*(t,e){yield Ut(e)?t.write(e):e},Mxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as GW}from"node:util";var yI,ev,ZW,Fxe,VW,Lxe,WW=y(()=>{yI=GW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),ev=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Lxe}=e[r];for await(let i of n(t))yield*ev(i,e,r+1)},ZW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Fxe(r,Number(e),t)},Fxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*ev(n,r,e+1)},VW=GW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Lxe=function*(t){yield t}});var _I,KW,Ma,op,zxe,Uxe,bI=y(()=>{_I=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},KW=(t,e)=>[...e.flatMap(r=>[...Ma(r,t,0)]),...op(t)],Ma=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Uxe}=e[r];for(let i of n(t))yield*Ma(i,e,r+1)},op=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*zxe(r,Number(e),t)},zxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ma(n,r,e+1)},Uxe=function*(t){yield t}});import{Transform as qxe,getDefaultHighWaterMark as JW}from"node:stream";var vI,tv,YW,rv=y(()=>{vr();Xb();HW();gI();WW();bI();vI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=YW(t,s,o),l=ja(e),u=ja(r),d=l?yI.bind(void 0,ev,a):_I.bind(void 0,Ma),f=l||u?yI.bind(void 0,ZW,a):_I.bind(void 0,op),p=l||u?VW.bind(void 0,a):void 0;return{stream:new qxe({writableObjectMode:n,writableHighWaterMark:JW(n),readableObjectMode:i,readableHighWaterMark:JW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},tv=(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=YW(s,r,a);t=KW(c,t)}return t},YW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:UW(n,a)},Qb(r,s,n),Yb(r,o,n,c),{transform:t,final:e},{transform:qW(i,a)},zW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var XW,Bxe,Hxe,Gxe,Zxe,QW=y(()=>{rv();rn();vr();XW=(t,e)=>{for(let r of Bxe(t))Hxe(t,r,e)},Bxe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Hxe=(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 ${ps[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Gxe(a,n));r.input=Bf(s)},Gxe=(t,e)=>{let r=tv(t,e,"utf8",!0);return Zxe(r),Bf(r)},Zxe=t=>{let e=t.find(r=>typeof r!="string"&&!Ut(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 nv,Vxe,Wxe,e3,t3,Kxe,r3,SI=y(()=>{Pa();vr();wl();ls();nv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Sl(r,n)&&!nn.has(e)&&Vxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Wxe.has(o))||t.every(({type:i})=>Tn.has(i))),Vxe=t=>t===1||t===2,Wxe=new Set(["pipe","overlapped"]),e3=async(t,e,r,n)=>{for await(let i of t)Kxe(e)||r3(i,r,n)},t3=(t,e,r)=>{for(let n of t)r3(n,e,r)},Kxe=t=>t._readableState.pipes.length>0,r3=(t,e,r)=>{let n=rb(t);Ri({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Jxe,appendFileSync as Yxe}from"node:fs";var n3,Xxe,Qxe,e0e,t0e,r0e,i3=y(()=>{SI();rv();Xb();rn();vr();Na();n3=({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)=>Xxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Xxe=({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=qV(t,o,d),p=yo(f),{stdioItems:m,objectMode:h}=e[r],g=Qxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=e0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});t0e({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&&r0e(b,m,i),S}catch(x){return n.error=x,S}},Qxe=(t,e,r,n)=>{try{return tv(t,e,r,!1)}catch(i){return n.error=i,t}},e0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Bf(t)};let s=PG(t,r);return n[o]?{serializedResult:s,finalResult:hI(s,!i[o],e)}:{serializedResult:s}},t0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!nv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=hI(t,!1,s);try{t3(a,e,n)}catch(c){r.error??=c}},r0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Wb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Yxe(n,t):(r.add(o),Jxe(n,t))}}});var o3,s3=y(()=>{rn();ip();o3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,wo(e,r,"all")]:Array.isArray(e)?[wo(t,r,"all"),...e]:Ut(t)&&Ut(e)?uR([t,e]):`${t}${e}`}});import{once as wI}from"node:events";var a3,n0e,c3,l3,i0e,xI,$I=y(()=>{Ra();a3=async(t,e)=>{let[r,n]=await n0e(t);return e.isForcefullyTerminated??=!1,[r,n]},n0e=async t=>{let[e,r]=await Promise.allSettled([wI(t,"spawn"),wI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?c3(t):r.value},c3=async t=>{try{return await wI(t,"exit")}catch{return c3(t)}},l3=async t=>{let[e,r]=await t;if(!i0e(e,r)&&xI(e,r))throw new Qn;return[e,r]},i0e=(t,e)=>t===void 0&&e===void 0,xI=(t,e)=>t!==0||e!==null});var u3,o0e,d3=y(()=>{Ra();Na();$I();u3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=o0e(t,e,r),s=o?.code==="ETIMEDOUT",a=UV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},o0e=(t,e,r)=>t!==void 0?t:xI(e,r)?new Qn:void 0});import{spawnSync as s0e}from"node:child_process";var f3,a0e,c0e,l0e,iv,u0e,d0e,f0e,p0e,p3=y(()=>{bR();VR();WR();np();Gb();MW();ip();QW();i3();Na();s3();d3();f3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=a0e(t,e,r),d=u0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Cl(d,c,l)},a0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ob(t,e,r),a=c0e(r),{file:c,commandArguments:l,options:u}=Pb(t,e,a);l0e(u);let d=NW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},c0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,l0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&iv("ipcInput"),t&&iv("ipc: true"),r&&iv("detached: true"),n&&iv("cancelSignal")},iv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},u0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=d0e({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}=u3(c,r),{output:m,error:h=l}=n3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>wo(_,r,S)),b=wo(o3(m,r),r,"all");return p0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},d0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{XW(o,r);let a=f0e(r);return s0e(...Cb(t,e,a))}catch(a){return Pl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},f0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Bb(e)}),p0e=({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?Hb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):rp({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 kI,on as m0e}from"node:events";var m3,h0e,g0e,y0e,_0e,h3=y(()=>{Al();Yf();Jf();m3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(kl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:kb(t)}),h0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),h0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{_b(e,i);let o=fs(t,e,r),s=new AbortController;try{return await Promise.race([g0e(o,n,s),y0e(o,r,s),_0e(o,r,s)])}catch(a){throw El(t),a}finally{s.abort(),bb(e,i)}},g0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await kI(t,"message",{signal:r});return n}for await(let[n]of m0e(t,"message",{signal:r}))if(e(n))return n},y0e=async(t,e,{signal:r})=>{await kI(t,"disconnect",{signal:r}),E9(e)},_0e=async(t,e,{signal:r})=>{let[n]=await kI(t,"strict:error",{signal:r});throw mb(n,e)}});import{once as y3,on as b0e}from"node:events";var _3,EI,v0e,S0e,w0e,g3,AI=y(()=>{Al();Yf();Jf();_3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>EI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),EI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{kl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:kb(t)}),_b(e,o);let s=fs(t,e,r),a=new AbortController,c={};return v0e(t,s,a),S0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),w0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},v0e=async(t,e,r)=>{try{await y3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},S0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await y3(t,"strict:error",{signal:r.signal});n.error=mb(i,e),r.abort()}catch{}},w0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of b0e(r,"message",{signal:o.signal}))g3(s),yield c}catch{g3(s)}finally{o.abort(),bb(e,a),n||El(t),i&&await t}},g3=({error:t})=>{if(t)throw t}});import b3 from"node:process";var v3,S3,w3,TI=y(()=>{Rb();h3();AI();xb();v3=(t,{ipc:e})=>{Object.assign(t,w3(t,!1,e))},S3=()=>{let t=b3,e=!0,r=b3.channel!==void 0;return{...w3(t,e,r),getCancelSignal:eV.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},w3=(t,e,r)=>({sendMessage:Ob.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:m3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:_3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as x0e}from"node:child_process";import{PassThrough as $0e,Readable as k0e,Writable as E0e,Duplex as A0e}from"node:stream";var x3,T0e,sp,O0e,R0e,I0e,P0e,$3=y(()=>{Jb();np();Gb();x3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{fI(n);let a=new x0e;T0e(a,n),Object.assign(a,{readable:O0e,writable:R0e,duplex:I0e});let c=Pl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=P0e(c,s,i);return{subprocess:a,promise:l}},T0e=(t,e)=>{let r=sp(),n=sp(),i=sp(),o=Array.from({length:e.length-3},sp),s=sp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},sp=()=>{let t=new $0e;return t.end(),t},O0e=()=>new k0e({read(){}}),R0e=()=>new E0e({write(){}}),I0e=()=>new A0e({read(){},write(){}}),P0e=async(t,e,r)=>Cl(t,e,r)});import{createReadStream as k3,createWriteStream as E3}from"node:fs";import{Buffer as C0e}from"node:buffer";import{Readable as ap,Writable as D0e,Duplex as N0e}from"node:stream";var T3,cp,A3,j0e,O3=y(()=>{rv();Jb();vr();T3=(t,e)=>Kb(j0e,t,e,!1),cp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ps[t]}.`)},A3={fileNumber:cp,generator:vI,asyncGenerator:vI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:N0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},j0e={input:{...A3,fileUrl:({value:t})=>({stream:k3(t)}),filePath:({value:{file:t}})=>({stream:k3(t)}),webStream:({value:t})=>({stream:ap.fromWeb(t)}),iterable:({value:t})=>({stream:ap.from(t)}),asyncIterable:({value:t})=>({stream:ap.from(t)}),string:({value:t})=>({stream:ap.from(t)}),uint8Array:({value:t})=>({stream:ap.from(C0e.from(t))})},output:{...A3,fileUrl:({value:t})=>({stream:E3(t)}),filePath:({value:{file:t,append:e}})=>({stream:E3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:D0e.fromWeb(t)}),iterable:cp,asyncIterable:cp,string:cp,uint8Array:cp}}});import{on as M0e,once as R3}from"node:events";import{PassThrough as F0e,getDefaultHighWaterMark as L0e}from"node:stream";import{finished as C3}from"node:stream/promises";function Fa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)RI(i);let e=t.some(({readableObjectMode:i})=>i),r=z0e(t,e),n=new OI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var z0e,OI,U0e,q0e,B0e,RI,H0e,G0e,Z0e,V0e,W0e,D3,N3,II,j3,K0e,ov,I3,P3,sv=y(()=>{z0e=(t,e)=>{if(t.length===0)return L0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},OI=class extends F0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(RI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=U0e(this,this.#t,this.#o);let r=H0e({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(RI(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)}},U0e=async(t,e,r)=>{ov(t,I3);let n=new AbortController;try{await Promise.race([q0e(t,n),B0e(t,e,r,n)])}finally{n.abort(),ov(t,-I3)}},q0e=async(t,{signal:e})=>{try{await C3(t,{signal:e,cleanup:!0})}catch(r){throw D3(t,r),r}},B0e=async(t,e,r,{signal:n})=>{for await(let[i]of M0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},RI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},H0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{ov(t,P3);let a=new AbortController;try{await Promise.race([G0e(o,e,a),Z0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),V0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),ov(t,-P3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?II(t):W0e(t))},G0e=async(t,e,{signal:r})=>{try{await t,r.aborted||II(e)}catch(n){r.aborted||D3(e,n)}},Z0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await C3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;N3(s)?i.add(e):j3(t,s)}},V0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await R3(t,i,{signal:o}),!t.readable)return R3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},W0e=t=>{t.writable&&t.end()},D3=(t,e)=>{N3(e)?II(t):j3(t,e)},N3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",II=t=>{(t.readable||t.writable)&&t.destroy()},j3=(t,e)=>{t.destroyed||(t.once("error",K0e),t.destroy(e))},K0e=()=>{},ov=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},I3=2,P3=1});import{finished as M3}from"node:stream/promises";var Nl,J0e,PI,Y0e,CI,av=y(()=>{_o();Nl=(t,e)=>{t.pipe(e),J0e(t,e),Y0e(t,e)},J0e=async(t,e)=>{if(!(Xn(t)||Xn(e))){try{await M3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}PI(e)}},PI=t=>{t.writable&&t.end()},Y0e=async(t,e)=>{if(!(Xn(t)||Xn(e))){try{await M3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}CI(t)}},CI=t=>{t.readable&&t.destroy()}});var F3,X0e,Q0e,e$e,t$e,r$e,L3=y(()=>{sv();_o();yb();vr();av();F3=(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})=>Tn.has(c)))X0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Tn.has(c)))e$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]:Fa(o);Nl(s,i)}},X0e=(t,e,r,n)=>{r==="output"?Nl(t.stdio[n],e):Nl(e,t.stdio[n]);let i=Q0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Q0e=["stdin","stdout","stderr"],e$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;t$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])},t$e=(t,{signal:e})=>{Xn(t)&&Ia(t,r$e,e)},r$e=2});var La,z3=y(()=>{La=[];La.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&La.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&La.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var cv,DI,NI,n$e,jI,lv,i$e,MI,FI,LI,U3,Nst,jst,q3=y(()=>{z3();cv=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",DI=Symbol.for("signal-exit emitter"),NI=globalThis,n$e=Object.defineProperty.bind(Object),jI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(NI[DI])return NI[DI];n$e(NI,DI,{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}},lv=class{},i$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),MI=class extends lv{onExit(){return()=>{}}load(){}unload(){}},FI=class extends lv{#t=LI.platform==="win32"?"SIGINT":"SIGHUP";#r=new jI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of La)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(!cv(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 La)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,La.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 cv(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"&&cv(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)}},LI=globalThis.process,{onExit:U3,load:Nst,unload:jst}=i$e(cv(LI)?new FI(LI):new MI)});import{addAbortListener as o$e}from"node:events";var B3,H3=y(()=>{q3();B3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=U3(()=>{t.kill()});o$e(n,()=>{i()})}});var Z3,s$e,a$e,G3,c$e,V3=y(()=>{lR();ib();ds();bl();Z3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=nb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=s$e(r,n,i),{sourceStream:d,sourceError:f}=c$e(t,l),{options:p,fileDescriptors:m}=Pi.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},s$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=a$e(t,e,...r),a=gb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},a$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(G3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||aR(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]=Z_(r,...n);return{destination:e(G3)(i,o,s),pipeOptions:s}}if(Pi.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}`)},G3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),c$e=(t,e)=>{try{return{sourceStream:Ol(t,e)}}catch(r){return{sourceError:r}}}});var K3,l$e,zI,W3,UI=y(()=>{np();av();K3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=l$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw zI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},l$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return CI(t),n;if(e!==void 0)return PI(r),e},zI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Pl({error:t,command:W3,escapedCommand:W3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),W3="source.pipe(destination)"});var J3,Y3=y(()=>{J3=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 u$e}from"node:stream/promises";var X3,d$e,f$e,p$e,uv,m$e,h$e,Q3=y(()=>{sv();yb();av();X3=(t,e,r)=>{let n=uv.has(e)?f$e(t,e):d$e(t,e);return Ia(t,m$e,r.signal),Ia(e,h$e,r.signal),p$e(e),n},d$e=(t,e)=>{let r=Fa([t]);return Nl(r,e),uv.set(e,r),r},f$e=(t,e)=>{let r=uv.get(e);return r.add(t),r},p$e=async t=>{try{await u$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}uv.delete(t)},uv=new WeakMap,m$e=2,h$e=1});import{aborted as g$e}from"node:util";var eK,y$e,tK=y(()=>{UI();eK=(t,e)=>t===void 0?[]:[y$e(t,e)],y$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 zI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var dv,_$e,b$e,rK=y(()=>{go();V3();UI();Y3();Q3();tK();dv=(t,...e)=>{if(Ot(e[0]))return dv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Z3(t,...e),i=_$e({...n,destination:r});return i.pipe=dv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},_$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=b$e(t,i);K3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=X3(e,o,d);return await Promise.race([J3(u),...eK(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},b$e=(t,e)=>Promise.allSettled([t,e])});import{on as v$e}from"node:events";import{getDefaultHighWaterMark as S$e}from"node:stream";var fv,w$e,qI,x$e,iK,BI,nK,$$e,k$e,pv=y(()=>{gI();Xb();bI();fv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return w$e(e,s),iK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},w$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},qI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;x$e(e,s,t);let a=t.readableObjectMode&&!o;return iK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},x$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},iK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=v$e(t,"data",{signal:e.signal,highWaterMark:nK,highWatermark:nK});return $$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},BI=S$e(!0),nK=BI,$$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=k$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ma(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*op(a)}},k$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Qb(t,r,!e),Yb(t,i,!n,{})].filter(Boolean)});import{setImmediate as E$e}from"node:timers/promises";var oK,A$e,T$e,O$e,HI,sK,GI=y(()=>{qb();rn();SI();pv();Na();ip();oK=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=A$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([T$e(t),d]);return}let f=pI(c,r),p=qI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([O$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},A$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!nv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=qI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await e3(a,t,r,o)},T$e=async t=>{await E$e(),t.readableFlowing===null&&t.resume()},O$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Fb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Lb(r,{maxBuffer:o})):await Ub(r,{maxBuffer:o})}catch(a){return sK(FV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},HI=async t=>{try{return await t}catch(e){return sK(e)}},sK=({bufferedData:t})=>RG(t)?new Uint8Array(t):t});import{finished as R$e}from"node:stream/promises";var lp,I$e,P$e,C$e,D$e,N$e,ZI,mv,aK,hv=y(()=>{lp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=I$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],R$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||D$e(a,e,r,n)}finally{s.abort()}},I$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&P$e(t,r,n),n},P$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{C$e(e,r),n.call(t,...i)}},C$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},D$e=(t,e,r,n)=>{if(!N$e(t,e,r,n))throw t},N$e=(t,e,r,n=!0)=>r.propagating?aK(t)||mv(t):(r.propagating=!0,ZI(r,e)===n?aK(t):mv(t)),ZI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",mv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",aK=t=>t?.code==="EPIPE"});var cK,VI,WI=y(()=>{GI();hv();cK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>VI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),VI=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=lp(t,e,l);if(ZI(l,e)){await u;return}let[d]=await Promise.all([oK({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 lK,uK,j$e,M$e,KI=y(()=>{sv();WI();lK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fa([t,e].filter(Boolean)):void 0,uK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>VI({...j$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:M$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),j$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}},M$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var dK,fK,pK=y(()=>{wl();ls();dK=t=>Sl(t,"ipc"),fK=(t,e)=>{let r=rb(t);Ri({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var mK,hK,gK=y(()=>{Na();pK();vo();AI();mK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=dK(o),a=bo(e,"ipc"),c=bo(r,"ipc");for await(let l of EI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(LV(t,i,c),i.push(l)),s&&fK(l,o);return i},hK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as F$e}from"node:events";var yK,L$e,z$e,U$e,_K=y(()=>{Da();qR();CR();UR();_o();vr();GI();gK();HR();KI();WI();$I();hv();yK=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 _=a3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=cK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=uK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=mK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=L$e(h,t,S),D=z$e(m,S);try{return await Promise.race([Promise.all([{},l3(_),Promise.all(x),w,T,uV(t,d),...A,...D]),g,U$e(t,b),...oV(t,o,f,b),...k9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...nV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(ie=>HI(ie))),HI(w),hK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},L$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:lp(n,i,r)),z$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ti(o,{checkOpen:!1})&&!Xn(o)).map(({type:i,value:o,stream:s=o})=>lp(s,n,e,{isSameDirection:Tn.has(i),stopOnExit:i==="native"}))),U$e=async(t,{signal:e})=>{let[r]=await F$e(t,"error",{signal:e});throw r}});var bK,up,jl,gv=y(()=>{Tl();bK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),up=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ii();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},jl=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 vK}from"node:stream/promises";var JI,SK,YI,XI,yv,_v,QI=y(()=>{hv();JI=async t=>{if(t!==void 0)try{await YI(t)}catch{}},SK=async t=>{if(t!==void 0)try{await XI(t)}catch{}},YI=async t=>{await vK(t,{cleanup:!0,readable:!1,writable:!0})},XI=async t=>{await vK(t,{cleanup:!0,readable:!0,writable:!1})},yv=async(t,e)=>{if(await t,e)throw e},_v=(t,e,r)=>{r&&!mv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as q$e}from"node:stream";import{callbackify as B$e}from"node:util";var wK,eP,tP,rP,H$e,nP,iP,xK,oP=y(()=>{Pa();ds();pv();Tl();gv();QI();wK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=eP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=tP(a,s),{read:f,onStdoutDataDone:p}=rP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new q$e({read:f,destroy:B$e(iP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return nP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},eP=(t,e,r)=>{let n=Ol(t,e),i=up(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},tP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:BI},rP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ii(),s=fv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){H$e(this,s,o)},onStdoutDataDone:o}},H$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},nP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await XI(t),await n,await JI(i),await e,r.readable&&r.push(null)}catch(o){await JI(i),xK(r,o)}},iP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await jl(r,e)&&(xK(t,n),await yv(e,n))},xK=(t,e)=>{_v(t,t.readable,e)}});import{Writable as G$e}from"node:stream";import{callbackify as $K}from"node:util";var kK,sP,aP,Z$e,V$e,cP,lP,EK,uP=y(()=>{ds();gv();QI();kK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=sP(t,r,e),s=new G$e({...aP(n,t,i),destroy:$K(lP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return cP(n,s),s},sP=(t,e,r)=>{let n=gb(t,e),i=up(r,n,"writableFinal"),o=up(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},aP=(t,e,r)=>({write:Z$e.bind(void 0,t),final:$K(V$e.bind(void 0,t,e,r))}),Z$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},V$e=async(t,e,r)=>{await jl(r,e)&&(t.writable&&t.end(),await e)},cP=async(t,e,r)=>{try{await YI(t),e.writable&&e.end()}catch(n){await SK(r),EK(e,n)}},lP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await jl(r,e),await jl(n,e)&&(EK(t,i),await yv(e,i))},EK=(t,e)=>{_v(t,t.writable,e)}});import{Duplex as W$e}from"node:stream";import{callbackify as K$e}from"node:util";var AK,J$e,TK=y(()=>{Pa();oP();uP();AK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=eP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=sP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=tP(c,a),{read:g,onStdoutDataDone:b}=rP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new W$e({read:g,...aP(u,t,d),destroy:K$e(J$e.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 nP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),cP(u,_,c),_},J$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([iP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),lP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var dP,Y$e,OK=y(()=>{Pa();ds();pv();dP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=Ol(t,r),a=fv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Y$e(a,s,t)},Y$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var RK,IK=y(()=>{gv();oP();uP();TK();OK();RK=(t,{encoding:e})=>{let r=bK();t.readable=wK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=kK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=AK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=dP.bind(void 0,t,e),t[Symbol.asyncIterator]=dP.bind(void 0,t,e,{})}});var PK,X$e,Q$e,CK=y(()=>{PK=(t,e)=>{for(let[r,n]of Q$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},X$e=(async()=>{})().constructor.prototype,Q$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(X$e,t)])});import{setMaxListeners as eke}from"node:events";import{spawn as tke}from"node:child_process";var DK,rke,nke,ike,oke,ske,NK=y(()=>{qb();bR();VR();ds();WR();TI();np();Gb();$3();O3();ip();L3();fb();H3();rK();KI();_K();IK();Tl();CK();DK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=rke(t,e,r),{subprocess:f,promise:p}=ike({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=dv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),PK(f,p),Pi.set(f,{options:u,fileDescriptors:d}),f},rke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ob(t,e,r),{file:a,commandArguments:c,options:l}=Pb(t,e,r),u=nke(l),d=T3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},nke=({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}},ike=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=tke(...Cb(t,e,r))}catch(m){return x3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;eke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];F3(c,a,l),B3(c,r,l);let d={},f=Ii();c.kill=x9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=lK(c,r),RK(c,r),v3(c,r);let p=oke({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}},oke=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 yK({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)=>wo(x,e,w)),_=wo(h,e,"all"),S=ske({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Cl(S,n,e)},ske=({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?rp({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 Ci,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Hb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var bv,ake,cke,jK=y(()=>{go();vo();bv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,ake(n,t[n],i)]));return{...t,...r}},ake=(t,e,r)=>cke.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,cke=new Set(["env",...mR])});var ms,lke,uke,MK=y(()=>{go();lR();FG();p3();NK();jK();ms=(t,e,r,n)=>{let i=(s,a,c)=>ms(s,a,r,c),o=(...s)=>lke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},lke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,bv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=uke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?f3(a,c,l):DK(a,c,l,i)},uke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=jG(e)?MG(e,r):[e,...r],[s,a,c]=Z_(...o),l=bv(bv(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 FK,LK,zK,dke,fke,UK=y(()=>{FK=({file:t,commandArguments:e})=>zK(t,e),LK=({file:t,commandArguments:e})=>({...zK(t,e),isSync:!0}),zK=(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]=dke(t);return{file:r,commandArguments:n}},dke=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(fke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},fke=/ +/g});var qK,BK,pke,HK,mke,GK,ZK=y(()=>{qK=(t,e,r)=>{t.sync=e(pke,r),t.s=t.sync},BK=({options:t})=>HK(t),pke=({options:t})=>({...HK(t),isSync:!0}),HK=t=>({options:{...mke(t),...t}}),mke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},GK={preferLocal:!0}});var klt,Ye,Elt,Alt,Tlt,Olt,Rlt,Ilt,Plt,Clt,Mr=y(()=>{MK();UK();BR();ZK();TI();klt=ms(()=>({})),Ye=ms(()=>({isSync:!0})),Elt=ms(FK),Alt=ms(LK),Tlt=ms(aV),Olt=ms(BK,{},GK,qK),{sendMessage:Rlt,getOneMessage:Ilt,getEachMessage:Plt,getCancelSignal:Clt}=S3()});import{existsSync as vv,statSync as hke}from"node:fs";import{dirname as fP,extname as gke,isAbsolute as VK,join as pP,relative as mP,resolve as Sv,sep as yke}from"node:path";function wv(t){return t==="./gradlew"||t==="gradle"}function _ke(t){return(vv(pP(t,"build.gradle.kts"))||vv(pP(t,"build.gradle")))&&vv(pP(t,"gradle.properties"))}function bke(t,e){let n=mP(t,e).split(yke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function hs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function vke(t,e){let r=Sv(t,e),n=r;vv(r)?hke(r).isFile()&&(n=fP(r)):gke(r)!==""&&(n=fP(r));let i=mP(t,n);if(i.startsWith("..")||VK(i))return null;let o=n;for(;;){if(_ke(o))return o;if(Sv(o)===Sv(t))return null;let s=fP(o);if(s===o)return null;let a=mP(t,s);if(a.startsWith("..")||VK(a))return null;o=s}}function xv(t,e){let r=Sv(t),n=new Map,i=[];for(let o of e){let s=vke(r,o);if(!s){i.push(o);continue}let a=bke(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 $v=y(()=>{"use strict"});import{existsSync as gP,readFileSync as Ske}from"node:fs";import{join as Ml}from"node:path";function Fl(t="."){let e=Ml(t,".cladding","config.yaml");if(!gP(e))return hP;try{let n=(0,WK.parse)(Ske(e,"utf8"))?.gate;if(!n)return hP;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 wke){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 hP}}function KK(t="."){let e=Fl(t).testReport,r=e?[e,...yP]:yP;return[...new Set(r.map(n=>Ml(t,n)))]}function JK(t="."){let e=Fl(t).testReport;if(e){let r=Ml(t,e);return gP(r)?r:null}return yP.map(r=>Ml(t,r)).find(r=>gP(r))??null}function YK(t,e){let r=[],n=!1;for(let i of t){let o=xke.exec(i);if(o){n=!0;for(let s of e)r.push(hs(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 WK,wke,hP,yP,xke,dp=y(()=>{"use strict";WK=St(Qt(),1);$v();wke=["type","lint","test","coverage"],hP={scope:"feature"},yP=["test-report.junit.xml",Ml("coverage","junit.xml"),Ml(".cladding","test-report.junit.xml")];xke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as bP,readFileSync as XK,readdirSync as $ke,statSync as kke}from"node:fs";import{join as kv}from"node:path";function wP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=kv(t,e);if(bP(r))try{if(QK.test(XK(r,"utf8")))return!0}catch{}}return!1}function eJ(t){try{return bP(t)&&QK.test(XK(t,"utf8"))}catch{return!1}}function tJ(t,e=0){if(e>4||!bP(t))return!1;let r;try{r=$ke(t)}catch{return!1}for(let n of r){let i=kv(t,n),o=!1;try{o=kke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(tJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&eJ(i))return!0}return!1}function Tke(t){if(wP(t))return!0;for(let e of Eke)if(eJ(kv(t,e)))return!0;for(let e of Ake)if(tJ(kv(t,e)))return!0;return!1}function rJ(t="."){let e=Fl(t).coverage;return e||(Tke(t)?"kover":"jacoco")}function nJ(t="."){return vP[rJ(t)]}function iJ(t="."){return _P[rJ(t)]}var vP,_P,SP,QK,Eke,Ake,Ev=y(()=>{"use strict";dp();vP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},_P={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},SP=[_P.kover,_P.jacoco],QK=/kover/i;Eke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Ake=["buildSrc","build-logic"]});import{existsSync as pp,readFileSync as sJ,readdirSync as aJ}from"node:fs";import{join as gs}from"node:path";function $P(t){return pp(gs(t,"gradlew"))?"./gradlew":"gradle"}function Oke(t){let e=$P(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[nJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Rke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(sJ(gs(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function Pke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function Nke(t,e){for(let r of e)if(pp(gs(t,r)))return r}function jke(t,e){try{return aJ(t).find(n=>n.endsWith(e))}catch{return}}function Lke(t){try{return JSON.parse(sJ(gs(t,"package.json"),"utf8"))}catch{return{}}}function fp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function oJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function zke(t,e,r){if(fp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of Mke)if(n.configs.some(i=>pp(gs(t,i))))return n.gate;if(Fke.some(n=>pp(gs(t,n)))||r.eslintConfig!==void 0)return e}function qke(t,e){return Uke.some(r=>pp(gs(t,r)))?!0:e.jest!==void 0}function Bke(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function xP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function Hke(t,e){let r=Lke(t),n=e.lint?zke(t,e.lint,r):void 0,i=n?{...e,lint:n}:xP(e,"lint"),o=fp(r,"test"),s=o?Bke(o):void 0;return o&&!s?(i=xP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...fp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&qke(t,r)?{...i,test:{cmd:"npx",args:[...Ni,"jest"]},coverage:{cmd:"npx",args:[...Ni,"jest","--coverage"]}}:(s==="vitest"&&!fp(r,"coverage")&&!oJ(r,"@vitest/coverage-v8")&&!oJ(r,"@vitest/coverage-istanbul")?i=xP(i,"coverage"):s==="vitest"&&fp(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of Cke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=jke(t,o):r=Nke(t,[o]),r)break;if(!r||e.requiresSource&&!Pke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Hke(t,n):n;return{language:e.language,manifest:r,gates:i}}return Dke}var Ni,Ike,Cke,Dke,Mke,Fke,Uke,on=y(()=>{"use strict";Ev();Ni=["--offline","--no-install"];Ike=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);Cke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Ni,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Ni,"eslint","."]},test:{cmd:"npx",args:[...Ni,"vitest","run"]},coverage:{cmd:"npx",args:[...Ni,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Ni,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Ni,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},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:Oke},{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"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:Rke}],Dke={language:"unknown",manifest:"",gates:{}};Mke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Ni,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Ni,"oxlint"]}}],Fke=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"];Uke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Gke,readFileSync as Zke}from"node:fs";import{join as Vke}from"node:path";function za(t){return t.code==="ENOENT"}function Av(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 cJ.test(o)||cJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function qt(t,e,r,n=[]){if(za(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} -${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function tr(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 Ll(t,e){let r=Vke(t,"package.json");if(!Gke(r))return!1;try{return!!JSON.parse(Zke(r,"utf8")).scripts?.[e]}catch{return!1}}var cJ,On=y(()=>{"use strict";cJ=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|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 Wke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:Tv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Ye(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Tv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Av(i,Tv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Tv,Ua,Ov=y(()=>{"use strict";Mr();on();On();Tv="ARCHITECTURE_VIOLATION";Ua={name:Tv,subprocess:!0,run:Wke}});function Kke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Rv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Ye(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Rv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Av(i,Rv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Rv,qa,Iv=y(()=>{"use strict";Mr();on();On();Rv="HARDCODED_SECRET";qa={name:Rv,subprocess:!0,run:Kke}});import{existsSync as kP,readdirSync as lJ}from"node:fs";import{join as Pv}from"node:path";function Yke(t,e){let r=Pv(t,e.path);if(!kP(r))return!0;if(e.isDirectory)try{return lJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Xke(t){let{cwd:e="."}=t,r=[];for(let i of Jke)Yke(e,i)&&r.push({detector:mp,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=Pv(e,"spec.yaml");if(kP(n)){let i=tEe(n),o=i?null:Qke(e);if(i)r.push({detector:mp,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:mp,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=eEe(e);s&&r.push({detector:mp,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 Qke(t){for(let e of["spec/features","spec/scenarios"]){let r=Pv(t,e);if(!kP(r))continue;let n;try{n=lJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ai(Pv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function eEe(t){try{return H(t),null}catch(e){return e.message}}function tEe(t){let e;try{e=Ai(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var mp,Jke,uJ,dJ=y(()=>{"use strict";Be();j_();mp="ABSENCE_OF_GOVERNANCE",Jke=[{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}];uJ={name:mp,run:Xke}});function Cv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function EP(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=Cv(r)==="while",o=nEe.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 '${Cv(r)}'`}let n=rEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Cv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Cv(r)}'`:null}function iEe(t,e){let r=EP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function fJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...iEe(r,n));return e}var rEe,nEe,AP=y(()=>{"use strict";rEe={event:"when",state:"while",optional:"where",unwanted:"if"},nEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Be()});function oEe(t){let{cwd:e="."}=t;return ge(e,Dv,sEe)}function sEe(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:Dv,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 fJ(t.features))e.push({detector:Dv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Dv,pJ,mJ=y(()=>{"use strict";AP();wt();Dv="AC_DRIFT";pJ={name:Dv,run:oEe}});function ji(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return gJ[n]??hJ}var aEe,cEe,lEe,hJ,uEe,dEe,gJ,fEe,yJ,Ba=y(()=>{"use strict";on();aEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,cEe=/^[ \t]*import\s+([\w.]+)/gm,lEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,hJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:aEe,importStyle:"relative"},uEe={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:cEe,importStyle:"dotted"},dEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:lEe,importStyle:"dotted"},gJ={typescript:hJ,kotlin:uEe,python:dEe},fEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],yJ=new Set([...Object.values(gJ).flatMap(t=>t?.extensions??[]),...fEe].map(t=>t.toLowerCase()))});import{existsSync as pEe,readFileSync as mEe,readdirSync as hEe,statSync as gEe}from"node:fs";import{join as bJ,relative as _J}from"node:path";function yEe(t,e){if(!pEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=hEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=bJ(i,s),c;try{c=gEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function _Ee(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function vEe(t){return bEe.test(t)}function SEe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=ji(e,r.project?.language),o=i.sourceRoots.flatMap(a=>yEe(bJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=mEe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";Be();Ba();vJ="AI_HINTS_FORBIDDEN_PATTERN";bEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;SJ={name:vJ,run:SEe}});function wEe(t){let{cwd:e="."}=t,r;try{r=H(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:xJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var xJ,$J,kJ=y(()=>{"use strict";Be();xJ="AC_DUPLICATE_WITHIN_FEATURE";$J={name:xJ,run:wEe}});import{createRequire as xEe}from"module";import{basename as $Ee,dirname as OP,normalize as kEe,relative as EEe,resolve as AEe,sep as TJ}from"path";import*as TEe from"fs";function OEe(t){let e=kEe(t);return e.length>1&&e[e.length-1]===TJ&&(e=e.substring(0,e.length-1)),e}function OJ(t,e){return t.replace(REe,e)}function PEe(t){return t==="/"||IEe.test(t)}function TP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=AEe(t)),(n||o)&&(t=OEe(t)),t===".")return"";let s=t[t.length-1]!==i;return OJ(s?t+i:t,i)}function RJ(t,e){return e+t}function CEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:OJ(EEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function DEe(t){return t}function NEe(t,e,r){return e+t+r}function jEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?CEe(t,e):n?RJ:DEe}function MEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function FEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function qEe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?FEe(t):MEe(t):n&&n.length?zEe:LEe:UEe}function WEe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?VEe:r&&r.length?n?BEe:HEe:n?GEe:ZEe}function YEe(t){return t.group?JEe:KEe}function eAe(t){return t.group?XEe:QEe}function nAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?rAe:tAe}function IJ(t,e,r){if(r.options.useRealPaths)return iAe(e,r);let n=OP(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=OP(n)}return r.symlinks.set(t,e),i>1}function iAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Nv(t,e,r,n){e(t&&!n?t:null,r)}function pAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?oAe:lAe:n?e?sAe:fAe:i?e?cAe:dAe:e?aAe:uAe}function gAe(t){return t?hAe:mAe}function vAe(t,e){return new Promise((r,n)=>{DJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function DJ(t,e,r){new CJ(t,e,r).start()}function SAe(t,e){return new CJ(t,e).start()}var EJ,REe,IEe,LEe,zEe,UEe,BEe,HEe,GEe,ZEe,VEe,KEe,JEe,XEe,QEe,tAe,rAe,oAe,sAe,aAe,cAe,lAe,uAe,dAe,fAe,PJ,mAe,hAe,yAe,_Ae,bAe,CJ,AJ,NJ,jJ,MJ=y(()=>{EJ=xEe(import.meta.url);REe=/[\\/]/g;IEe=/^[a-z]:[\\/]$/i;LEe=(t,e)=>{e.push(t||".")},zEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},UEe=()=>{};BEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},HEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},GEe=(t,e,r,n)=>{r.files++},ZEe=(t,e)=>{e.push(t)},VEe=()=>{};KEe=t=>t,JEe=()=>[""].slice(0,0);XEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},QEe=()=>{};tAe=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()&&IJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},rAe=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()&&IJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};oAe=t=>t.counts,sAe=t=>t.groups,aAe=t=>t.paths,cAe=t=>t.paths.slice(0,t.options.maxFiles),lAe=(t,e,r)=>(Nv(e,r,t.counts,t.options.suppressErrors),null),uAe=(t,e,r)=>(Nv(e,r,t.paths,t.options.suppressErrors),null),dAe=(t,e,r)=>(Nv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),fAe=(t,e,r)=>(Nv(e,r,t.groups,t.options.suppressErrors),null);PJ={withFileTypes:!0},mAe=(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||".",PJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},hAe=(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||".",PJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};yAe=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))}},_Ae=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}},bAe=class{aborted=!1;abort(){this.aborted=!0}},CJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=pAe(e,this.isSynchronous),this.root=TP(t,e),this.state={root:PEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new _Ae,options:e,queue:new yAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new bAe,fs:e.fs||TEe},this.joinPath=jEe(this.root,e),this.pushDirectory=qEe(this.root,e),this.pushFile=WEe(e),this.getArray=YEe(e),this.groupFiles=eAe(e),this.resolveSymlink=nAe(e,this.isSynchronous),this.walkDirectory=gAe(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(_=TP(_,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=$Ee(_),x=TP(OP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};AJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return vAe(this.root,this.options)}withCallback(t){DJ(this.root,this.options,t)}sync(){return SAe(this.root,this.options)}},NJ=null;try{EJ.resolve("picomatch"),NJ=EJ("picomatch")}catch{}jJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:TJ,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 AJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new AJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||NJ;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 hp=v((jut,qJ)=>{"use strict";var FJ="[^\\\\/]",wAe="(?=.)",LJ="[^/]",RP="(?:\\/|$)",zJ="(?:^|\\/)",IP=`\\.{1,2}${RP}`,xAe="(?!\\.)",$Ae=`(?!${zJ}${IP})`,kAe=`(?!\\.{0,1}${RP})`,EAe=`(?!${IP})`,AAe="[^.\\/]",TAe=`${LJ}*?`,OAe="/",UJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:wAe,QMARK:LJ,END_ANCHOR:RP,DOTS_SLASH:IP,NO_DOT:xAe,NO_DOTS:$Ae,NO_DOT_SLASH:kAe,NO_DOTS_SLASH:EAe,QMARK_NO_DOT:AAe,STAR:TAe,START_ANCHOR:zJ,SEP:OAe},RAe={...UJ,SLASH_LITERAL:"[\\\\/]",QMARK:FJ,STAR:`${FJ}*?`,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:"\\"},IAe={__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"};qJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:IAe,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?RAe:UJ}}});var gp=v(Fr=>{"use strict";var{REGEX_BACKSLASH:PAe,REGEX_REMOVE_BACKSLASH:CAe,REGEX_SPECIAL_CHARS:DAe,REGEX_SPECIAL_CHARS_GLOBAL:NAe}=hp();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>DAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(NAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(PAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(CAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var JJ=v((Fut,KJ)=>{"use strict";var BJ=gp(),{CHAR_ASTERISK:PP,CHAR_AT:jAe,CHAR_BACKWARD_SLASH:yp,CHAR_COMMA:MAe,CHAR_DOT:CP,CHAR_EXCLAMATION_MARK:DP,CHAR_FORWARD_SLASH:WJ,CHAR_LEFT_CURLY_BRACE:NP,CHAR_LEFT_PARENTHESES:jP,CHAR_LEFT_SQUARE_BRACKET:FAe,CHAR_PLUS:LAe,CHAR_QUESTION_MARK:HJ,CHAR_RIGHT_CURLY_BRACE:zAe,CHAR_RIGHT_PARENTHESES:GJ,CHAR_RIGHT_SQUARE_BRACKET:UAe}=hp(),ZJ=t=>t===WJ||t===yp,VJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},qAe=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,ie=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&ZJ(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=BJ.removeBackslashes(P)),xe&&_===!0&&(xe=BJ.removeBackslashes(xe)));let Ir={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,ZJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var _p=hp(),sn=gp(),{MAX_LENGTH:jv,POSIX_REGEX_SOURCE:BAe,REGEX_NON_SPECIAL_CHARS:HAe,REGEX_SPECIAL_CHARS_BACKREF:GAe,REPLACEMENTS:YJ}=_p,ZAe=(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=>sn.escapeRegex(i)).join("..")}return r},zl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,XJ=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},VAe=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},QJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(VAe(e))return e.replace(/\\(.)/g,"$1")},WAe=t=>{let e=t.map(QJ).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}}}}},KAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=QJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},JAe=t=>{let e=0,r=t.trim(),n=MP(r);for(;n;)e++,r=n.body.trim(),n=MP(r);return e},YAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:_p.DEFAULT_MAX_EXTGLOB_RECURSION,n=XJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||WAe(n)))return{risky:!0};for(let i of n){let o=KAe(i);if(o)return{risky:!0,safeOutput:o};if(JAe(i)>r)return{risky:!0}}return{risky:!1}},FP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=YJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(jv,r.maxLength):jv,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=_p.globChars(r.windows),l=_p.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=sn.removePrefix(t,$),i=t.length;let ie=[],K=[],xe=[],C=o,P,Ir=()=>$.index===i-1,se=$.peek=(B=1)=>t[$.index+B],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(B="",ht=0)=>{$.consumed+=B,$.index+=ht},Yt=B=>{$.output+=B.output!=null?B.output:B.value,dr(B.value)},co=()=>{let B=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,B++;return B%2===0?!1:($.negated=!0,$.start++,!0)},wi=B=>{$[B]++,xe.push(B)},Yr=B=>{$[B]--,xe.pop()},de=B=>{if(C.type==="globstar"){let ht=$.braces>0&&(B.type==="comma"||B.type==="brace"),q=B.extglob===!0||ie.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ht&&!q&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(ie.length&&B.type!=="paren"&&(ie[ie.length-1].inner+=B.value),(B.value||B.output)&&Yt(B),C&&C.type==="text"&&B.type==="text"){C.output=(C.output||C.value)+B.value,C.value+=B.value;return}B.prev=C,s.push(B),C=B},lo=(B,ht)=>{let q={...l[ht],conditions:1,inner:""};q.prev=C,q.parens=$.parens,q.output=$.output,q.startIndex=$.index,q.tokensIndex=s.length;let Oe=(r.capture?"(":"")+q.open;wi("parens"),de({type:B,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),ie.push(q)},Ode=B=>{let ht=t.slice(B.startIndex,$.index+1),q=t.slice(B.startIndex+2,$.index),Oe=YAe(q,r);if((B.type==="plus"||B.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(B.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,xi=s[B.tokensIndex];xi.type="text",xi.value=ht,xi.output=lt||sn.escapeRegex(ht);for(let $i=B.tokensIndex+1;$i1&&B.inner.includes("/")&&(lt=O(r)),(lt!==D||Ir()||/^\)+$/.test(Kt()))&&(ut=B.close=`)$))${lt}`),B.inner.includes("*")&&(Lt=Kt())&&/^\.[^\\/.]+$/.test(Lt)){let xi=FP(Lt,{...e,fastpaths:!1}).output;ut=B.close=`)${xi})${lt})`}B.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ht=t.replace(GAe,(q,Oe,ut,Lt,lt,xi)=>Lt==="\\"?(B=!0,q):Lt==="?"?Oe?Oe+Lt+(lt?_.repeat(lt.length):""):xi===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):Lt==="."?u.repeat(ut.length):Lt==="*"?Oe?Oe+Lt+(lt?D:""):D:Oe?q:`\\${q}`);return B===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=sn.wrapOutput(ht,$,e),$)}for(;!Ir();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let q=se();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let q=C.value.slice(1);if(q.includes("[")&&(C.posix=!0,q.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),Lt=C.value.slice(Oe+2),lt=BAe[Lt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Yt({value:P});continue}if($.quotes===1&&P!=='"'){P=sn.escapeRegex(P),C.value+=P,Yt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){wi("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(zl("opening","("));let q=ie[ie.length-1];if(q&&$.parens===q.parens+1){Ode(ie.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Yr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(zl("closing","]"));P=`\\${P}`}else wi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(zl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Yr("brackets");let q=C.value.slice(1);if(C.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(P=`/${P}`),C.value+=P,Yt({value:P}),r.literalBrackets===!1||sn.hasRegexChars(q))continue;let Oe=sn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){wi("braces");let q={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(q),de(q);continue}if(P==="}"){let q=K[K.length-1];if(r.nobrace===!0||!q){de({type:"text",value:P,output:P});continue}let Oe=")";if(q.dots===!0){let ut=s.slice(),Lt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&Lt.unshift(ut[lt].value);Oe=ZAe(Lt,r),$.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let ut=$.output.slice(0,q.outputIndex),Lt=$.tokens.slice(q.tokensIndex);q.value=q.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of Lt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),Yr("braces"),K.pop();continue}if(P==="|"){ie.length>0&&ie[ie.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let q=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,q="|"),de({type:"comma",value:P,output:q});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let q=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,q.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){lo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){lo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){co();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){lo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let q=HAe.exec(Kt());q&&(P+=q[0],$.index+=q[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let B=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){lo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let q=C.prev,Oe=q.prev,ut=q.type==="slash"||q.type==="bos",Lt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(q.type==="comma"||q.type==="brace"),xi=ie.length&&(q.type==="pipe"||q.type==="paren");if(!ut&&q.type!=="paren"&&!lt&&!xi){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let $i=t[$.index+4];if($i&&$i!=="/")break;B=B.slice(3),dr("/**",3)}if(q.type==="bos"&&Ir()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!Lt&&Ir()){$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=q.output+C.output,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&B[0]==="/"){let $i=B[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${$i})`,C.value+=P,$.output+=q.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&B[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(zl("closing","]"));$.output=sn.escapeLast($.output,"["),Yr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(zl("closing",")"));$.output=sn.escapeLast($.output,"("),Yr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(zl("closing","}"));$.output=sn.escapeLast($.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let B of $.tokens)$.output+=B.output!=null?B.output:B.value,B.suffix&&($.output+=B.suffix)}return $};FP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(jv,r.maxLength):jv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=YJ[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}=_p.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};e8.exports=FP});var i8=v((zut,n8)=>{"use strict";var XAe=JJ(),LP=t8(),r8=gp(),QAe=hp(),eTe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=eTe(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?Rt.compileRe(t,e):Rt.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=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.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};Rt.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?r8.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=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(r8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):LP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>XAe(t,e);Rt.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=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.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=LP.fastpaths(t,e)),i.output||(i=LP(t,e)),Rt.compileRe(i,e,r,n)};Rt.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/$^/}};Rt.constants=QAe;n8.exports=Rt});var c8=v((Uut,a8)=>{"use strict";var o8=i8(),tTe=gp();function s8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:tTe.isWindows()}),o8(t,e,r)}Object.assign(s8,o8);a8.exports=s8});import{readdir as rTe,readdirSync as nTe,realpath as iTe,realpathSync as oTe,stat as sTe,statSync as aTe}from"fs";import{isAbsolute as cTe,posix as Ha,resolve as lTe}from"path";import{fileURLToPath as uTe}from"url";function pTe(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]===".."&&fTe.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=>Ha.relative(t,n)||".":n=>Ha.relative(t,`${e}/${n}`)||"."}function gTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ha.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function f8(t){var e;let r=Ul.default.scan(t,yTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function xTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Ul.default.scan(t);return r.isGlob||r.negated}function bp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function p8(t){return typeof t=="string"?[t]:t??[]}function zP(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=wTe(o);s=cTe(s.replace(kTe,""))?Ha.relative(a,s):Ha.normalize(s);let c=(i=$Te.exec(s))===null||i===void 0?void 0:i[0],l=f8(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?Ha.join(o,...d):o}return s}function ETe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(zP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(zP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(zP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function ATe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=ETe(t,e,n);t.debug&&bp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(u8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Ul.default)(i.match,f),m=(0,Ul.default)(i.ignore,f),h=pTe(i.match,f),g=l8(r,d,o),b=o?g:l8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new jJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&bp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return bp(`${T?"skipped":"crawling"} ${O}`),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&&bp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&gTe(r,d)]}function TTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function RTe(t){let e={...OTe,...t};return e.cwd=(e.cwd instanceof URL?uTe(e.cwd):lTe(e.cwd)).replace(u8,"/"),e.ignore=p8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||rTe,readdirSync:e.fs.readdirSync||nTe,realpath:e.fs.realpath||iTe,realpathSync:e.fs.realpathSync||oTe,stat:e.fs.stat||sTe,statSync:e.fs.statSync||aTe}),e.debug&&bp("globbing with options:",e),e}function ITe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=dTe(t)||typeof t=="string",i=p8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=RTe(n?e:t);return i.length>0?ATe(o,i):[]}function ys(t,e){let[r,n]=ITe(t,e);return r?TTe(r.sync(),n):[]}var Ul,dTe,u8,d8,fTe,mTe,hTe,yTe,_Te,bTe,vTe,STe,wTe,$Te,kTe,OTe,vp=y(()=>{MJ();Ul=St(c8(),1),dTe=Array.isArray,u8=/\\/g,d8=process.platform==="win32",fTe=/^(\/?\.\.)+$/;mTe=/^[A-Z]:\/$/i,hTe=d8?t=>mTe.test(t):t=>t==="/";yTe={parts:!0};_Te=/(?t.replace(_Te,"\\$&"),STe=t=>t.replace(bTe,"\\$&"),wTe=d8?STe:vTe;$Te=/^(\/?\.\.)+/,kTe=/\\(?=[()[\]{}!*+?@|])/g;OTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Sp,readFileSync as PTe,readdirSync as CTe,statSync as m8}from"node:fs";import{join as Ga}from"node:path";function DTe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=ji(e,n),o=[],{layers:s,forbiddenImports:a}=UP(r);return(s.size>0||a.length>0)&&!Sp(Ga(e,i.mainRoot))?[{detector:wp,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(NTe(e,i,s,o),jTe(e,i,s,o)),a.length>0&&MTe(e,i,a,o),o)}function UP(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 NTe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(Sp(o))for(let s of CTe(o)){let a=Ga(o,s);m8(a).isDirectory()&&(r.has(s)||n.push({detector:wp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function jTe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(Sp(o))for(let s of r){let a=Ga(o,s);Sp(a)&&m8(a).isDirectory()||n.push({detector:wp,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 MTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ga(t,i,s.from);if(!Sp(a))continue;let c=ys([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ga(a,l),d;try{d=PTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];FTe(p,s.to,e.importStyle)&&n.push({detector:wp,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 FTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var wp,h8,qP=y(()=>{"use strict";vp();Be();Ba();wp="ARCHITECTURE_FROM_SPEC";h8={name:wp,run:DTe}});import{existsSync as LTe,readFileSync as zTe}from"node:fs";import{join as UTe}from"node:path";function BTe(t){let{cwd:e="."}=t,r=UTe(e,"spec/capabilities.yaml");if(!LTe(r))return[];let n;try{let u=zTe(r,"utf8"),d=g8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=H(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size{"use strict";g8=St(Qt(),1);Be();Mv="CAPABILITIES_FEATURE_MAPPING",qTe=8;y8={name:Mv,run:BTe}});import{existsSync as HTe,readFileSync as GTe}from"node:fs";import{join as ZTe}from"node:path";function VTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function WTe(t){let{cwd:e="."}=t;return ge(e,BP,r=>KTe(r,e))}function KTe(t,e){let r=ji(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=ZTe(e,o);if(!HTe(s))continue;let a=GTe(s,"utf8");VTe(a)||n.push({detector:BP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var BP,b8,v8=y(()=>{"use strict";Ba();wt();BP="CONVENTION_DRIFT";b8={name:BP,run:WTe}});import{existsSync as HP,readFileSync as S8}from"node:fs";import{join as Fv}from"node:path";function JTe(t){return JSON.parse(t).total?.lines?.pct??0}function w8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function QTe(t,e){if(!wv(dt(t).gates.coverage?.cmd))return null;let r;try{r=xv(t,e)}catch(c){return[{detector:xo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=SP.find(d=>HP(Fv(c.dir,d)));if(!l){s.push(c.path);continue}let u=w8(S8(Fv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:xo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=x8(n,i);return a0?[{detector:xo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function eOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=QTe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=ji(e,r),i=dt(e).language==="kotlin"?SP.find(a=>HP(Fv(e,a)))??iJ(e):n.coverageSummary,o=Fv(e,i);if(!HP(o))return[{detector:xo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=S8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?YTe(a):n.coverageFormat==="cobertura-xml"?XTe(a):JTe(a)}catch(a){return[{detector:xo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:xo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Lv?[]:[{detector:xo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Lv}%`}]}var xo,Lv,$8,k8=y(()=>{"use strict";Be();Ev();Ba();$v();on();xo="COVERAGE_DROP",Lv=70;$8={name:xo,run:eOe}});import{existsSync as tOe}from"node:fs";import{join as rOe}from"node:path";function iOe(t){let{cwd:e="."}=t;return ge(e,zv,r=>oOe(r,e))}function oOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";wt();zv="DELIVERABLE_INTEGRITY",nOe=8;E8={name:zv,run:iOe}});function sOe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Uv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function aOe(t){let e=sOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Uv,severity:"warn",path:"spec.yaml",message:`${r.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 cOe(t){let{cwd:e="."}=t;return ge(e,Uv,r=>aOe(r))}var Uv,T8,O8=y(()=>{"use strict";wt();Uv="SMOKE_PROBE_DEMAND";T8={name:Uv,run:cOe}});function lOe(t){let{cwd:e="."}=t;return ge(e,qv,r=>uOe(r,e))}function uOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=as(e);if(n===null)return[{detector:qv,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=q_(n,e,o);s.state!=="fresh"&&i.push({detector:qv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${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.`:s.module?`${o.id}'s module ${s.module} 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.`:`${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 qv,Bv,GP=y(()=>{"use strict";gl();wt();qv="STALE_ATTESTATION";Bv={name:qv,run:lOe}});function dOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return fOe(r)}function fOe(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:R8,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 R8,Hv,ZP=y(()=>{"use strict";Be();R8="DEPENDENCY_CYCLE";Hv={name:R8,run:dOe}});import{appendFileSync as pOe,existsSync as I8,mkdirSync as mOe,readFileSync as hOe}from"node:fs";import{dirname as gOe,join as yOe}from"node:path";function P8(t){return yOe(t,_Oe,bOe)}function C8(t){return VP.add(t),()=>VP.delete(t)}function Za(t,e){let r=P8(t),n=gOe(r);I8(n)||mOe(n,{recursive:!0}),pOe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of VP)try{i(t,e)}catch{}}function Rn(t){let e=P8(t);if(!I8(e))return[];let r=hOe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var _Oe,bOe,VP,ri=y(()=>{"use strict";_Oe=".cladding",bOe="audit.log.jsonl";VP=new Set});import{existsSync as vOe}from"node:fs";import{join as SOe}from"node:path";function wOe(t){let{cwd:e="."}=t,r=Rn(e);if(r.length===0)return[{detector:WP,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&&(vOe(SOe(e,i.artifact))||n.push({detector:WP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var WP,D8,N8=y(()=>{"use strict";ri();WP="EVIDENCE_MISMATCH";D8={name:WP,run:wOe}});import{existsSync as xOe,readFileSync as $Oe}from"node:fs";import{join as kOe}from"node:path";function EOe(t){let e=kOe(t,L8);if(!xOe(e))return null;try{let n=((0,F8.parse)($Oe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*M8(t,e){for(let r of t??[])r.startsWith(j8)&&(yield{ref:r,name:r.slice(j8.length),field:e})}function AOe(t){let{cwd:e="."}=t,r=EOe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:KP,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=[...M8(s.evidence_refs,"evidence_refs"),...M8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:KP,severity:"warn",path:L8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var F8,KP,j8,L8,z8,U8=y(()=>{"use strict";F8=St(Qt(),1);Be();KP="FIXTURE_REFERENCE_INVALID",j8="fixture:",L8="conformance/fixtures.yaml";z8={name:KP,run:AOe}});import{existsSync as ql,readFileSync as JP}from"node:fs";import{join as Va}from"node:path";function TOe(t){return ys(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function xp(t){if(!ql(t))return null;try{return JSON.parse(JP(t,"utf8"))}catch{return null}}function OOe(t,e){let r=Va(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(JP(r,"utf8"))}catch(c){e.push({detector:$o,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:$o,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=TOe(t);s!==a&&e.push({detector:$o,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function ROe(t,e){for(let r of q8){let n=Va(t,r.path);if(!ql(n))continue;let i=xp(n);if(!i){e.push({detector:$o,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:$o,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function IOe(t,e){let r=xp(Va(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of q8){let s=Va(t,o.path);if(!ql(s))continue;let a=xp(s);a?.version&&a.version!==n&&e.push({detector:$o,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Va(t,".claude-plugin","marketplace.json");if(ql(i)){let o=xp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:$o,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 POe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function COe(t,e){let r=Va(t,"src","cli","clad.ts"),n=Va(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!ql(r)||!ql(n))return;let i=POe(JP(r,"utf8"));if(i.length===0)return;let s=xp(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:$o,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 DOe(t){let{cwd:e="."}=t,r=[];return OOe(e,r),COe(e,r),ROe(e,r),IOe(e,r),r}var $o,q8,B8,H8=y(()=>{"use strict";vp();$o="HARNESS_INTEGRITY",q8=[{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"]}];B8={name:$o,run:DOe}});import{existsSync as NOe,readFileSync as jOe}from"node:fs";import{join as MOe}from"node:path";function LOe(t){let{cwd:e="."}=t;return ge(e,Gv,r=>UOe(r,e))}function zOe(t){let e=MOe(t,"spec/capabilities.yaml");if(!NOe(e))return!1;try{let r=G8.default.parse(jOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function UOe(t,e){let r=t.features.length;if(r{"use strict";G8=St(Qt(),1);wt();Gv="HOLLOW_GOVERNANCE",FOe=8;Z8={name:Gv,run:LOe}});import{existsSync as W8,readFileSync as K8}from"node:fs";import{join as J8}from"node:path";function Y8(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function HOe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function GOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function ZOe(t){let e=J8(t,"README.md"),r=J8(t,"docs","dogfood","matrix.md");if(!W8(e)||!W8(r))return[];let n=Y8(K8(e,"utf8"),qOe),i=Y8(K8(r,"utf8"),BOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=GOe(a);if(c===null)continue;let l=i[s]??"not-run",u=HOe(l);u!==null&&c>u&&o.push({detector:X8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function VOe(t){let{cwd:e="."}=t;return ZOe(e)}var X8,qOe,BOe,Q8,e5=y(()=>{"use strict";X8="HOST_CLAIM_DRIFT",qOe=//,BOe=//;Q8={name:X8,run:VOe}});function WOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return t5(r.features.map(i=>i.id),"feature","spec/features/",n),t5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function t5(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:r5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var r5,n5,i5=y(()=>{"use strict";Be();r5="ID_COLLISION";n5={name:r5,run:WOe}});import{existsSync as $p,readFileSync as YP,readdirSync as XP,statSync as KOe,writeFileSync as s5}from"node:fs";import{join as ko}from"node:path";function o5(t){if(!$p(t))return 0;try{return XP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function JOe(t){if(!$p(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=XP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=ko(n,o),a;try{a=KOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function YOe(t){let e=ko(t,"spec","capabilities.yaml");if(!$p(e))return 0;try{let r=Zv.default.parse(YP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function _s(t="."){let e=o5(ko(t,"spec","features")),r=o5(ko(t,"spec","scenarios")),n=YOe(t),i=JOe(ko(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Bl(t,e){let r=ko(t,"spec.yaml");if(!$p(r))return;let n=YP(r,"utf8"),i=XOe(n,e);i!==n&&s5(r,i)}function XOe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as Uxe}from"node:buffer";import{StringDecoder as qxe}from"node:string_decoder";var tv,Bxe,Hxe,Gxe,_I=y(()=>{nn();tv=(t,e,r)=>{if(r)return;if(t)return{transform:Bxe.bind(void 0,new TextEncoder)};let n=new qxe(e);return{transform:Hxe.bind(void 0,n),final:Gxe.bind(void 0,n)}},Bxe=function*(t,e){Uxe.isBuffer(e)?yield _o(e):typeof e=="string"?yield t.encode(e):yield e},Hxe=function*(t,e){yield qt(e)?t.write(e):e},Gxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as YW}from"node:util";var bI,rv,XW,Zxe,QW,Vxe,e3=y(()=>{bI=YW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),rv=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Vxe}=e[r];for await(let i of n(t))yield*rv(i,e,r+1)},XW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Zxe(r,Number(e),t)},Zxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*rv(n,r,e+1)},QW=YW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Vxe=function*(t){yield t}});var vI,t3,Ma,op,Wxe,Kxe,SI=y(()=>{vI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},t3=(t,e)=>[...e.flatMap(r=>[...Ma(r,t,0)]),...op(t)],Ma=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Kxe}=e[r];for(let i of n(t))yield*Ma(i,e,r+1)},op=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Wxe(r,Number(e),t)},Wxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ma(n,r,e+1)},Kxe=function*(t){yield t}});import{Transform as Jxe,getDefaultHighWaterMark as r3}from"node:stream";var wI,nv,n3,iv=y(()=>{Sr();ev();JW();_I();e3();SI();wI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=n3(t,s,o),l=ja(e),u=ja(r),d=l?bI.bind(void 0,rv,a):vI.bind(void 0,Ma),f=l||u?bI.bind(void 0,XW,a):vI.bind(void 0,op),p=l||u?QW.bind(void 0,a):void 0;return{stream:new Jxe({writableObjectMode:n,writableHighWaterMark:r3(n),readableObjectMode:i,readableHighWaterMark:r3(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},nv=(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=n3(s,r,a);t=t3(c,t)}return t},n3=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:VW(n,a)},tv(r,s,n),Qb(r,o,n,c),{transform:t,final:e},{transform:WW(i,a)},ZW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var i3,Yxe,Xxe,Qxe,e0e,o3=y(()=>{iv();nn();Sr();i3=(t,e)=>{for(let r of Yxe(t))Xxe(t,r,e)},Yxe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Xxe=(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 ${ps[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Qxe(a,n));r.input=Bf(s)},Qxe=(t,e)=>{let r=nv(t,e,"utf8",!0);return e0e(r),Bf(r)},e0e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(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 ov,t0e,r0e,s3,a3,n0e,c3,xI=y(()=>{Pa();Sr();El();ls();ov=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&kl(r,n)&&!on.has(e)&&t0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&r0e.has(o))||t.every(({type:i})=>On.has(i))),t0e=t=>t===1||t===2,r0e=new Set(["pipe","overlapped"]),s3=async(t,e,r,n)=>{for await(let i of t)n0e(e)||c3(i,r,n)},a3=(t,e,r)=>{for(let n of t)c3(n,e,r)},n0e=t=>t._readableState.pipes.length>0,c3=(t,e,r)=>{let n=ib(t);Pi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as i0e,appendFileSync as o0e}from"node:fs";var l3,s0e,a0e,c0e,l0e,u0e,u3=y(()=>{xI();iv();ev();nn();Sr();Na();l3=({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)=>s0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},s0e=({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=WV(t,o,d),p=_o(f),{stdioItems:m,objectMode:h}=e[r],g=a0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=c0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});l0e({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&&u0e(b,m,i),S}catch(x){return n.error=x,S}},a0e=(t,e,r,n)=>{try{return nv(t,e,r,!1)}catch(i){return n.error=i,t}},c0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Bf(t)};let s=FG(t,r);return n[o]?{serializedResult:s,finalResult:yI(s,!i[o],e)}:{serializedResult:s}},l0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!ov({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=yI(t,!1,s);try{a3(a,e,n)}catch(c){r.error??=c}},u0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Jb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?o0e(n,t):(r.add(o),i0e(n,t))}}});var d3,f3=y(()=>{nn();ip();d3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,xo(e,r,"all")]:Array.isArray(e)?[xo(t,r,"all"),...e]:qt(t)&&qt(e)?fR([t,e]):`${t}${e}`}});import{once as $I}from"node:events";var p3,d0e,m3,h3,f0e,kI,EI=y(()=>{Ra();p3=async(t,e)=>{let[r,n]=await d0e(t);return e.isForcefullyTerminated??=!1,[r,n]},d0e=async t=>{let[e,r]=await Promise.allSettled([$I(t,"spawn"),$I(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?m3(t):r.value},m3=async t=>{try{return await $I(t,"exit")}catch{return m3(t)}},h3=async t=>{let[e,r]=await t;if(!f0e(e,r)&&kI(e,r))throw new ei;return[e,r]},f0e=(t,e)=>t===void 0&&e===void 0,kI=(t,e)=>t!==0||e!==null});var g3,p0e,y3=y(()=>{Ra();Na();EI();g3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=p0e(t,e,r),s=o?.code==="ETIMEDOUT",a=VV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},p0e=(t,e,r)=>t!==void 0?t:kI(e,r)?new ei:void 0});import{spawnSync as m0e}from"node:child_process";var _3,h0e,g0e,y0e,sv,_0e,b0e,v0e,S0e,b3=y(()=>{SR();KR();JR();np();Vb();BW();ip();o3();u3();Na();f3();y3();_3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=h0e(t,e,r),d=_0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ml(d,c,l)},h0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ab(t,e,r),a=g0e(r),{file:c,commandArguments:l,options:u}=Db(t,e,a);y0e(u);let d=UW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},g0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,y0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&sv("ipcInput"),t&&sv("ipc: true"),r&&sv("detached: true"),n&&sv("cancelSignal")},sv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},_0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=b0e({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}=g3(c,r),{output:m,error:h=l}=l3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>xo(_,r,S)),b=xo(d3(m,r),r,"all");return S0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},b0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{i3(o,r);let a=v0e(r);return m0e(...Nb(t,e,a))}catch(a){return jl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},v0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Gb(e)}),S0e=({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?Zb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):rp({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 AI,on as w0e}from"node:events";var v3,x0e,$0e,k0e,E0e,S3=y(()=>{Il();Yf();Jf();v3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Ol({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Ab(t)}),x0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),x0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{vb(e,i);let o=fs(t,e,r),s=new AbortController;try{return await Promise.race([$0e(o,n,s),k0e(o,r,s),E0e(o,r,s)])}catch(a){throw Rl(t),a}finally{s.abort(),Sb(e,i)}},$0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await AI(t,"message",{signal:r});return n}for await(let[n]of w0e(t,"message",{signal:r}))if(e(n))return n},k0e=async(t,e,{signal:r})=>{await AI(t,"disconnect",{signal:r}),P9(e)},E0e=async(t,e,{signal:r})=>{let[n]=await AI(t,"strict:error",{signal:r});throw gb(n,e)}});import{once as x3,on as A0e}from"node:events";var $3,TI,T0e,O0e,R0e,w3,OI=y(()=>{Il();Yf();Jf();$3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>TI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),TI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Ol({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Ab(t)}),vb(e,o);let s=fs(t,e,r),a=new AbortController,c={};return T0e(t,s,a),O0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),R0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},T0e=async(t,e,r)=>{try{await x3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},O0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await x3(t,"strict:error",{signal:r.signal});n.error=gb(i,e),r.abort()}catch{}},R0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of A0e(r,"message",{signal:o.signal}))w3(s),yield c}catch{w3(s)}finally{o.abort(),Sb(e,a),n||Rl(t),i&&await t}},w3=({error:t})=>{if(t)throw t}});import k3 from"node:process";var E3,A3,T3,RI=y(()=>{Pb();S3();OI();kb();E3=(t,{ipc:e})=>{Object.assign(t,T3(t,!1,e))},A3=()=>{let t=k3,e=!0,r=k3.channel!==void 0;return{...T3(t,e,r),getCancelSignal:sV.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},T3=(t,e,r)=>({sendMessage:Ib.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:v3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:$3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as I0e}from"node:child_process";import{PassThrough as P0e,Readable as C0e,Writable as D0e,Duplex as N0e}from"node:stream";var O3,j0e,sp,M0e,F0e,L0e,z0e,R3=y(()=>{Xb();np();Vb();O3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{mI(n);let a=new I0e;j0e(a,n),Object.assign(a,{readable:M0e,writable:F0e,duplex:L0e});let c=jl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=z0e(c,s,i);return{subprocess:a,promise:l}},j0e=(t,e)=>{let r=sp(),n=sp(),i=sp(),o=Array.from({length:e.length-3},sp),s=sp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},sp=()=>{let t=new P0e;return t.end(),t},M0e=()=>new C0e({read(){}}),F0e=()=>new D0e({write(){}}),L0e=()=>new N0e({read(){},write(){}}),z0e=async(t,e,r)=>Ml(t,e,r)});import{createReadStream as I3,createWriteStream as P3}from"node:fs";import{Buffer as U0e}from"node:buffer";import{Readable as ap,Writable as q0e,Duplex as B0e}from"node:stream";var D3,cp,C3,H0e,N3=y(()=>{iv();Xb();Sr();D3=(t,e)=>Yb(H0e,t,e,!1),cp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ps[t]}.`)},C3={fileNumber:cp,generator:wI,asyncGenerator:wI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:B0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},H0e={input:{...C3,fileUrl:({value:t})=>({stream:I3(t)}),filePath:({value:{file:t}})=>({stream:I3(t)}),webStream:({value:t})=>({stream:ap.fromWeb(t)}),iterable:({value:t})=>({stream:ap.from(t)}),asyncIterable:({value:t})=>({stream:ap.from(t)}),string:({value:t})=>({stream:ap.from(t)}),uint8Array:({value:t})=>({stream:ap.from(U0e.from(t))})},output:{...C3,fileUrl:({value:t})=>({stream:P3(t)}),filePath:({value:{file:t,append:e}})=>({stream:P3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:q0e.fromWeb(t)}),iterable:cp,asyncIterable:cp,string:cp,uint8Array:cp}}});import{on as G0e,once as j3}from"node:events";import{PassThrough as Z0e,getDefaultHighWaterMark as V0e}from"node:stream";import{finished as L3}from"node:stream/promises";function Fa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)PI(i);let e=t.some(({readableObjectMode:i})=>i),r=W0e(t,e),n=new II({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var W0e,II,K0e,J0e,Y0e,PI,X0e,Q0e,e$e,t$e,r$e,z3,U3,CI,q3,n$e,av,M3,F3,cv=y(()=>{W0e=(t,e)=>{if(t.length===0)return V0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},II=class extends Z0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(PI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=K0e(this,this.#t,this.#o);let r=X0e({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(PI(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)}},K0e=async(t,e,r)=>{av(t,M3);let n=new AbortController;try{await Promise.race([J0e(t,n),Y0e(t,e,r,n)])}finally{n.abort(),av(t,-M3)}},J0e=async(t,{signal:e})=>{try{await L3(t,{signal:e,cleanup:!0})}catch(r){throw z3(t,r),r}},Y0e=async(t,e,r,{signal:n})=>{for await(let[i]of G0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},PI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},X0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{av(t,F3);let a=new AbortController;try{await Promise.race([Q0e(o,e,a),e$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),t$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),av(t,-F3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?CI(t):r$e(t))},Q0e=async(t,e,{signal:r})=>{try{await t,r.aborted||CI(e)}catch(n){r.aborted||z3(e,n)}},e$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await L3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;U3(s)?i.add(e):q3(t,s)}},t$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await j3(t,i,{signal:o}),!t.readable)return j3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},r$e=t=>{t.writable&&t.end()},z3=(t,e)=>{U3(e)?CI(t):q3(t,e)},U3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",CI=t=>{(t.readable||t.writable)&&t.destroy()},q3=(t,e)=>{t.destroyed||(t.once("error",n$e),t.destroy(e))},n$e=()=>{},av=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},M3=2,F3=1});import{finished as B3}from"node:stream/promises";var Ll,i$e,DI,o$e,NI,lv=y(()=>{bo();Ll=(t,e)=>{t.pipe(e),i$e(t,e),o$e(t,e)},i$e=async(t,e)=>{if(!(Qn(t)||Qn(e))){try{await B3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}DI(e)}},DI=t=>{t.writable&&t.end()},o$e=async(t,e)=>{if(!(Qn(t)||Qn(e))){try{await B3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}NI(t)}},NI=t=>{t.readable&&t.destroy()}});var H3,s$e,a$e,c$e,l$e,u$e,G3=y(()=>{cv();bo();bb();Sr();lv();H3=(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})=>On.has(c)))s$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!On.has(c)))c$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]:Fa(o);Ll(s,i)}},s$e=(t,e,r,n)=>{r==="output"?Ll(t.stdio[n],e):Ll(e,t.stdio[n]);let i=a$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},a$e=["stdin","stdout","stderr"],c$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;l$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])},l$e=(t,{signal:e})=>{Qn(t)&&Ia(t,u$e,e)},u$e=2});var La,Z3=y(()=>{La=[];La.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&La.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&La.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var uv,jI,MI,d$e,FI,dv,f$e,LI,zI,UI,V3,rat,nat,W3=y(()=>{Z3();uv=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",jI=Symbol.for("signal-exit emitter"),MI=globalThis,d$e=Object.defineProperty.bind(Object),FI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(MI[jI])return MI[jI];d$e(MI,jI,{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}},dv=class{},f$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),LI=class extends dv{onExit(){return()=>{}}load(){}unload(){}},zI=class extends dv{#t=UI.platform==="win32"?"SIGINT":"SIGHUP";#r=new FI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of La)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(!uv(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 La)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,La.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 uv(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"&&uv(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)}},UI=globalThis.process,{onExit:V3,load:rat,unload:nat}=f$e(uv(UI)?new zI(UI):new LI)});import{addAbortListener as p$e}from"node:events";var K3,J3=y(()=>{W3();K3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=V3(()=>{t.kill()});p$e(n,()=>{i()})}});var X3,m$e,h$e,Y3,g$e,Q3=y(()=>{dR();sb();ds();xl();X3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=ob(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=m$e(r,n,i),{sourceStream:d,sourceError:f}=g$e(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}},m$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=h$e(t,e,...r),a=_b(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},h$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Y3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||lR(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]=W_(r,...n);return{destination:e(Y3)(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}`)},Y3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),g$e=(t,e)=>{try{return{sourceStream:Cl(t,e)}}catch(r){return{sourceError:r}}}});var tK,y$e,qI,eK,BI=y(()=>{np();lv();tK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=y$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw qI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},y$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return NI(t),n;if(e!==void 0)return DI(r),e},qI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>jl({error:t,command:eK,escapedCommand:eK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),eK="source.pipe(destination)"});var rK,nK=y(()=>{rK=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 _$e}from"node:stream/promises";var iK,b$e,v$e,S$e,fv,w$e,x$e,oK=y(()=>{cv();bb();lv();iK=(t,e,r)=>{let n=fv.has(e)?v$e(t,e):b$e(t,e);return Ia(t,w$e,r.signal),Ia(e,x$e,r.signal),S$e(e),n},b$e=(t,e)=>{let r=Fa([t]);return Ll(r,e),fv.set(e,r),r},v$e=(t,e)=>{let r=fv.get(e);return r.add(t),r},S$e=async t=>{try{await _$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}fv.delete(t)},fv=new WeakMap,w$e=2,x$e=1});import{aborted as $$e}from"node:util";var sK,k$e,aK=y(()=>{BI();sK=(t,e)=>t===void 0?[]:[k$e(t,e)],k$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await $$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw qI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var pv,E$e,A$e,cK=y(()=>{yo();Q3();BI();nK();oK();aK();pv=(t,...e)=>{if(Ot(e[0]))return pv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=X3(t,...e),i=E$e({...n,destination:r});return i.pipe=pv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},E$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=A$e(t,i);tK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=iK(e,o,d);return await Promise.race([rK(u),...sK(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},A$e=(t,e)=>Promise.allSettled([t,e])});import{on as T$e}from"node:events";import{getDefaultHighWaterMark as O$e}from"node:stream";var mv,R$e,HI,I$e,uK,GI,lK,P$e,C$e,hv=y(()=>{_I();ev();SI();mv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return R$e(e,s),uK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},R$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},HI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;I$e(e,s,t);let a=t.readableObjectMode&&!o;return uK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},I$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},uK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=T$e(t,"data",{signal:e.signal,highWaterMark:lK,highWatermark:lK});return P$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},GI=O$e(!0),lK=GI,P$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=C$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ma(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*op(a)}},C$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[tv(t,r,!e),Qb(t,i,!n,{})].filter(Boolean)});import{setImmediate as D$e}from"node:timers/promises";var dK,N$e,j$e,M$e,ZI,fK,VI=y(()=>{Hb();nn();xI();hv();Na();ip();dK=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=N$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([j$e(t),d]);return}let f=hI(c,r),p=HI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([M$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},N$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!ov({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=HI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await s3(a,t,r,o)},j$e=async t=>{await D$e(),t.readableFlowing===null&&t.resume()},M$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await zb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Ub(r,{maxBuffer:o})):await Bb(r,{maxBuffer:o})}catch(a){return fK(HV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},ZI=async t=>{try{return await t}catch(e){return fK(e)}},fK=({bufferedData:t})=>jG(t)?new Uint8Array(t):t});import{finished as F$e}from"node:stream/promises";var lp,L$e,z$e,U$e,q$e,B$e,WI,gv,pK,yv=y(()=>{lp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=L$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],F$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||q$e(a,e,r,n)}finally{s.abort()}},L$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&z$e(t,r,n),n},z$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{U$e(e,r),n.call(t,...i)}},U$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},q$e=(t,e,r,n)=>{if(!B$e(t,e,r,n))throw t},B$e=(t,e,r,n=!0)=>r.propagating?pK(t)||gv(t):(r.propagating=!0,WI(r,e)===n?pK(t):gv(t)),WI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",gv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",pK=t=>t?.code==="EPIPE"});var mK,KI,JI=y(()=>{VI();yv();mK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>KI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),KI=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=lp(t,e,l);if(WI(l,e)){await u;return}let[d]=await Promise.all([dK({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 hK,gK,H$e,G$e,YI=y(()=>{cv();JI();hK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fa([t,e].filter(Boolean)):void 0,gK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>KI({...H$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:G$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),H$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}},G$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var yK,_K,bK=y(()=>{El();ls();yK=t=>kl(t,"ipc"),_K=(t,e)=>{let r=ib(t);Pi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var vK,SK,wK=y(()=>{Na();bK();So();OI();vK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=yK(o),a=vo(e,"ipc"),c=vo(r,"ipc");for await(let l of TI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(GV(t,i,c),i.push(l)),s&&_K(l,o);return i},SK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Z$e}from"node:events";var xK,V$e,W$e,K$e,$K=y(()=>{Da();HR();NR();BR();bo();Sr();VI();wK();ZR();YI();JI();EI();yv();xK=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 _=p3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=mK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=gK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=vK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=V$e(h,t,S),D=W$e(m,S);try{return await Promise.race([Promise.all([{},h3(_),Promise.all(x),w,T,gV(t,d),...A,...D]),g,K$e(t,b),...dV(t,o,f,b),...I9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...lV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(re=>ZI(re))),ZI(w),SK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},V$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:lp(n,i,r)),W$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ri(o,{checkOpen:!1})&&!Qn(o)).map(({type:i,value:o,stream:s=o})=>lp(s,n,e,{isSameDirection:On.has(i),stopOnExit:i==="native"}))),K$e=async(t,{signal:e})=>{let[r]=await Z$e(t,"error",{signal:e});throw r}});var kK,up,zl,_v=y(()=>{Pl();kK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),up=(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}},zl=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 EK}from"node:stream/promises";var XI,AK,QI,eP,bv,vv,tP=y(()=>{yv();XI=async t=>{if(t!==void 0)try{await QI(t)}catch{}},AK=async t=>{if(t!==void 0)try{await eP(t)}catch{}},QI=async t=>{await EK(t,{cleanup:!0,readable:!1,writable:!0})},eP=async t=>{await EK(t,{cleanup:!0,readable:!0,writable:!1})},bv=async(t,e)=>{if(await t,e)throw e},vv=(t,e,r)=>{r&&!gv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as J$e}from"node:stream";import{callbackify as Y$e}from"node:util";var TK,rP,nP,iP,X$e,oP,sP,OK,aP=y(()=>{Pa();ds();hv();Pl();_v();tP();TK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||on.has(r),{subprocessStdout:a,waitReadableDestroy:c}=rP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=nP(a,s),{read:f,onStdoutDataDone:p}=iP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new J$e({read:f,destroy:Y$e(sP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return oP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},rP=(t,e,r)=>{let n=Cl(t,e),i=up(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},nP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:GI},iP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ci(),s=mv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){X$e(this,s,o)},onStdoutDataDone:o}},X$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},oP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await eP(t),await n,await XI(i),await e,r.readable&&r.push(null)}catch(o){await XI(i),OK(r,o)}},sP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await zl(r,e)&&(OK(t,n),await bv(e,n))},OK=(t,e)=>{vv(t,t.readable,e)}});import{Writable as Q$e}from"node:stream";import{callbackify as RK}from"node:util";var IK,cP,lP,eke,tke,uP,dP,PK,fP=y(()=>{ds();_v();tP();IK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=cP(t,r,e),s=new Q$e({...lP(n,t,i),destroy:RK(dP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return uP(n,s),s},cP=(t,e,r)=>{let n=_b(t,e),i=up(r,n,"writableFinal"),o=up(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},lP=(t,e,r)=>({write:eke.bind(void 0,t),final:RK(tke.bind(void 0,t,e,r))}),eke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},tke=async(t,e,r)=>{await zl(r,e)&&(t.writable&&t.end(),await e)},uP=async(t,e,r)=>{try{await QI(t),e.writable&&e.end()}catch(n){await AK(r),PK(e,n)}},dP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await zl(r,e),await zl(n,e)&&(PK(t,i),await bv(e,i))},PK=(t,e)=>{vv(t,t.writable,e)}});import{Duplex as rke}from"node:stream";import{callbackify as nke}from"node:util";var CK,ike,DK=y(()=>{Pa();aP();fP();CK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||on.has(r),{subprocessStdout:c,waitReadableDestroy:l}=rP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=cP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=nP(c,a),{read:g,onStdoutDataDone:b}=iP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new rke({read:g,...lP(u,t,d),destroy:nke(ike.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 oP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),uP(u,_,c),_},ike=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([sP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),dP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var pP,oke,NK=y(()=>{Pa();ds();hv();pP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||on.has(e),s=Cl(t,r),a=mv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return oke(a,s,t)},oke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var jK,MK=y(()=>{_v();aP();fP();DK();NK();jK=(t,{encoding:e})=>{let r=kK();t.readable=TK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=IK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=CK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=pP.bind(void 0,t,e),t[Symbol.asyncIterator]=pP.bind(void 0,t,e,{})}});var FK,ske,ake,LK=y(()=>{FK=(t,e)=>{for(let[r,n]of ake){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},ske=(async()=>{})().constructor.prototype,ake=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(ske,t)])});import{setMaxListeners as cke}from"node:events";import{spawn as lke}from"node:child_process";var zK,uke,dke,fke,pke,mke,UK=y(()=>{Hb();SR();KR();ds();JR();RI();np();Vb();R3();N3();ip();G3();mb();J3();cK();YI();$K();MK();Pl();LK();zK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=uke(t,e,r),{subprocess:f,promise:p}=fke({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=pv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),FK(f,p),Di.set(f,{options:u,fileDescriptors:d}),f},uke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ab(t,e,r),{file:a,commandArguments:c,options:l}=Db(t,e,r),u=dke(l),d=D3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},dke=({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}},fke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=lke(...Nb(t,e,r))}catch(m){return O3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;cke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];H3(c,a,l),K3(c,r,l);let d={},f=Ci();c.kill=O9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=hK(c,r),jK(c,r),E3(c,r);let p=pke({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}},pke=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 xK({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)=>xo(x,e,w)),_=xo(h,e,"all"),S=mke({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ml(S,n,e)},mke=({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?rp({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 Ni,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Zb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Sv,hke,gke,qK=y(()=>{yo();So();Sv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,hke(n,t[n],i)]));return{...t,...r}},hke=(t,e,r)=>gke.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,gke=new Set(["env",...gR])});var ms,yke,_ke,BK=y(()=>{yo();dR();HG();b3();UK();qK();ms=(t,e,r,n)=>{let i=(s,a,c)=>ms(s,a,r,c),o=(...s)=>yke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},yke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Sv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=_ke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?_3(a,c,l):zK(a,c,l,i)},_ke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=qG(e)?BG(e,r):[e,...r],[s,a,c]=W_(...o),l=Sv(Sv(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 HK,GK,ZK,bke,vke,VK=y(()=>{HK=({file:t,commandArguments:e})=>ZK(t,e),GK=({file:t,commandArguments:e})=>({...ZK(t,e),isSync:!0}),ZK=(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]=bke(t);return{file:r,commandArguments:n}},bke=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(vke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},vke=/ +/g});var WK,KK,Ske,JK,wke,YK,XK=y(()=>{WK=(t,e,r)=>{t.sync=e(Ske,r),t.s=t.sync},KK=({options:t})=>JK(t),Ske=({options:t})=>({...JK(t),isSync:!0}),JK=t=>({options:{...wke(t),...t}}),wke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},YK={preferLocal:!0}});var Zlt,We,Vlt,Wlt,Klt,Jlt,Ylt,Xlt,Qlt,eut,Mr=y(()=>{BK();VK();GR();XK();RI();Zlt=ms(()=>({})),We=ms(()=>({isSync:!0})),Vlt=ms(HK),Wlt=ms(GK),Klt=ms(pV),Jlt=ms(KK,{},YK,WK),{sendMessage:Ylt,getOneMessage:Xlt,getEachMessage:Qlt,getCancelSignal:eut}=A3()});import{existsSync as wv,statSync as xke}from"node:fs";import{dirname as mP,extname as $ke,isAbsolute as QK,join as hP,relative as gP,resolve as xv,sep as kke}from"node:path";function $v(t){return t==="./gradlew"||t==="gradle"}function Eke(t){return(wv(hP(t,"build.gradle.kts"))||wv(hP(t,"build.gradle")))&&wv(hP(t,"gradle.properties"))}function Ake(t,e){let n=gP(t,e).split(kke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function hs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Tke(t,e){let r=xv(t,e),n=r;wv(r)?xke(r).isFile()&&(n=mP(r)):$ke(r)!==""&&(n=mP(r));let i=gP(t,n);if(i.startsWith("..")||QK(i))return null;let o=n;for(;;){if(Eke(o))return o;if(xv(o)===xv(t))return null;let s=mP(o);if(s===o)return null;let a=gP(t,s);if(a.startsWith("..")||QK(a))return null;o=s}}function kv(t,e){let r=xv(t),n=new Map,i=[];for(let o of e){let s=Tke(r,o);if(!s){i.push(o);continue}let a=Ake(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 Ev=y(()=>{"use strict"});import{existsSync as _P,readFileSync as Oke}from"node:fs";import{join as Ul}from"node:path";function ql(t="."){let e=Ul(t,".cladding","config.yaml");if(!_P(e))return yP;try{let n=(0,eJ.parse)(Oke(e,"utf8"))?.gate;if(!n)return yP;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 Rke){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 yP}}function tJ(t="."){let e=ql(t).testReport,r=e?[e,...bP]:bP;return[...new Set(r.map(n=>Ul(t,n)))]}function rJ(t="."){let e=ql(t).testReport;if(e){let r=Ul(t,e);return _P(r)?r:null}return bP.map(r=>Ul(t,r)).find(r=>_P(r))??null}function nJ(t,e){let r=[],n=!1;for(let i of t){let o=Ike.exec(i);if(o){n=!0;for(let s of e)r.push(hs(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 eJ,Rke,yP,bP,Ike,dp=y(()=>{"use strict";eJ=St(er(),1);Ev();Rke=["type","lint","test","coverage"],yP={scope:"feature"},bP=["test-report.junit.xml",Ul("coverage","junit.xml"),Ul(".cladding","test-report.junit.xml")];Ike=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as SP,readFileSync as iJ,readdirSync as Pke,statSync as Cke}from"node:fs";import{join as Av}from"node:path";function $P(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Av(t,e);if(SP(r))try{if(oJ.test(iJ(r,"utf8")))return!0}catch{}}return!1}function sJ(t){try{return SP(t)&&oJ.test(iJ(t,"utf8"))}catch{return!1}}function aJ(t,e=0){if(e>4||!SP(t))return!1;let r;try{r=Pke(t)}catch{return!1}for(let n of r){let i=Av(t,n),o=!1;try{o=Cke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(aJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&sJ(i))return!0}return!1}function jke(t){if($P(t))return!0;for(let e of Dke)if(sJ(Av(t,e)))return!0;for(let e of Nke)if(aJ(Av(t,e)))return!0;return!1}function cJ(t="."){let e=ql(t).coverage;return e||(jke(t)?"kover":"jacoco")}function lJ(t="."){return wP[cJ(t)]}function uJ(t="."){return vP[cJ(t)]}var wP,vP,xP,oJ,Dke,Nke,Tv=y(()=>{"use strict";dp();wP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},vP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},xP=[vP.kover,vP.jacoco],oJ=/kover/i;Dke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Nke=["buildSrc","build-logic"]});import{existsSync as pp,readFileSync as fJ,readdirSync as pJ}from"node:fs";import{join as gs}from"node:path";function EP(t){return pp(gs(t,"gradlew"))?"./gradlew":"gradle"}function Mke(t){let e=EP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[lJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Fke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(fJ(gs(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function zke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function Bke(t,e){for(let r of e)if(pp(gs(t,r)))return r}function Hke(t,e){try{return pJ(t).find(n=>n.endsWith(e))}catch{return}}function Vke(t){try{return JSON.parse(fJ(gs(t,"package.json"),"utf8"))}catch{return{}}}function fp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function dJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function Wke(t,e,r){if(fp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of Gke)if(n.configs.some(i=>pp(gs(t,i))))return n.gate;if(Zke.some(n=>pp(gs(t,n)))||r.eslintConfig!==void 0)return e}function Jke(t,e){return Kke.some(r=>pp(gs(t,r)))?!0:e.jest!==void 0}function Yke(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function kP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function Xke(t,e){let r=Vke(t),n=e.lint?Wke(t,e.lint,r):void 0,i=n?{...e,lint:n}:kP(e,"lint"),o=fp(r,"test"),s=o?Yke(o):void 0;return o&&!s?(i=kP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...fp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&Jke(t,r)?{...i,test:{cmd:"npx",args:[...Mi,"jest"]},coverage:{cmd:"npx",args:[...Mi,"jest","--coverage"]}}:(s==="vitest"&&!fp(r,"coverage")&&!dJ(r,"@vitest/coverage-v8")&&!dJ(r,"@vitest/coverage-istanbul")?i=kP(i,"coverage"):s==="vitest"&&fp(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of Uke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Hke(t,o):r=Bke(t,[o]),r)break;if(!r||e.requiresSource&&!zke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Xke(t,n):n;return{language:e.language,manifest:r,gates:i}}return qke}var Mi,Lke,Uke,qke,Gke,Zke,Kke,sn=y(()=>{"use strict";Tv();Mi=["--offline","--no-install"];Lke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);Uke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Mi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Mi,"eslint","."]},test:{cmd:"npx",args:[...Mi,"vitest","run"]},coverage:{cmd:"npx",args:[...Mi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Mi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Mi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},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:Mke},{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"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:Fke}],qke={language:"unknown",manifest:"",gates:{}};Gke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Mi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Mi,"oxlint"]}}],Zke=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"];Kke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Qke,readFileSync as eEe}from"node:fs";import{join as tEe}from"node:path";function za(t){return t.code==="ENOENT"}function Ov(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 mJ.test(o)||mJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(za(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} +${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function Yt(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 Bl(t,e){let r=tEe(t,"package.json");if(!Qke(r))return!1;try{return!!JSON.parse(eEe(r,"utf8")).scripts?.[e]}catch{return!1}}var mJ,Rn=y(()=>{"use strict";mJ=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|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 rEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:Rv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Rv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Ov(i,Rv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Rv,Ua,Iv=y(()=>{"use strict";Mr();sn();Rn();Rv="ARCHITECTURE_VIOLATION";Ua={name:Rv,subprocess:!0,run:rEe}});function nEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Pv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Pv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Ov(i,Pv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Pv,qa,Cv=y(()=>{"use strict";Mr();sn();Rn();Pv="HARDCODED_SECRET";qa={name:Pv,subprocess:!0,run:nEe}});import{existsSync as AP,readdirSync as hJ}from"node:fs";import{join as Dv}from"node:path";function oEe(t,e){let r=Dv(t,e.path);if(!AP(r))return!0;if(e.isDirectory)try{return hJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function sEe(t){let{cwd:e="."}=t,r=[];for(let i of iEe)oEe(e,i)&&r.push({detector:mp,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=Dv(e,"spec.yaml");if(AP(n)){let i=lEe(n),o=i?null:aEe(e);if(i)r.push({detector:mp,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:mp,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=cEe(e);s&&r.push({detector:mp,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 aEe(t){for(let e of["spec/features","spec/scenarios"]){let r=Dv(t,e);if(!AP(r))continue;let n;try{n=hJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Oi(Dv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function cEe(t){try{return q(t),null}catch(e){return e.message}}function lEe(t){let e;try{e=Oi(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var mp,iEe,gJ,yJ=y(()=>{"use strict";Ue();F_();mp="ABSENCE_OF_GOVERNANCE",iEe=[{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}];gJ={name:mp,run:sEe}});function Nv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function TP(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=Nv(r)==="while",o=dEe.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 '${Nv(r)}'`}let n=uEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Nv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Nv(r)}'`:null}function fEe(t,e){let r=TP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function _J(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...fEe(r,n));return e}var uEe,dEe,OP=y(()=>{"use strict";uEe={event:"when",state:"while",optional:"where",unwanted:"if"},dEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Ue()});function pEe(t){let{cwd:e="."}=t;return ge(e,jv,mEe)}function mEe(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:jv,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 _J(t.features))e.push({detector:jv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var jv,bJ,vJ=y(()=>{"use strict";OP();wt();jv="AC_DRIFT";bJ={name:jv,run:pEe}});function Fi(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return wJ[n]??SJ}var hEe,gEe,yEe,SJ,_Ee,bEe,wJ,vEe,xJ,Ba=y(()=>{"use strict";sn();hEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,gEe=/^[ \t]*import\s+([\w.]+)/gm,yEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,SJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:hEe,importStyle:"relative"},_Ee={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:gEe,importStyle:"dotted"},bEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:yEe,importStyle:"dotted"},wJ={typescript:SJ,kotlin:_Ee,python:bEe},vEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],xJ=new Set([...Object.values(wJ).flatMap(t=>t?.extensions??[]),...vEe].map(t=>t.toLowerCase()))});import{existsSync as SEe,readFileSync as wEe,readdirSync as xEe,statSync as $Ee}from"node:fs";import{join as kJ,relative as $J}from"node:path";function kEe(t,e){if(!SEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=xEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=kJ(i,s),c;try{c=$Ee(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function EEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function TEe(t){return AEe.test(t)}function OEe(t){let{cwd:e="."}=t,r;try{r=q(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=>kEe(kJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=wEe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Ue();Ba();EJ="AI_HINTS_FORBIDDEN_PATTERN";AEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;AJ={name:EJ,run:OEe}});function REe(t){let{cwd:e="."}=t,r;try{r=q(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:OJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var OJ,RJ,IJ=y(()=>{"use strict";Ue();OJ="AC_DUPLICATE_WITHIN_FEATURE";RJ={name:OJ,run:REe}});import{createRequire as IEe}from"module";import{basename as PEe,dirname as IP,normalize as CEe,relative as DEe,resolve as NEe,sep as DJ}from"path";import*as jEe from"fs";function MEe(t){let e=CEe(t);return e.length>1&&e[e.length-1]===DJ&&(e=e.substring(0,e.length-1)),e}function NJ(t,e){return t.replace(FEe,e)}function zEe(t){return t==="/"||LEe.test(t)}function RP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=NEe(t)),(n||o)&&(t=MEe(t)),t===".")return"";let s=t[t.length-1]!==i;return NJ(s?t+i:t,i)}function jJ(t,e){return e+t}function UEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:NJ(DEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function qEe(t){return t}function BEe(t,e,r){return e+t+r}function HEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?UEe(t,e):n?jJ:qEe}function GEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function ZEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function JEe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?ZEe(t):GEe(t):n&&n.length?WEe:VEe:KEe}function rAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?tAe:r&&r.length?n?YEe:XEe:n?QEe:eAe}function oAe(t){return t.group?iAe:nAe}function cAe(t){return t.group?sAe:aAe}function dAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?uAe:lAe}function MJ(t,e,r){if(r.options.useRealPaths)return fAe(e,r);let n=IP(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=IP(n)}return r.symlinks.set(t,e),i>1}function fAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Mv(t,e,r,n){e(t&&!n?t:null,r)}function SAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?pAe:yAe:n?e?mAe:vAe:i?e?gAe:bAe:e?hAe:_Ae}function $Ae(t){return t?xAe:wAe}function TAe(t,e){return new Promise((r,n)=>{zJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function zJ(t,e,r){new LJ(t,e,r).start()}function OAe(t,e){return new LJ(t,e).start()}var PJ,FEe,LEe,VEe,WEe,KEe,YEe,XEe,QEe,eAe,tAe,nAe,iAe,sAe,aAe,lAe,uAe,pAe,mAe,hAe,gAe,yAe,_Ae,bAe,vAe,FJ,wAe,xAe,kAe,EAe,AAe,LJ,CJ,UJ,qJ,BJ=y(()=>{PJ=IEe(import.meta.url);FEe=/[\\/]/g;LEe=/^[a-z]:[\\/]$/i;VEe=(t,e)=>{e.push(t||".")},WEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},KEe=()=>{};YEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},XEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},QEe=(t,e,r,n)=>{r.files++},eAe=(t,e)=>{e.push(t)},tAe=()=>{};nAe=t=>t,iAe=()=>[""].slice(0,0);sAe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},aAe=()=>{};lAe=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()&&MJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},uAe=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()&&MJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};pAe=t=>t.counts,mAe=t=>t.groups,hAe=t=>t.paths,gAe=t=>t.paths.slice(0,t.options.maxFiles),yAe=(t,e,r)=>(Mv(e,r,t.counts,t.options.suppressErrors),null),_Ae=(t,e,r)=>(Mv(e,r,t.paths,t.options.suppressErrors),null),bAe=(t,e,r)=>(Mv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),vAe=(t,e,r)=>(Mv(e,r,t.groups,t.options.suppressErrors),null);FJ={withFileTypes:!0},wAe=(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||".",FJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},xAe=(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||".",FJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};kAe=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))}},EAe=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}},AAe=class{aborted=!1;abort(){this.aborted=!0}},LJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=SAe(e,this.isSynchronous),this.root=RP(t,e),this.state={root:zEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new EAe,options:e,queue:new kAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new AAe,fs:e.fs||jEe},this.joinPath=HEe(this.root,e),this.pushDirectory=JEe(this.root,e),this.pushFile=rAe(e),this.getArray=oAe(e),this.groupFiles=cAe(e),this.resolveSymlink=dAe(e,this.isSynchronous),this.walkDirectory=$Ae(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(_=RP(_,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=PEe(_),x=RP(IP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};CJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return TAe(this.root,this.options)}withCallback(t){zJ(this.root,this.options,t)}sync(){return OAe(this.root,this.options)}},UJ=null;try{PJ.resolve("picomatch"),UJ=PJ("picomatch")}catch{}qJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:DJ,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 CJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new CJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||UJ;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 hp=v((ndt,WJ)=>{"use strict";var HJ="[^\\\\/]",RAe="(?=.)",GJ="[^/]",PP="(?:\\/|$)",ZJ="(?:^|\\/)",CP=`\\.{1,2}${PP}`,IAe="(?!\\.)",PAe=`(?!${ZJ}${CP})`,CAe=`(?!\\.{0,1}${PP})`,DAe=`(?!${CP})`,NAe="[^.\\/]",jAe=`${GJ}*?`,MAe="/",VJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:RAe,QMARK:GJ,END_ANCHOR:PP,DOTS_SLASH:CP,NO_DOT:IAe,NO_DOTS:PAe,NO_DOT_SLASH:CAe,NO_DOTS_SLASH:DAe,QMARK_NO_DOT:NAe,STAR:jAe,START_ANCHOR:ZJ,SEP:MAe},FAe={...VJ,SLASH_LITERAL:"[\\\\/]",QMARK:HJ,STAR:`${HJ}*?`,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:"\\"},LAe={__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"};WJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:LAe,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?FAe:VJ}}});var gp=v(Fr=>{"use strict";var{REGEX_BACKSLASH:zAe,REGEX_REMOVE_BACKSLASH:UAe,REGEX_SPECIAL_CHARS:qAe,REGEX_SPECIAL_CHARS_GLOBAL:BAe}=hp();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>qAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(BAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(zAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(UAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var r8=v((odt,t8)=>{"use strict";var KJ=gp(),{CHAR_ASTERISK:DP,CHAR_AT:HAe,CHAR_BACKWARD_SLASH:yp,CHAR_COMMA:GAe,CHAR_DOT:NP,CHAR_EXCLAMATION_MARK:jP,CHAR_FORWARD_SLASH:e8,CHAR_LEFT_CURLY_BRACE:MP,CHAR_LEFT_PARENTHESES:FP,CHAR_LEFT_SQUARE_BRACKET:ZAe,CHAR_PLUS:VAe,CHAR_QUESTION_MARK:JJ,CHAR_RIGHT_CURLY_BRACE:WAe,CHAR_RIGHT_PARENTHESES:YJ,CHAR_RIGHT_SQUARE_BRACKET:KAe}=hp(),XJ=t=>t===e8||t===yp,QJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},JAe=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,re=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&XJ(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=KJ.removeBackslashes(P)),xe&&_===!0&&(xe=KJ.removeBackslashes(xe)));let Ir={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,XJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var _p=hp(),an=gp(),{MAX_LENGTH:Fv,POSIX_REGEX_SOURCE:YAe,REGEX_NON_SPECIAL_CHARS:XAe,REGEX_SPECIAL_CHARS_BACKREF:QAe,REPLACEMENTS:n8}=_p,eTe=(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=>an.escapeRegex(i)).join("..")}return r},Hl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,i8=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},tTe=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},o8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(tTe(e))return e.replace(/\\(.)/g,"$1")},rTe=t=>{let e=t.map(o8).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}}}}},nTe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=o8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?an.escapeRegex(r[0]):`[${r.map(i=>an.escapeRegex(i)).join("")}]`}*`},iTe=t=>{let e=0,r=t.trim(),n=LP(r);for(;n;)e++,r=n.body.trim(),n=LP(r);return e},oTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:_p.DEFAULT_MAX_EXTGLOB_RECURSION,n=i8(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||rTe(n)))return{risky:!0};for(let i of n){let o=nTe(i);if(o)return{risky:!0,safeOutput:o};if(iTe(i)>r)return{risky:!0}}return{risky:!1}},zP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=n8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Fv,r.maxLength):Fv,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=_p.globChars(r.windows),l=_p.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,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=an.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Ir=()=>$.index===i-1,se=$.peek=(H=1)=>t[$.index+H],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(H="",ht=0)=>{$.consumed+=H,$.index+=ht},Xt=H=>{$.output+=H.output!=null?H.output:H.value,dr(H.value)},lo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,H++;return H%2===0?!1:($.negated=!0,$.start++,!0)},$i=H=>{$[H]++,xe.push(H)},Xr=H=>{$[H]--,xe.pop()},de=H=>{if(C.type==="globstar"){let ht=$.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||re.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!ht&&!B&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(re.length&&H.type!=="paren"&&(re[re.length-1].inner+=H.value),(H.value||H.output)&&Xt(H),C&&C.type==="text"&&H.type==="text"){C.output=(C.output||C.value)+H.value,C.value+=H.value;return}H.prev=C,s.push(H),C=H},uo=(H,ht)=>{let B={...l[ht],conditions:1,inner:""};B.prev=C,B.parens=$.parens,B.output=$.output,B.startIndex=$.index,B.tokensIndex=s.length;let Oe=(r.capture?"(":"")+B.open;$i("parens"),de({type:H,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),re.push(B)},Mde=H=>{let ht=t.slice(H.startIndex,$.index+1),B=t.slice(H.startIndex+2,$.index),Oe=oTe(B,r);if((H.type==="plus"||H.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(H.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,ki=s[H.tokensIndex];ki.type="text",ki.value=ht,ki.output=lt||an.escapeRegex(ht);for(let Ei=H.tokensIndex+1;Ei1&&H.inner.includes("/")&&(lt=O(r)),(lt!==D||Ir()||/^\)+$/.test(Kt()))&&(ut=H.close=`)$))${lt}`),H.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let ki=zP(zt,{...e,fastpaths:!1}).output;ut=H.close=`)${ki})${lt})`}H.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Xr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,ht=t.replace(QAe,(B,Oe,ut,zt,lt,ki)=>zt==="\\"?(H=!0,B):zt==="?"?Oe?Oe+zt+(lt?_.repeat(lt.length):""):ki===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):zt==="."?u.repeat(ut.length):zt==="*"?Oe?Oe+zt+(lt?D:""):D:Oe?B:`\\${B}`);return H===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=an.wrapOutput(ht,$,e),$)}for(;!Ir();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let B=C.value.slice(1);if(B.includes("[")&&(C.posix=!0,B.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),zt=C.value.slice(Oe+2),lt=YAe[zt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Xt({value:P});continue}if($.quotes===1&&P!=='"'){P=an.escapeRegex(P),C.value+=P,Xt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){$i("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Hl("opening","("));let B=re[re.length-1];if(B&&$.parens===B.parens+1){Mde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Xr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Hl("closing","]"));P=`\\${P}`}else $i("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Hl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Xr("brackets");let B=C.value.slice(1);if(C.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(P=`/${P}`),C.value+=P,Xt({value:P}),r.literalBrackets===!1||an.hasRegexChars(B))continue;let Oe=an.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){$i("braces");let B={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(B),de(B);continue}if(P==="}"){let B=K[K.length-1];if(r.nobrace===!0||!B){de({type:"text",value:P,output:P});continue}let Oe=")";if(B.dots===!0){let ut=s.slice(),zt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&zt.unshift(ut[lt].value);Oe=eTe(zt,r),$.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let ut=$.output.slice(0,B.outputIndex),zt=$.tokens.slice(B.tokensIndex);B.value=B.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of zt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),Xr("braces"),K.pop();continue}if(P==="|"){re.length>0&&re[re.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let B=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,B="|"),de({type:"comma",value:P,output:B});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let B=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,B.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){uo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){uo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){lo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){uo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let B=XAe.exec(Kt());B&&(P+=B[0],$.index+=B[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){uo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let B=C.prev,Oe=B.prev,ut=B.type==="slash"||B.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||H[0]&&H[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(B.type==="comma"||B.type==="brace"),ki=re.length&&(B.type==="pipe"||B.type==="paren");if(!ut&&B.type!=="paren"&&!lt&&!ki){de({type:"star",value:P,output:""});continue}for(;H.slice(0,3)==="/**";){let Ei=t[$.index+4];if(Ei&&Ei!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Ir()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&Ir()){$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=B.output+C.output,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let Ei=H[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${Ei})`,C.value+=P,$.output+=B.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hl("closing","]"));$.output=an.escapeLast($.output,"["),Xr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hl("closing",")"));$.output=an.escapeLast($.output,"("),Xr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hl("closing","}"));$.output=an.escapeLast($.output,"{"),Xr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let H of $.tokens)$.output+=H.output!=null?H.output:H.value,H.suffix&&($.output+=H.suffix)}return $};zP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Fv,r.maxLength):Fv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=n8[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}=_p.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=an.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};s8.exports=zP});var u8=v((adt,l8)=>{"use strict";var sTe=r8(),UP=a8(),c8=gp(),aTe=hp(),cTe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=cTe(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?Rt.compileRe(t,e):Rt.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=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.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};Rt.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?c8.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=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(c8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):UP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>sTe(t,e);Rt.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=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.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=UP.fastpaths(t,e)),i.output||(i=UP(t,e)),Rt.compileRe(i,e,r,n)};Rt.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/$^/}};Rt.constants=aTe;l8.exports=Rt});var m8=v((cdt,p8)=>{"use strict";var d8=u8(),lTe=gp();function f8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:lTe.isWindows()}),d8(t,e,r)}Object.assign(f8,d8);p8.exports=f8});import{readdir as uTe,readdirSync as dTe,realpath as fTe,realpathSync as pTe,stat as mTe,statSync as hTe}from"fs";import{isAbsolute as gTe,posix as Ha,resolve as yTe}from"path";import{fileURLToPath as _Te}from"url";function STe(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]===".."&&vTe.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=>Ha.relative(t,n)||".":n=>Ha.relative(t,`${e}/${n}`)||"."}function $Te(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ha.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function _8(t){var e;let r=Gl.default.scan(t,kTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function ITe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Gl.default.scan(t);return r.isGlob||r.negated}function bp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function b8(t){return typeof t=="string"?[t]:t??[]}function qP(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=RTe(o);s=gTe(s.replace(CTe,""))?Ha.relative(a,s):Ha.normalize(s);let c=(i=PTe.exec(s))===null||i===void 0?void 0:i[0],l=_8(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?Ha.join(o,...d):o}return s}function DTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(qP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(qP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(qP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function NTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=DTe(t,e,n);t.debug&&bp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(g8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Gl.default)(i.match,f),m=(0,Gl.default)(i.ignore,f),h=STe(i.match,f),g=h8(r,d,o),b=o?g:h8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new qJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&bp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return bp(`${T?"skipped":"crawling"} ${O}`),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&&bp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&$Te(r,d)]}function jTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function FTe(t){let e={...MTe,...t};return e.cwd=(e.cwd instanceof URL?_Te(e.cwd):yTe(e.cwd)).replace(g8,"/"),e.ignore=b8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||uTe,readdirSync:e.fs.readdirSync||dTe,realpath:e.fs.realpath||fTe,realpathSync:e.fs.realpathSync||pTe,stat:e.fs.stat||mTe,statSync:e.fs.statSync||hTe}),e.debug&&bp("globbing with options:",e),e}function LTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=bTe(t)||typeof t=="string",i=b8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=FTe(n?e:t);return i.length>0?NTe(o,i):[]}function ys(t,e){let[r,n]=LTe(t,e);return r?jTe(r.sync(),n):[]}var Gl,bTe,g8,y8,vTe,wTe,xTe,kTe,ETe,ATe,TTe,OTe,RTe,PTe,CTe,MTe,vp=y(()=>{BJ();Gl=St(m8(),1),bTe=Array.isArray,g8=/\\/g,y8=process.platform==="win32",vTe=/^(\/?\.\.)+$/;wTe=/^[A-Z]:\/$/i,xTe=y8?t=>wTe.test(t):t=>t==="/";kTe={parts:!0};ETe=/(?t.replace(ETe,"\\$&"),OTe=t=>t.replace(ATe,"\\$&"),RTe=y8?OTe:TTe;PTe=/^(\/?\.\.)+/,CTe=/\\(?=[()[\]{}!*+?@|])/g;MTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Sp,readFileSync as zTe,readdirSync as UTe,statSync as v8}from"node:fs";import{join as Ga}from"node:path";function qTe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Fi(e,n),o=[],{layers:s,forbiddenImports:a}=BP(r);return(s.size>0||a.length>0)&&!Sp(Ga(e,i.mainRoot))?[{detector:wp,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(BTe(e,i,s,o),HTe(e,i,s,o)),a.length>0&>e(e,i,a,o),o)}function BP(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 BTe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(Sp(o))for(let s of UTe(o)){let a=Ga(o,s);v8(a).isDirectory()&&(r.has(s)||n.push({detector:wp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function HTe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(Sp(o))for(let s of r){let a=Ga(o,s);Sp(a)&&v8(a).isDirectory()||n.push({detector:wp,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 GTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ga(t,i,s.from);if(!Sp(a))continue;let c=ys([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ga(a,l),d;try{d=zTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];ZTe(p,s.to,e.importStyle)&&n.push({detector:wp,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 ZTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var wp,S8,HP=y(()=>{"use strict";vp();Ue();Ba();wp="ARCHITECTURE_FROM_SPEC";S8={name:wp,run:qTe}});import{existsSync as VTe,readFileSync as WTe}from"node:fs";import{join as KTe}from"node:path";function YTe(t){let{cwd:e="."}=t,r=KTe(e,"spec/capabilities.yaml");if(!VTe(r))return[];let n;try{let u=WTe(r,"utf8"),d=w8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size{"use strict";w8=St(er(),1);Ue();Lv="CAPABILITIES_FEATURE_MAPPING",JTe=8;x8={name:Lv,run:YTe}});import{existsSync as XTe,readFileSync as QTe}from"node:fs";import{join as eOe}from"node:path";function tOe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function rOe(t){let{cwd:e="."}=t;return ge(e,GP,r=>nOe(r,e))}function nOe(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=eOe(e,o);if(!XTe(s))continue;let a=QTe(s,"utf8");tOe(a)||n.push({detector:GP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var GP,k8,E8=y(()=>{"use strict";Ba();wt();GP="CONVENTION_DRIFT";k8={name:GP,run:rOe}});import{existsSync as ZP,readFileSync as A8}from"node:fs";import{join as zv}from"node:path";function iOe(t){return JSON.parse(t).total?.lines?.pct??0}function T8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function aOe(t,e){if(!$v(dt(t).gates.coverage?.cmd))return null;let r;try{r=kv(t,e)}catch(c){return[{detector:$o,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=xP.find(d=>ZP(zv(c.dir,d)));if(!l){s.push(c.path);continue}let u=T8(A8(zv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:$o,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=O8(n,i);return a0?[{detector:$o,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function cOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=aOe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Fi(e,r),i=dt(e).language==="kotlin"?xP.find(a=>ZP(zv(e,a)))??uJ(e):n.coverageSummary,o=zv(e,i);if(!ZP(o))return[{detector:$o,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=A8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?oOe(a):n.coverageFormat==="cobertura-xml"?sOe(a):iOe(a)}catch(a){return[{detector:$o,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:$o,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Uv?[]:[{detector:$o,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Uv}%`}]}var $o,Uv,R8,I8=y(()=>{"use strict";Ue();Tv();Ba();Ev();sn();$o="COVERAGE_DROP",Uv=70;R8={name:$o,run:cOe}});import{existsSync as lOe}from"node:fs";import{join as uOe}from"node:path";function fOe(t){let{cwd:e="."}=t;return ge(e,qv,r=>pOe(r,e))}function pOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";wt();qv="DELIVERABLE_INTEGRITY",dOe=8;P8={name:qv,run:fOe}});function mOe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Bv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function hOe(t){let e=mOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Bv,severity:"warn",path:"spec.yaml",message:`${r.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 gOe(t){let{cwd:e="."}=t;return ge(e,Bv,r=>hOe(r))}var Bv,D8,N8=y(()=>{"use strict";wt();Bv="SMOKE_PROBE_DEMAND";D8={name:Bv,run:gOe}});function yOe(t){let{cwd:e="."}=t;return ge(e,Hv,r=>_Oe(r,e))}function _Oe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=as(e);if(n===null)return[{detector:Hv,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=H_(n,e,o);s.state!=="fresh"&&i.push({detector:Hv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${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.`:s.module?`${o.id}'s module ${s.module} 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.`:`${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 Hv,Gv,VP=y(()=>{"use strict";vl();wt();Hv="STALE_ATTESTATION";Gv={name:Hv,run:yOe}});function bOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return vOe(r)}function vOe(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:j8,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 j8,Zv,WP=y(()=>{"use strict";Ue();j8="DEPENDENCY_CYCLE";Zv={name:j8,run:bOe}});import{appendFileSync as SOe,existsSync as M8,mkdirSync as wOe,readFileSync as xOe}from"node:fs";import{dirname as $Oe,join as kOe}from"node:path";function F8(t){return kOe(t,EOe,AOe)}function L8(t){return KP.add(t),()=>KP.delete(t)}function Za(t,e){let r=F8(t),n=$Oe(r);M8(n)||wOe(n,{recursive:!0}),SOe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of KP)try{i(t,e)}catch{}}function In(t){let e=F8(t);if(!M8(e))return[];let r=xOe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var EOe,AOe,KP,ni=y(()=>{"use strict";EOe=".cladding",AOe="audit.log.jsonl";KP=new Set});import{existsSync as TOe}from"node:fs";import{join as OOe}from"node:path";function ROe(t){let{cwd:e="."}=t,r=In(e);if(r.length===0)return[{detector:JP,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&&(TOe(OOe(e,i.artifact))||n.push({detector:JP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var JP,z8,U8=y(()=>{"use strict";ni();JP="EVIDENCE_MISMATCH";z8={name:JP,run:ROe}});import{existsSync as IOe,readFileSync as POe}from"node:fs";import{join as COe}from"node:path";function DOe(t){let e=COe(t,G8);if(!IOe(e))return null;try{let n=((0,H8.parse)(POe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*B8(t,e){for(let r of t??[])r.startsWith(q8)&&(yield{ref:r,name:r.slice(q8.length),field:e})}function NOe(t){let{cwd:e="."}=t,r=DOe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:YP,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=[...B8(s.evidence_refs,"evidence_refs"),...B8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:YP,severity:"warn",path:G8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var H8,YP,q8,G8,Z8,V8=y(()=>{"use strict";H8=St(er(),1);Ue();YP="FIXTURE_REFERENCE_INVALID",q8="fixture:",G8="conformance/fixtures.yaml";Z8={name:YP,run:NOe}});import{existsSync as Zl,readFileSync as XP}from"node:fs";import{join as Va}from"node:path";function jOe(t){return ys(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function xp(t){if(!Zl(t))return null;try{return JSON.parse(XP(t,"utf8"))}catch{return null}}function MOe(t,e){let r=Va(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(XP(r,"utf8"))}catch(c){e.push({detector:ko,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:ko,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=jOe(t);s!==a&&e.push({detector:ko,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function FOe(t,e){for(let r of W8){let n=Va(t,r.path);if(!Zl(n))continue;let i=xp(n);if(!i){e.push({detector:ko,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:ko,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function LOe(t,e){let r=xp(Va(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of W8){let s=Va(t,o.path);if(!Zl(s))continue;let a=xp(s);a?.version&&a.version!==n&&e.push({detector:ko,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Va(t,".claude-plugin","marketplace.json");if(Zl(i)){let o=xp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:ko,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 zOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function UOe(t,e){let r=Va(t,"src","cli","clad.ts"),n=Va(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Zl(r)||!Zl(n))return;let i=zOe(XP(r,"utf8"));if(i.length===0)return;let s=xp(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:ko,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 qOe(t){let{cwd:e="."}=t,r=[];return MOe(e,r),UOe(e,r),FOe(e,r),LOe(e,r),r}var ko,W8,K8,J8=y(()=>{"use strict";vp();ko="HARNESS_INTEGRITY",W8=[{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"]}];K8={name:ko,run:qOe}});import{existsSync as BOe,readFileSync as HOe}from"node:fs";import{join as GOe}from"node:path";function VOe(t){let{cwd:e="."}=t;return ge(e,Vv,r=>KOe(r,e))}function WOe(t){let e=GOe(t,"spec/capabilities.yaml");if(!BOe(e))return!1;try{let r=Y8.default.parse(HOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function KOe(t,e){let r=t.features.length;if(r{"use strict";Y8=St(er(),1);wt();Vv="HOLLOW_GOVERNANCE",ZOe=8;X8={name:Vv,run:VOe}});import{existsSync as e5,readFileSync as t5}from"node:fs";import{join as r5}from"node:path";function n5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function XOe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function QOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function eRe(t){let e=r5(t,"README.md"),r=r5(t,"docs","dogfood","matrix.md");if(!e5(e)||!e5(r))return[];let n=n5(t5(e,"utf8"),JOe),i=n5(t5(r,"utf8"),YOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=QOe(a);if(c===null)continue;let l=i[s]??"not-run",u=XOe(l);u!==null&&c>u&&o.push({detector:i5,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function tRe(t){let{cwd:e="."}=t;return eRe(e)}var i5,JOe,YOe,o5,s5=y(()=>{"use strict";i5="HOST_CLAIM_DRIFT",JOe=//,YOe=//;o5={name:i5,run:tRe}});function rRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return a5(r.features.map(i=>i.id),"feature","spec/features/",n),a5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function a5(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:c5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var c5,l5,u5=y(()=>{"use strict";Ue();c5="ID_COLLISION";l5={name:c5,run:rRe}});import{existsSync as $p,readFileSync as QP,readdirSync as eC,statSync as nRe,writeFileSync as f5}from"node:fs";import{join as Eo}from"node:path";function d5(t){if(!$p(t))return 0;try{return eC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function iRe(t){if(!$p(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=eC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Eo(n,o),a;try{a=nRe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function oRe(t){let e=Eo(t,"spec","capabilities.yaml");if(!$p(e))return 0;try{let r=Wv.default.parse(QP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function _s(t="."){let e=d5(Eo(t,"spec","features")),r=d5(Eo(t,"spec","scenarios")),n=oRe(t),i=iRe(Eo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Vl(t,e){let r=Eo(t,"spec.yaml");if(!$p(r))return;let n=QP(r,"utf8"),i=sRe(n,e);i!==n&&f5(r,i)}function sRe(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}`],s=d=>r===`\r @@ -270,51 +270,51 @@ ${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 Wa(t="."){let e=ko(t,"spec","features");if(!$p(e))return!1;let r=[];for(let i of XP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Zv.parse)(YP(ko(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 Wa(t="."){let e=Eo(t,"spec","features");if(!$p(e))return!1;let r=[];for(let i of eC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Wv.parse)(QP(Eo(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 s5(ko(t,"spec","index.yaml"),n,"utf8"),!0}var Zv,kp=y(()=>{"use strict";Zv=St(Qt(),1)});import{existsSync as a5,readFileSync as c5,readdirSync as QOe}from"node:fs";import{join as QP}from"node:path";function eRe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=_s(e),i=r.inventory;if(!i){let s=l5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return eC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...eC(e),{detector:Ep,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 l5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Ep,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(...eC(e)),o}function eC(t){let e=QP(t,"spec","index.yaml"),r=QP(t,"spec","features");if(!a5(e)||!a5(r))return[];let n=new Map;try{for(let l of c5(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 QOe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=c5(QP(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:Ep,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:Ep,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 Ep,l5,u5,d5=y(()=>{"use strict";kp();Be();Ep="INVENTORY_DRIFT",l5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];u5={name:Ep,run:eRe}});import{existsSync as tRe,readFileSync as rRe}from"node:fs";import{join as nRe}from"node:path";function oRe(t){let{cwd:e="."}=t,r=nRe(e,"src","spec","schema.json"),n=[];if(tRe(r)){let i;try{i=JSON.parse(rRe(r,"utf8"))}catch(o){n.push({detector:Ap,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of iRe)i.required?.includes(o)||n.push({detector:Ap,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Ap,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==f5&&n.push({detector:Ap,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${f5}'`})}catch{}return n}var Ap,iRe,f5,p5,m5=y(()=>{"use strict";Be();Ap="META_INTEGRITY",iRe=["schema","project","features"],f5="0.1";p5={name:Ap,run:oRe}});function sRe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return h5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),h5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function h5(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:g5,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 g5,y5,_5=y(()=>{"use strict";Be();g5="SLUG_CONFLICT";y5={name:g5,run:sRe}});function Hl(t){return t==="planned"||t==="in_progress"}var Vv=y(()=>{"use strict"});import{existsSync as aRe}from"node:fs";import{join as cRe}from"node:path";function lRe(t){let{cwd:e="."}=t;return ge(e,Wv,r=>uRe(r,e))}function uRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=cRe(e,i);aRe(o)||r.push(dRe(n.id,i,n.status))}return r}function dRe(t,e,r){return Hl(r)?{detector:Wv,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:Wv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Wv,Kv,tC=y(()=>{"use strict";Vv();wt();Wv="MISSING_IMPLEMENTATION";Kv={name:Wv,run:lRe}});function fRe(t){let{cwd:e="."}=t;return ge(e,rC,pRe)}function pRe(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:rC,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 rC,Jv,nC=y(()=>{"use strict";wt();rC="MISSING_TESTS";Jv={name:rC,run:fRe}});import{existsSync as mRe,readFileSync as hRe}from"node:fs";import{join as b5}from"node:path";function v5(t){if(mRe(t))try{return JSON.parse(hRe(t,"utf8"))}catch{return}}function bRe(t){let{cwd:e="."}=t,r=v5(b5(e,gRe)),n=v5(b5(e,yRe));if(!r||!n)return[{detector:iC,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>_Re&&i.push({detector:iC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var iC,gRe,yRe,_Re,S5,w5=y(()=>{"use strict";iC="PERFORMANCE_DRIFT",gRe="perf/baseline.json",yRe="perf/current.json",_Re=10;S5={name:iC,run:bRe}});import{existsSync as vRe}from"node:fs";import{join as SRe}from"node:path";function xRe(t){let{cwd:e="."}=t;return ge(e,oC,r=>kRe(r,e))}function $Re(t,e){return(t.modules??[]).some(r=>vRe(SRe(e,r)))}function kRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||$Re(s,e)||r.push(s.id);let n=wRe;if(r.length<=n)return[];let i=r.slice(0,x5).join(", "),o=r.length>x5?", \u2026":"";return[{detector:oC,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 oC,wRe,x5,$5,k5=y(()=>{"use strict";wt();oC="PLANNED_BACKLOG",wRe=5,x5=8;$5={name:oC,run:xRe}});import{existsSync as ERe,readFileSync as ARe}from"node:fs";import{join as TRe}from"node:path";function IRe(t){let{cwd:e="."}=t;return ge(e,sC,r=>PRe(r,e))}function PRe(t,e){if(t.features.lengthn.includes(i))?[{detector:sC,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. Fill it in with \`clad clarify\` or by hand.`}]:[]}var sC,ORe,RRe,E5,A5=y(()=>{"use strict";wt();sC="PROJECT_CONTEXT_DRIFT",ORe=8,RRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];E5={name:sC,run:IRe}});function T5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Yv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function CRe(t){let{cwd:e="."}=t;return ge(e,Yv,DRe)}function DRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...T5(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(...T5(e,n.features,`scenario ${n.id}.features`));return r}var Yv,Xv,aC=y(()=>{"use strict";wt();Yv="REFERENCE_INTEGRITY";Xv={name:Yv,run:CRe}});function Tp(t=""){return new RegExp(NRe,t)}var NRe,cC=y(()=>{"use strict";NRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as jRe,readdirSync as MRe,readFileSync as FRe,statSync as LRe,writeFileSync as zRe}from"node:fs";import{dirname as URe,join as Op,normalize as qRe,relative as BRe}from"node:path";function WRe(t){let e=[];for(let r of t.matchAll(VRe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Tp("g"))??[])e.push(n);return[...new Set(e)].sort()}function KRe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function O5(t){return t.split("\\").join("/")}function JRe(t){return HRe.some(e=>t===e||t.startsWith(`${e}/`))}function YRe(t){let e=Op(t,"docs");if(!jRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=MRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Op(i,s),c;try{c=LRe(a)}catch{continue}let l=O5(BRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function XRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=qRe(Op(URe(t),e));return O5(r)}function Rp(t="."){let e=[];for(let r of YRe(t)){let n;try{n=FRe(Op(t,r),"utf8")}catch{continue}let i=KRe(n),o=WRe(i);if(JRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(GRe)?[]:i.match(Tp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(ZRe)){let d=XRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function R5(t="."){let e=Rp(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 zRe(Op(t,"spec","_doc-links.yaml"),`${r.join(` +`;return f5(Eo(t,"spec","index.yaml"),n,"utf8"),!0}var Wv,kp=y(()=>{"use strict";Wv=St(er(),1)});import{existsSync as p5,readFileSync as m5,readdirSync as aRe}from"node:fs";import{join as tC}from"node:path";function cRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=_s(e),i=r.inventory;if(!i){let s=h5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return rC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...rC(e),{detector:Ep,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 h5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Ep,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(...rC(e)),o}function rC(t){let e=tC(t,"spec","index.yaml"),r=tC(t,"spec","features");if(!p5(e)||!p5(r))return[];let n=new Map;try{for(let l of m5(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 aRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=m5(tC(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:Ep,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:Ep,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 Ep,h5,g5,y5=y(()=>{"use strict";kp();Ue();Ep="INVENTORY_DRIFT",h5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];g5={name:Ep,run:cRe}});import{existsSync as lRe,readFileSync as uRe}from"node:fs";import{join as dRe}from"node:path";function pRe(t){let{cwd:e="."}=t,r=dRe(e,"src","spec","schema.json"),n=[];if(lRe(r)){let i;try{i=JSON.parse(uRe(r,"utf8"))}catch(o){n.push({detector:Ap,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of fRe)i.required?.includes(o)||n.push({detector:Ap,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Ap,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==_5&&n.push({detector:Ap,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${_5}'`})}catch{}return n}var Ap,fRe,_5,b5,v5=y(()=>{"use strict";Ue();Ap="META_INTEGRITY",fRe=["schema","project","features"],_5="0.1";b5={name:Ap,run:pRe}});function mRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return S5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),S5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function S5(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:w5,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 w5,x5,$5=y(()=>{"use strict";Ue();w5="SLUG_CONFLICT";x5={name:w5,run:mRe}});function Wl(t){return t==="planned"||t==="in_progress"}var Kv=y(()=>{"use strict"});import{existsSync as hRe}from"node:fs";import{join as gRe}from"node:path";function yRe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>_Re(r,e))}function _Re(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=gRe(e,i);hRe(o)||r.push(bRe(n.id,i,n.status))}return r}function bRe(t,e,r){return Wl(r)?{detector:Jv,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:Jv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Jv,Yv,nC=y(()=>{"use strict";Kv();wt();Jv="MISSING_IMPLEMENTATION";Yv={name:Jv,run:yRe}});function vRe(t){let{cwd:e="."}=t;return ge(e,iC,SRe)}function SRe(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:iC,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 iC,Xv,oC=y(()=>{"use strict";wt();iC="MISSING_TESTS";Xv={name:iC,run:vRe}});import{existsSync as wRe,readFileSync as xRe}from"node:fs";import{join as k5}from"node:path";function E5(t){if(wRe(t))try{return JSON.parse(xRe(t,"utf8"))}catch{return}}function ARe(t){let{cwd:e="."}=t,r=E5(k5(e,$Re)),n=E5(k5(e,kRe));if(!r||!n)return[{detector:sC,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>ERe&&i.push({detector:sC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var sC,$Re,kRe,ERe,A5,T5=y(()=>{"use strict";sC="PERFORMANCE_DRIFT",$Re="perf/baseline.json",kRe="perf/current.json",ERe=10;A5={name:sC,run:ARe}});import{existsSync as TRe}from"node:fs";import{join as ORe}from"node:path";function IRe(t){let{cwd:e="."}=t;return ge(e,aC,r=>CRe(r,e))}function PRe(t,e){return(t.modules??[]).some(r=>TRe(ORe(e,r)))}function CRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||PRe(s,e)||r.push(s.id);let n=RRe;if(r.length<=n)return[];let i=r.slice(0,O5).join(", "),o=r.length>O5?", \u2026":"";return[{detector:aC,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 aC,RRe,O5,R5,I5=y(()=>{"use strict";wt();aC="PLANNED_BACKLOG",RRe=5,O5=8;R5={name:aC,run:IRe}});import{existsSync as DRe,readFileSync as NRe}from"node:fs";import{join as jRe}from"node:path";function LRe(t){let{cwd:e="."}=t;return ge(e,cC,r=>zRe(r,e))}function zRe(t,e){if(t.features.lengthn.includes(i))?[{detector:cC,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. Fill it in with \`clad clarify\` or by hand.`}]:[]}var cC,MRe,FRe,P5,C5=y(()=>{"use strict";wt();cC="PROJECT_CONTEXT_DRIFT",MRe=8,FRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];P5={name:cC,run:LRe}});function D5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Qv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function URe(t){let{cwd:e="."}=t;return ge(e,Qv,qRe)}function qRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...D5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Qv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...D5(e,n.features,`scenario ${n.id}.features`));return r}var Qv,eS,lC=y(()=>{"use strict";wt();Qv="REFERENCE_INTEGRITY";eS={name:Qv,run:URe}});function Tp(t=""){return new RegExp(BRe,t)}var BRe,uC=y(()=>{"use strict";BRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as HRe,readdirSync as GRe,readFileSync as ZRe,statSync as VRe,writeFileSync as WRe}from"node:fs";import{dirname as KRe,join as Op,normalize as JRe,relative as YRe}from"node:path";function rIe(t){let e=[];for(let r of t.matchAll(tIe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Tp("g"))??[])e.push(n);return[...new Set(e)].sort()}function nIe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function N5(t){return t.split("\\").join("/")}function iIe(t){return XRe.some(e=>t===e||t.startsWith(`${e}/`))}function oIe(t){let e=Op(t,"docs");if(!HRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=GRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Op(i,s),c;try{c=VRe(a)}catch{continue}let l=N5(YRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function sIe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=JRe(Op(KRe(t),e));return N5(r)}function Rp(t="."){let e=[];for(let r of oIe(t)){let n;try{n=ZRe(Op(t,r),"utf8")}catch{continue}let i=nIe(n),o=rIe(i);if(iIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(QRe)?[]:i.match(Tp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(eIe)){let d=sIe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function j5(t="."){let e=Rp(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 WRe(Op(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var HRe,GRe,ZRe,VRe,Qv=y(()=>{"use strict";cC();HRe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],GRe="clad-doc-links: ignore",ZRe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,VRe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as QRe}from"node:fs";import{join as eIe}from"node:path";function tIe(t){let{cwd:e="."}=t;return ge(e,eS,r=>rIe(r,e))}function rIe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Rp(e).docs){for(let o of i.doc_links)QRe(eIe(e,o))||n.push({detector:eS,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:eS,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 eS,tS,lC=y(()=>{"use strict";Qv();wt();eS="DOC_LINK_INTEGRITY";tS={name:eS,run:tIe}});function nIe(t){let{cwd:e="."}=t;return ge(e,Ip,r=>iIe(r))}function iIe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=I5,o=t.project.onboarding_seeded===!0&&!i;r>=I5&&n.length===0&&e.push({detector:Ip,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 a of n)(a.features??[]).length===0&&e.push({detector:Ip,severity:o?"info":"warn",path:"spec/scenarios/",message:o?`scenario ${a.id} binds no features yet \u2014 retained as future onboarding intent; bind it when a matching feature lands.`:`scenario ${a.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let s=new Map(t.features.filter(a=>typeof a.slug=="string"&&a.slug.length>0).map(a=>[a.slug,a.id]));for(let a of n){if(!a.flow)continue;let c=new Set(a.features??[]),l=new Map;for(let u of a.flow.matchAll(/\(([^)]+)\)/g))for(let d of u[1].split(/[,/·]/)){let f=d.trim(),p=s.get(f);p&&!c.has(p)&&l.set(f,p)}if(l.size>0){let u=[...l].map(([d,f])=>`${d} (${f})`).join(", ");e.push({detector:Ip,severity:"warn",path:"spec/scenarios/",message:`scenario ${a.id} flow references ${u} but features[] does not bind ${l.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var Ip,I5,P5,C5=y(()=>{"use strict";wt();Ip="SCENARIO_COVERAGE",I5=8;P5={name:Ip,run:nIe}});import{createHash as oIe}from"node:crypto";function sIe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Pp(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??D5),sample:sIe(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(D5),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Cp(t){return(t.features??[]).filter(e=>e.status==="done").length}function aIe(t,e){return e<=0?!1:e>=1?!0:parseInt(oIe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var D5,rS=y(()=>{"use strict";D5=["unwanted"]});import{chmodSync as cIe,existsSync as j5,readFileSync as lIe,readdirSync as uIe,statSync as M5,unlinkSync as dIe,utimesSync as fIe,writeFileSync as pIe}from"node:fs";import{join as F5}from"node:path";import L5 from"node:process";function mIe(t){return KK(t).map(e=>{try{let r=M5(e);return r.isFile()?{path:e,body:lIe(e),mode:r.mode,atime:r.atime,mtime:r.mtime}:{path:e,nonFile:!0}}catch(r){if(r.code==="ENOENT")return{path:e};throw r}})}function hIe(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!j5(r.path))continue;if(!M5(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}dIe(r.path);continue}pIe(r.path,r.body),r.mode!==void 0&&cIe(r.path,r.mode),r.atime&&r.mtime&&fIe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function gIe(t){let e=!1,r=n=>{for(let i of uIe(n,{withFileTypes:!0})){if(e)return;let o=F5(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 uC(t={}){let{cwd:e="."}=t,r=F5(e,bs);if(!j5(r)||!gIe(r))return{stage:Ka,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${bs}/ \u2014 skipped`};let n=dt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Ka,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o;try{o=mIe(e)}catch(d){return{stage:Ka,pass:!1,exitCode:1,stderr:`could not preserve the full test report before the scoped oracle run: ${d.message}`}}let s,a,c=[...i.args,bs];try{s=Ye(i.cmd,c,{cwd:e,reject:!1})}catch(d){a=d}let l=hIe(o);if(l.length>0)return{stage:Ka,pass:!1,exitCode:1,stderr:`could not restore the full test report after the scoped oracle run: ${l.join("; ")}`};if(a||!s)return{stage:Ka,pass:!1,exitCode:1,stderr:`oracle runner failed to start: ${a?.message??"unknown error"}`};let u=qt(Ka,i.cmd,s,c);return u||tr(Ka,s)}var Ka,bs,yIe,dC=y(()=>{"use strict";Mr();on();dp();On();Ka="stage_2.3",bs="tests/oracle";yIe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${L5.argv[1]}`;if(yIe){let t=uC();console.log(JSON.stringify(t)),L5.exit(t.exitCode)}});import{existsSync as _Ie}from"node:fs";import{join as bIe}from"node:path";function vIe(t){let{cwd:e="."}=t;return ge(e,ni,r=>SIe(r,e))}function SIe(t,e){let r=[],n=Pp(t.project,Cp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?Rn(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(Dp(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:ni,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${bs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!_Ie(bIe(e,f))){r.push({detector:ni,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${bs}/`)||r.push({detector:ni,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${bs}/ \u2014 stage_2.3 only runs ${bs}/, 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:ni,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:ni,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ni,severity:"info",message:`${l.id}.${u.id} oracle author\u2260implementer not verified \u2014 no implementer identity recorded (no clad run history to compare)`});let h=(p.readManifest??[]).filter(g=>(l.modules??[]).includes(g));h.length>0&&r.push({detector:ni,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:ni,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:ni,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 ni,z5,U5=y(()=>{"use strict";ri();rS();dC();wt();ni="SPEC_CONFORMANCE";z5={name:ni,run:vIe}});function wIe(t){let{cwd:e="."}=t,r=Rn(e);if(r.length===0)return[{detector:fC,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>q5&&i.push({detector:fC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${q5})`})}return i}var fC,q5,B5,H5=y(()=>{"use strict";ri();fC="STALE_EVIDENCE",q5=90;B5={name:fC,run:wIe}});import{existsSync as G5}from"node:fs";import{join as Z5}from"node:path";function xIe(t){let{cwd:e="."}=t;return ge(e,Gl,r=>$Ie(r,e))}function $Ie(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Gl,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:Gl,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=>G5(Z5(e,o)));i.length>0&&r.push({detector:Gl,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Hl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>G5(Z5(e,i)))&&r.push({detector:Gl,severity:"info",message:`feature ${n.id} (status='${n.status}') declares ${n.modules?.length??0} module(s) that aren't built yet \u2014 the normal state while implementing (not stale)`})}return r}var Gl,nS,pC=y(()=>{"use strict";Vv();wt();Gl="STALE_SPECIFICATION";nS={name:Gl,run:xIe}});import{existsSync as V5,statSync as W5}from"node:fs";import{join as K5}from"node:path";function EIe(t,e){let r=0;for(let n of e){let i=K5(t,n);if(!V5(i))continue;let o=W5(i).mtimeMs;o>r&&(r=o)}return r}function AIe(t){let{cwd:e="."}=t;return ge(e,mC,r=>TIe(r,e))}function TIe(t,e){let r=ji(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=EIe(e,n);if(i===0)return[];let o=ys([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=K5(e,a);if(!V5(c))continue;let l=W5(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>kIe&&s.push({detector:mC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var mC,kIe,iS,hC=y(()=>{"use strict";vp();Ba();wt();mC="STALE_TESTS",kIe=30;iS={name:mC,run:AIe}});import{existsSync as OIe}from"node:fs";import{join as RIe}from"node:path";function IIe(t){let{cwd:e="."}=t;return ge(e,Np,r=>PIe(r,e))}function PIe(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:Np,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=>!OIe(RIe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:Np,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:Np,severity:Hl(n.status)?"info":"warn",message:`feature ${n.id} is in progress and none of its declared modules are built yet \u2014 the normal state while implementing`}))}return r}var Np,oS,gC=y(()=>{"use strict";Vv();wt();Np="STATUS_DRIFT";oS={name:Np,run:IIe}});function CIe(t){let{cwd:e="."}=t;return ge(e,sS,r=>DIe(r,e))}function DIe(t,e){let r=dt(e).language;return r==="unknown"?[{detector:sS,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:sS,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var sS,J5,Y5=y(()=>{"use strict";on();wt();sS="TECH_STACK_MISMATCH";J5={name:sS,run:CIe}});function FIe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function LIe(t){let{cwd:e="."}=t;return ge(e,yC,r=>zIe(r,e))}function zIe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=ys([...FIe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:yC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var yC,X5,NIe,jIe,MIe,aS,_C=y(()=>{"use strict";vp();qP();wt();yC="UNMAPPED_ARTIFACT",X5=["src/stages/**/*.ts","src/spec/**/*.ts"],NIe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},jIe={kotlin:"src/main/kotlin"},MIe=8;aS={name:yC,run:LIe}});import{existsSync as Q5}from"node:fs";import{join as eY}from"node:path";function qIe(t){return UIe.some(e=>t.startsWith(e))}function BIe(t){let{cwd:e="."}=t;return ge(e,bC,r=>HIe(r,e))}function HIe(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(qIe(o))continue;let s=o.split("#",1)[0];Q5(eY(e,o))||s&&Q5(eY(e,s))||r.push({detector:bC,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 jx(t){return`${JSON.stringify(t,null,2)} +`}function ite(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?`[[${ete(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(tte);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(tte);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}/${ete(s)}.md`,`${a.join(` +`)}`)}return o}function tte(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as GUe}from"node:fs";import{dirname as ZUe,join as kj}from"node:path";import{fileURLToPath as VUe}from"node:url";var Ej=ZUe(VUe(import.meta.url));function ote(t){for(let e of[kj(Ej,"viewer",t),kj(Ej,"..","graph","viewer",t),kj(Ej,"..","..","dist","viewer",t)])try{return GUe(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function ste(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -895,55 +896,57 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}ZP();lC();tC();nC();aC();GP();hC();gC();_C();vC();Km();cC();Be();var RUe=[Jv,cS,Kv,aS,Xv,tS,Hv,oS,iS,Bv];function IUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[Ue.module(n),Ue.test(n),Ue.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Tp().exec(t.message??"");return r&&e.has(Ue.feature(r[0]))?[Ue.feature(r[0])]:[]}function Nx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,H(e))}catch{}try{for(let o of RUe){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 IUe(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{Ea(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}$j();Be();Oi();var CUe=new Set(["mermaid","dot","json","obsidian","html"]);function Qee(t={}){try{let e=t.format??"mermaid";if(!CUe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=bc(n,".");if(t.focus){let s=Ox(n,i,t.focus);if(s.length===0){L("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){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Tx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Kee(i);for(let[c,l]of a){let u=PUe(s,c);kj(Aj(u),{recursive:!0}),Ej(u,l,"utf8")}L("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){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=Dx(i,Nx(i,"."));kj(Aj(t.out),{recursive:!0}),Ej(t.out,s,"utf8"),L("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"?Wee(i):r==="json"?Cx(i):Vee(i);t.out?(kj(Aj(t.out),{recursive:!0}),Ej(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function ete(){try{let t=bc(H(),".");process.stdout.write(Xee(jx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Km();import{createServer as DUe}from"node:http";import{existsSync as NUe,watch as jUe}from"node:fs";import{join as MUe}from"node:path";Be();Oi();function FUe(t={}){let e=t.cwd??".",r=new Set,n=()=>bc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}WP();dC();nC();oC();lC();VP();yC();_C();vC();wC();Jm();uC();Ue();var WUe=[Xv,uS,Yv,lS,eS,nS,Zv,aS,sS,Gv];function KUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Tp().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Fx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,q(e))}catch{}try{for(let o of WUe){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 KUe(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{Ea(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}Aj();Ue();Ii();var YUe=new Set(["mermaid","dot","json","obsidian","html"]);function cte(t={}){try{let e=t.format??"mermaid";if(!YUe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=wc(n,".");if(t.focus){let s=Px(n,i,t.focus);if(s.length===0){L("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){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Ix(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=ite(i);for(let[c,l]of a){let u=JUe(s,c);Tj(Rj(u),{recursive:!0}),Oj(u,l,"utf8")}L("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){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=Mx(i,Fx(i,"."));Tj(Rj(t.out),{recursive:!0}),Oj(t.out,s,"utf8"),L("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"?nte(i):r==="json"?jx(i):rte(i);t.out?(Tj(Rj(t.out),{recursive:!0}),Oj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function lte(){try{let t=wc(q(),".");process.stdout.write(ate(Lx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Jm();import{createServer as XUe}from"node:http";import{existsSync as QUe,watch as eqe}from"node:fs";import{join as tqe}from"node:path";Ue();Ii();function rqe(t={}){let e=t.cwd??".",r=new Set,n=()=>wc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=DUe((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=Cx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Nx(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=XUe((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=jx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Fx(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=Dx(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=MUe(e,u);if(NUe(d))try{let f=jUe(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=Mx(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=tqe(e,u);if(QUe(d))try{let f=eqe(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 tte(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await FUe({port:e,cwd:t.cwd??"."});L("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){L("fail","graph",r.message),process.exit(1)}}var LUe=["stage_1.1","stage_2.1","stage_2.3"];function zUe(t){return(t.features??[]).filter(e=>e.status==="done")}function UUe(t,e){let r=zUe(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 rte(t,e){let r=[];for(let n of LUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=UUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}bS();import nte from"node:process";function qUe(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 Mx(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=qUe(n,t);i.pass||r.push(i)}return r}ri();var Tj="stage_4.1";function Oj(t={}){let{cwd:e="."}=t,r=Rn(e);if(r.length===0)return{stage:Tj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Mx(r);if(n.length===0)return{stage:Tj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Tj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var BUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${nte.argv[1]}`;if(BUe){let t=Oj();console.log(JSON.stringify(t)),nte.exit(t.exitCode)}yl();import{randomBytes as HUe}from"node:crypto";import{unlinkSync as GUe}from"node:fs";import{tmpdir as ZUe}from"node:os";import{join as VUe,resolve as Rj}from"node:path";import WUe from"node:process";var qr=null;function ite(t){qr={cwd:Rj(t),run:null,jsonFile:null}}function ote(){return qr!==null}function ste(t,e){if(!qr||qr.cwd!==Rj(t))return null;if(qr.run)return qr.run;let r=VUe(ZUe(),`clad-shared-vitest-${WUe.pid}-${HUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function ate(t){return!qr||qr.cwd!==Rj(t)?null:qr.run}function cte(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function lte(){let t=qr?.jsonFile;if(qr=null,t)try{GUe(t)}catch{}}Mr();import ute from"node:process";var Fx="stage_1.4";function Ij(t={}){let{cwd:e="."}=t,r;try{r=Ye("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Fx,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:Fx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Fx,pass:!0,exitCode:0}:{stage:Fx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var KUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ute.argv[1]}`;if(KUe){let t=Ij();console.log(JSON.stringify(t)),ute.exit(t.exitCode)}Mr();import dte from"node:process";Jm();On();var Lx="stage_2.2";function Pj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=No("coverage",t))}catch(c){return{stage:Lx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Lx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=ate(e),s=o?o.proc:Ye(r,[...n],{cwd:e,reject:!1}),a=qt(Lx,r,s,n);return a||tr(Lx,s)}var XUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dte.argv[1]}`;if(XUe){let t=Pj();console.log(JSON.stringify(t)),dte.exit(t.exitCode)}Mp();Cj();Mr();on();On();import pte from"node:process";var Bx="stage_3.2";function Dj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Bx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Ll(e,o[o.length-1]))return{stage:Bx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Bx,i,s,o);return a||tr(Bx,s)}var hqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${pte.argv[1]}`;if(hqe){let t=Dj();console.log(JSON.stringify(t)),pte.exit(t.exitCode)}Mr();Be();On();import{existsSync as gqe}from"node:fs";import{resolve as hte}from"node:path";import gte from"node:process";var li="stage_2.4",Nj=5e3,yqe=3e4;function jj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:li,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return bqe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:li,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:li,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:li,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=hte(e,r.path);if(!gqe(s))return{stage:li,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Nj,c;try{c=Ye(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=qt(li,r.path,c);if(l)return l;if(c.timedOut)return{stage:li,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:li,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:li,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var mte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},_qe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function bqe(t,e,r){let n=Math.min(e.length*Nj,yqe),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(vqe(t,s,r))}return Sqe(o)}function vqe(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?hte(t,a):a,u=Nj,d;try{d=Ye(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(za(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function Sqe(t){let e="skip";for(let o of t)mte[o.disposition]>mte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${_qe[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` -`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:li,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:li,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var wqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${gte.argv[1]}`;if(wqe){let t=jj();console.log(JSON.stringify(t)),gte.exit(t.exitCode)}Mr();on();On();import yte from"node:process";var Hx="stage_3.1";function Mj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Hx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Ll(e,o[o.length-1]))return{stage:Hx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Hx,i,s,o);return a||tr(Hx,s)}var xqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${yte.argv[1]}`;if(xqe){let t=Mj();console.log(JSON.stringify(t)),yte.exit(t.exitCode)}dC();Fj();Lj();Mr();Ux();import{randomBytes as Rqe}from"node:crypto";import{unlinkSync as Iqe}from"node:fs";import{tmpdir as Pqe}from"node:os";import{join as Cqe}from"node:path";import Uj from"node:process";Jm();On();Be();import{readFileSync as Eqe}from"node:fs";import{resolve as vte}from"node:path";function Aqe(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=vte(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function Tqe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function Oqe(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=Tqe(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(vte(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function zj(t,e){try{let r=Aqe(Eqe(t,"utf8"));return r?Oqe(H(e),r,e):[]}catch{return[]}}var Ji="stage_2.1";function Ste(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Dqe(t){let e=`${String(t.stdout??"")} -${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function Nqe(t,e,r){let n,i;try{({cmd:n,args:i}=No("coverage",t))}catch{return null}if(!n||!i||!Ste(n,i))return null;let o=n,s=i,a=ste(e,d=>Ye(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(qt(Ji,n,c,s))return null;let u=tr(Ji,c);if(cte(u)==="fallback")return null;if(r){let d=zj(l,e);if(d.length>0)return{stage:Ji,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ji,pass:!0,exitCode:0}}function qj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=No("test",t))}catch(u){return{stage:Ji,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ji,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Ste(n,i),a=r&&s;if(ote()&&s){let u=Nqe(t,e,a);if(u)return u}let c,l=i;a&&(c=Cqe(Pqe(),`clad-vitest-${Uj.pid}-${Rqe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Ye(n,[...l],{cwd:e,reject:!1}),d=qt(Ji,n,u,l);if(d)return d;let f=Ru("unit",tr(Ji,u),u);if(r&&f.pass&&Dqe(u)){let p={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Ji,pass:!1,exitCode:1,findings:[p],stderr:p.message}}if(a&&f.pass&&c){let p=zj(c,e);if(p.length>0)return{stage:Ji,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{Iqe(c)}catch{}}}var jqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Uj.argv[1]}`;if(jqe){let t=qj();console.log(JSON.stringify(t)),Uj.exit(t.exitCode)}Mr();on();On();import wte from"node:process";var Vx="stage_3.3";function Bj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Vx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Ll(e,o[o.length-1]))return{stage:Vx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Vx,i,s,o);return a||tr(Vx,s)}var Mqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wte.argv[1]}`;if(Mqe){let t=Bj();console.log(JSON.stringify(t)),wte.exit(t.exitCode)}pC();jf();_a();Gj();kp();Qv();var Ote=St(Qt(),1);import{existsSync as Zj,readFileSync as Wqe,readdirSync as Tte,statSync as Kqe,writeFileSync as Jqe}from"node:fs";import{basename as eh,join as th,relative as Ate}from"node:path";var Yqe=["self-dogfood:","fixture:","derived:"],Rte=/\.(test|spec)\.[jt]sx?$/;function Ite(t,e=t,r=[]){let n;try{n=Tte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=th(e,i);try{Kqe(o).isDirectory()?Ite(t,o,r):Rte.test(i)&&r.push(o)}catch{continue}}return r}function Pte(t="."){let e=th(t,"spec","features"),r=th(t,"tests"),n=[],i=[];if(!Zj(e)||!Zj(r))return{repaired:n,suggested:i};let o=Ite(r),s=new Map;for(let a of o){let c=Ate(t,a).split("\\").join("/"),l=s.get(eh(a))??[];l.push(c),s.set(eh(a),l)}for(let a of Tte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=th(e,a),l,u;try{l=Wqe(c,"utf8"),u=(0,Ote.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(Yqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Zj(th(t,b)))continue;let _=s.get(eh(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=>eh(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Ate(t,h).split("\\").join("/")).find(h=>{let g=eh(h).replace(Rte,"");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 ute(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await rqe({port:e,cwd:t.cwd??"."});L("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){L("fail","graph",r.message),process.exit(1)}}var nqe=["stage_1.1","stage_2.1","stage_2.3"];function iqe(t){return(t.features??[]).filter(e=>e.status==="done")}function oqe(t,e){let r=iqe(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 dte(t,e){let r=[];for(let n of nqe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=oqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}wS();import fte from"node:process";function sqe(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 zx(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=sqe(n,t);i.pass||r.push(i)}return r}ni();var Ij="stage_4.1";function Pj(t={}){let{cwd:e="."}=t,r=In(e);if(r.length===0)return{stage:Ij,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=zx(r);if(n.length===0)return{stage:Ij,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Ij,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var aqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${fte.argv[1]}`;if(aqe){let t=Pj();console.log(JSON.stringify(t)),fte.exit(t.exitCode)}Sl();import{randomBytes as cqe}from"node:crypto";import{unlinkSync as lqe}from"node:fs";import{tmpdir as uqe}from"node:os";import{join as dqe,resolve as Cj}from"node:path";import fqe from"node:process";var qr=null;function pte(t){qr={cwd:Cj(t),run:null,jsonFile:null}}function Dj(){return qr!==null}function Nj(t,e){if(!qr||qr.cwd!==Cj(t))return null;if(qr.run)return qr.run;let r=dqe(uqe(),`clad-shared-vitest-${fqe.pid}-${cqe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function mte(t){return!qr||qr.cwd!==Cj(t)?null:qr.run}function jj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function hte(){let t=qr?.jsonFile;if(qr=null,t)try{lqe(t)}catch{}}Mr();import gte from"node:process";var Ux="stage_1.4";function Mj(t={}){let{cwd:e="."}=t,r;try{r=We("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Ux,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:Ux,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Ux,pass:!0,exitCode:0}:{stage:Ux,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var pqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${gte.argv[1]}`;if(pqe){let t=Mj();console.log(JSON.stringify(t)),gte.exit(t.exitCode)}Mr();import yte from"node:process";Ym();Rn();var qx="stage_2.2";function Fj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Yi("coverage",t))}catch(c){return{stage:qx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:qx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=mte(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(qx,r,s,n);return a||Yt(qx,s)}var gqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${yte.argv[1]}`;if(gqe){let t=Fj();console.log(JSON.stringify(t)),yte.exit(t.exitCode)}Mp();Lj();Mr();sn();Rn();import bte from"node:process";var Gx="stage_3.2";function zj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Gx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Bl(e,o[o.length-1]))return{stage:Gx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Gx,i,s,o);return a||Yt(Gx,s)}var jqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${bte.argv[1]}`;if(jqe){let t=zj();console.log(JSON.stringify(t)),bte.exit(t.exitCode)}Mr();Ue();Rn();import{existsSync as Mqe}from"node:fs";import{resolve as Ste}from"node:path";import wte from"node:process";var di="stage_2.4",Uj=5e3,Fqe=3e4;function qj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:di,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return zqe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:di,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:di,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Ste(e,r.path);if(!Mqe(s))return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Uj,c;try{c=We(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(di,r.path,c);if(l)return l;if(c.timedOut)return{stage:di,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:di,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:di,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var vte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},Lqe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function zqe(t,e,r){let n=Math.min(e.length*Uj,Fqe),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(Uqe(t,s,r))}return qqe(o)}function Uqe(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?Ste(t,a):a,u=Uj,d;try{d=We(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(za(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function qqe(t){let e="skip";for(let o of t)vte[o.disposition]>vte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${Lqe[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` +`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:di,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:di,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var Bqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wte.argv[1]}`;if(Bqe){let t=qj();console.log(JSON.stringify(t)),wte.exit(t.exitCode)}Mr();sn();Rn();import xte from"node:process";var Zx="stage_3.1";function Bj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Zx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Bl(e,o[o.length-1]))return{stage:Zx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Zx,i,s,o);return a||Yt(Zx,s)}var Hqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xte.argv[1]}`;if(Hqe){let t=Bj();console.log(JSON.stringify(t)),xte.exit(t.exitCode)}pC();Hj();Gj();Mr();Bx();import{randomBytes as Yqe}from"node:crypto";import{unlinkSync as Xqe}from"node:fs";import{tmpdir as Qqe}from"node:os";import{join as e4e}from"node:path";import Vj from"node:process";Ym();Rn();Ue();import{readFileSync as Vqe}from"node:fs";import{resolve as Ete}from"node:path";function Wqe(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=Ete(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function Kqe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function Jqe(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=Kqe(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(Ete(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function Zj(t,e){try{let r=Wqe(Vqe(t,"utf8"));return r?Jqe(q(e),r,e):[]}catch{return[]}}var Br="stage_2.1";function Ate(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Tte(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Ote(t){let e=`${String(t.stdout??"")} +${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function t4e(t,e,r){let n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Ate(n,i))return null;let o=n,s=i,a=Nj(e,d=>We(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Br,n,c,s))return null;let u=Yt(Br,c);if(jj(u)==="fallback")return null;if(r){let d=Zj(l,e);if(d.length>0)return{stage:Br,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Br,pass:!0,exitCode:0}}function r4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Tte(n,i))return null;let o=n,s=i,a=Nj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Br,o,a.proc,s))return null;let c=Yt(Br,a.proc);if(jj(c)==="fallback")return null;if(r&&Ote(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Br,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Br,pass:!0,exitCode:0}}function Wj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Yi("test",t))}catch(d){return{stage:Br,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Br,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Ate(n,i),a=Tte(n,i),c=r&&s;if(Dj()&&s){let d=t4e(t,e,c);if(d)return d}if(Dj()&&a){let d=r4e(t,e);if(d)return d}let l,u=i;c&&(l=e4e(Qqe(),`clad-vitest-${Vj.pid}-${Yqe(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Br,n,d,u);if(f)return f;let p=Iu("unit",Yt(Br,d),d);if(r&&p.pass&&Ote(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Br,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Zj(l,e);if(m.length>0)return{stage:Br,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{Xqe(l)}catch{}}}var n4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Vj.argv[1]}`;if(n4e){let t=Wj();console.log(JSON.stringify(t)),Vj.exit(t.exitCode)}Mr();sn();Rn();import Rte from"node:process";var Kx="stage_3.3";function Kj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Kx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Bl(e,o[o.length-1]))return{stage:Kx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Kx,i,s,o);return a||Yt(Kx,s)}var i4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rte.argv[1]}`;if(i4e){let t=Kj();console.log(JSON.stringify(t)),Rte.exit(t.exitCode)}hC();Mf();_a();Yj();kp();tS();var Mte=St(er(),1);import{existsSync as Xj,readFileSync as h4e,readdirSync as jte,statSync as g4e,writeFileSync as y4e}from"node:fs";import{basename as rh,join as nh,relative as Nte}from"node:path";var _4e=["self-dogfood:","fixture:","derived:"],Fte=/\.(test|spec)\.[jt]sx?$/;function Lte(t,e=t,r=[]){let n;try{n=jte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=nh(e,i);try{g4e(o).isDirectory()?Lte(t,o,r):Fte.test(i)&&r.push(o)}catch{continue}}return r}function zte(t="."){let e=nh(t,"spec","features"),r=nh(t,"tests"),n=[],i=[];if(!Xj(e)||!Xj(r))return{repaired:n,suggested:i};let o=Lte(r),s=new Map;for(let a of o){let c=Nte(t,a).split("\\").join("/"),l=s.get(rh(a))??[];l.push(c),s.set(rh(a),l)}for(let a of jte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=nh(e,a),l,u;try{l=h4e(c,"utf8"),u=(0,Mte.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(_4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Xj(nh(t,b)))continue;let _=s.get(rh(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=>rh(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Nte(t,h).split("\\").join("/")).find(h=>{let g=rh(h).replace(Fte,"");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&&Jqe(c,l,"utf8")}return{repaired:n,suggested:i}}gl();import{existsSync as Xqe,readFileSync as Qqe}from"node:fs";import{join as e4e}from"node:path";function t4e(t,e){let r=e4e(t,e);if(!Xqe(r))return[];let n=[];for(let i of Qqe(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 Cte(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=>t4e(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 Dte(t){let e=[];e.push(`# Impl-blind 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(` -`)}rS();Be();Oi();ri();gl();var Vj=["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"],r4e=[...Vj,"att"];function n4e(t,e,r){if(e.startsWith("stage_4")){let n=Rn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Mx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function i4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":q_(e,r,t).state==="fresh"?"\u2713":"!"}function Yx(t,e="."){let r=as(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Vj.map(o=>n4e(i,o,e)),i4e(i,r,e)]}));return{columns:r4e,rows:n}}function Nte(t,e=".",r={}){let n=r.internal??!1,i=Yx(t,e),o=[...Vj.map(c=>n?c.replace("stage_",""):o4e(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` -`)}function o4e(t){return Ta(t).slice(0,3)}async function P8e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Jue(),Kue)),Promise.resolve().then(()=>(tde(),ede)),Promise.resolve().then(()=>(Xp(),s7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Lee(s),prepareInit:({cwd:s,mode:a,intent:c})=>Mee(s,a,c),initialize:dj,prepareClarify:(s,{cwd:a})=>Fee(a,s),clarify:hj,resolveReview:(s,{cwd:a})=>Cee(s,{cwd:a})}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function C8e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await dj({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});if(e.json){V.stdout.write(`${JSON.stringify(n,null,2)} -`),V.exit(0);return}for(let o of n.created)L("pass",`created ${o}`);for(let o of n.skipped)L("skip",o);for(let o of n.proposals??[])L("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(L("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){V.stdout.write(` +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&y4e(c,l,"utf8")}return{repaired:n,suggested:i}}vl();import{existsSync as b4e,readFileSync as v4e}from"node:fs";import{join as S4e}from"node:path";function w4e(t,e){let r=S4e(t,e);if(!b4e(r))return[];let n=[];for(let i of v4e(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 Ute(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=>w4e(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 qte(t){let e=[];e.push(`# Impl-blind 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(` +`)}iS();Ue();Ii();ni();vl();var Qj=["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"],x4e=[...Qj,"att"];function $4e(t,e,r){if(e.startsWith("stage_4")){let n=In(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return zx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function k4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":H_(e,r,t).state==="fresh"?"\u2713":"!"}function Qx(t,e="."){let r=as(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Qj.map(o=>$4e(i,o,e)),k4e(i,r,e)]}));return{columns:x4e,rows:n}}function Bte(t,e=".",r={}){let n=r.internal??!1,i=Qx(t,e),o=[...Qj.map(c=>n?c.replace("stage_",""):E4e(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` +`)}function E4e(t){return Ta(t).slice(0,3)}async function Q8e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(ide(),nde)),Promise.resolve().then(()=>(lde(),cde)),Promise.resolve().then(()=>(Qp(),b7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Wee(s),prepareInit:({cwd:s,mode:a,intent:c})=>Zee(s,a,c),initialize:mj,prepareClarify:(s,{cwd:a})=>Vee(a,s),clarify:_j,resolveReview:(s,{cwd:a})=>qee(s,{cwd:a})}});n(i.server);let o=new r;G.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function e5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await mj({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});if(e.json){G.stdout.write(`${JSON.stringify(n,null,2)} +`),G.exit(0);return}for(let o of n.created)L("pass",`created ${o}`);for(let o of n.skipped)L("skip",o);for(let o of n.proposals??[])L("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(L("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){G.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: -`);for(let[o,s]of n.clarifyingQuestions.entries())V.stdout.write(` ${o+1}. ${s} -`);V.stdout.write(` -`)}else r||n.created.some(s=>s==="docs/conventions.md")&&(V.stdout.write(` +`);for(let[o,s]of n.clarifyingQuestions.entries())G.stdout.write(` ${o+1}. ${s} +`);G.stdout.write(` +`)}else r||n.created.some(s=>s==="docs/conventions.md")&&(G.stdout.write(` \u{1F4A1} Tip: for a more precise scaffold, describe the project: -`),V.stdout.write(` clad init -`),V.stdout.write(` e.g. clad init payment SaaS for B2B -`),V.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. - -`));V.exit(0)}async function D8e(t,e){L("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(()=>(Ede(),kde)),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)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),V.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>nR(l,s)),c=`${aG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&V.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&L("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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function N8e(t={}){try{let e=H();if(ya("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=_s(".");Bl(".",r),Wa("."),R5(".");let n=eu(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Pte(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=Jx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=nS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),V.exit(0);return}L("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){L("fail","sync",e.message),V.exit(1)}}function j8e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=k_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function M8e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=E_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}A_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("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?V.stdout.write(`Run: git checkout ${r.gitHead} -`):V.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),V.exit(0)}async function F8e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await ZC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});V.exit(r.errors.length>0?1:0)}async function L8e(){L("note","update","reconciling the current project after the engine upgrade");let t=await EX(".",{wireHosts:async()=>(await ZC({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),V.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);V.stdout.write(` +`),G.stdout.write(` clad init +`),G.stdout.write(` e.g. clad init payment SaaS for B2B +`),G.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. + +`));G.exit(0)}async function t5e(t,e){L("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(()=>(Dde(),Cde)),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)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),G.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=q(e.cwd??"."),a=n.featuresTouched.map(l=>oR(l,s)),c=`${pG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&G.stdout.write(`Touched: ${a.join(", ")} +`)}let o=n.stubsCreated.length>0;o&&L("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.`),G.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function r5e(t={}){try{let e=q();if(ya("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=_s(".");Vl(".",r),Wa("."),j5(".");let n=tu(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=zte(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=Xx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=oS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),G.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),G.exit(0);return}L("pass","sync",`${e.features.length} features valid`),G.exit(0)}catch(e){L("fail","sync",e.message),G.exit(1)}}function n5e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),G.exit(2);return}let e=A_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),G.exit(0)}function i5e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),G.exit(2);return}let r=T_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),G.exit(1);return}O_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("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?G.stdout.write(`Run: git checkout ${r.gitHead} +`):G.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. +`),G.exit(0)}async function o5e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await WC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});G.exit(r.errors.length>0?1:0)}async function s5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await BX(".",{wireHosts:async()=>(await WC({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),G.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);G.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),xA({tier:"pre-commit",strict:!0}).anyFailed?V.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"):L("pass","drift","clean against the stricter detectors"),V.exit(t.code)}var z8e={"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 xA(t){let e=t.tier??"all",r=t.silent===!0,n=z8e[e];if(!n)return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>Xm(i)],["stage_1.2",()=>Ym(i)],["stage_1.3",()=>ii({...i,strict:t.strict})],["stage_1.4",Ij],["stage_1.5",rc],["stage_1.6",Gp],["stage_2.1",()=>qj({...i,strict:t.strict})],["stage_2.2",()=>Pj(i)],["stage_2.3",uC],["stage_2.4",jj],["stage_3.1",Mj],["stage_3.2",Dj],["stage_3.3",Bj],["stage_4.1",Oj],["stage_4.2",Qm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":si(d)?"fail":"skip",u=[];B_("."),ite(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=pX(p);si(h)&&(c=!0,a=Math.max(a,mX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),si(h)&&W8e(p))}}finally{G_(),lte()}if(t.strict)try{let d=H();for(let f of rte(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!si(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>si(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ya("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{AG(".",H())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&V.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"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function U8e(t){try{let e=H(),r=ll(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} -`),V.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),V.exit(1)}}function q8e(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} -`),V.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),V.exit(1)}}function B8e(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=lS(e,o=>{try{return Tde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),V.exit(0)}catch(e){L("fail","infer-deps",e.message),V.exit(1)}}function H8e(t={}){try{if(t.sessions){qee(t);return}if(t.trend!==void 0&&t.trend!==!1){Bee(t);return}let e=H(),n=EH(e,o=>{try{return Tde(o,"utf8")}catch{return null}},"."),i=TH(".",n);if(t.json)V.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let o=n.context,s=o.truncatedCount>0?`budget enforces ${o.medianShrinkTruncated}x on ${o.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=o.fitsCount>0?`${o.medianShrinkFit}x on ${o.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${o.medianSliceTokens} tok vs naive ${o.medianNaiveTokens} tok \u2014 ${s}, ${a}`,` uncapped structural slice = ${o.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)}`,` ${ul}`];V.stdout.write(`${c.join(` +`),kA({tier:"pre-commit",strict:!0}).anyFailed?G.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"):L("pass","drift","clean against the stricter detectors"),G.exit(t.code)}var a5e={"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 kA(t){let e=t.tier??"all",r=t.silent===!0,n=a5e[e];if(!n)return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>eh(i)],["stage_1.2",()=>Qm(i)],["stage_1.3",()=>oi({...i,strict:t.strict})],["stage_1.4",Mj],["stage_1.5",rc],["stage_1.6",Zp],["stage_2.1",()=>Wj({...i,strict:t.strict})],["stage_2.2",()=>Fj(i)],["stage_2.3",fC],["stage_2.4",qj],["stage_3.1",Bj],["stage_3.2",zj],["stage_3.3",Kj],["stage_4.1",Pj],["stage_4.2",th]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ci(d)?"fail":"skip",u=[];G_("."),pte(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=RX(p);ci(h)&&(c=!0,a=Math.max(a,IX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),ci(h)&&h5e(p))}}finally{V_(),hte()}if(t.strict)try{let d=q();for(let f of dte(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!ci(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>ci(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ya("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{CG(".",q())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&G.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),tr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function c5e(t){try{let e=q(),r=fl(e,t);G.stdout.write(`${JSON.stringify(r,null,2)} +`),G.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),G.exit(1)}}function l5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=vr(r,t,{depth:n});G.stdout.write(`${JSON.stringify(i,null,2)} +`),G.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),G.exit(1)}}function u5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=dS(e,o=>{try{return jde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});G.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),G.exit(0)}catch(e){L("fail","infer-deps",e.message),G.exit(1)}}function d5e(t={}){try{if(t.sessions){Yee(t);return}if(t.trend!==void 0&&t.trend!==!1){Xee(t);return}let e=q(),n=PH(e,o=>{try{return jde(o,"utf8")}catch{return null}},"."),i=DH(".",n);if(t.json)G.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let o=n.context,s=o.truncatedCount>0?`budget enforces ${o.medianShrinkTruncated}x on ${o.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=o.fitsCount>0?`${o.medianShrinkFit}x on ${o.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${o.medianSliceTokens} tok vs naive ${o.medianNaiveTokens} tok \u2014 ${s}, ${a}`,` uncapped structural slice = ${o.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)}`,` ${pl}`];G.stdout.write(`${c.join(` `)} -`),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}V.exit(0)}catch(e){L("fail","measure",e.message),V.exit(1)}}function G8e(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),V.exit(1)}V.exitCode=xA({...t,focusModules:e}).worst}function Z8e(t){let e=WY(".",t,{checkStages:xA,onIndex:Wa,gitOpInProgress:xO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function V8e(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=N5(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. -`),V.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";V.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} -`)}V.stdout.write(` +`),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}G.exit(0)}catch(e){L("fail","measure",e.message),G.exit(1)}}function f5e(t){let e;if(t.feature)try{let i=(q().features??[]).find(o=>o.id===t.feature||o.slug===t.feature);i||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),G.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),G.exit(1)}let r=kA({...t,focusModules:e});if(!t.json){let n=uX(".");n&&G.stdout.write(`\u2139 ${n} +`)}G.exitCode=r.worst}function p5e(t){let e=eX(".",t,{checkStages:kA,onIndex:Wa,gitOpInProgress:kO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),G.exit(e.code)}function m5e(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),G.exit(1);return}if(e.required){t&&G.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=U5(n);if(o.length===0){G.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),G.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";G.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} +`)}G.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),V.exit(s.length>0?1:0);return}if(!t){L("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),V.exit(1);return}let i=Cte(n,t,e.ac,r);if(!i||i.acs.length===0){L("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),V.exit(1);return}V.stdout.write(`${Dte(i)} -`),V.exit(0)}function W8e(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=Ade(Uf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] -`)}n.length>3&&V.stdout.write(` \u2026 and ${n.length-3} more finding(s) +`),G.exit(s.length>0?1:0);return}if(!t){L("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),G.exit(1);return}let i=Ute(n,t,e.ac,r);if(!i||i.acs.length===0){L("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),G.exit(1);return}G.stdout.write(`${qte(i)} +`),G.exit(0)}function h5e(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=Nde(_l(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";G.stdout.write(` ${o}${s} [${i.detector}] +`)}n.length>3&&G.stdout.write(` \u2026 and ${n.length-3} more finding(s) +`),t.hint&&G.stdout.write(` fix: run \`${t.hint}\` `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${Ade(e.trim(),160)} -`)}}function Ade(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function K8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(Yx(e,"."),null,2)} -`),V.exitCode=0;return}V.stdout.write(`${Nte(e,".",{internal:t.internal})} -`),V.exit(0)}function J8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function Y8e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=Yx(i,e),s={gitHead:va(e),version:Wl(),generatedAt:t.now??new Date().toISOString()},a=pl(i),c;try{let l=t.since??rs(e),u=ns(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:dl(u),auditMarkdown:fl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=bG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),V.exit(1);return}try{I8e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}L("pass","bundle",`${r} \xB7 ${J8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function X8e(t){let e=qA(t);L("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function Q8e(){let t=new y4;t.name("clad").description("Reference Ironclad CLI").version("0.9.0"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) 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.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(C8e),t.command("run [goal]").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(D8e),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(N8e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(F8e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(L8e),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(G8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(j8e),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(Z8e),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)=>V8e(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(M8e),t.command("status").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").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(K8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(U8e),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)=>q8e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>SX(r,{checkStages:xA})),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=>B8e(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 report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>H8e(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=>Qee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>ete()),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=>{tte(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)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>sG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the four-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>gY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>Y8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(X8e),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(fX),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(P8e),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").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){GY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}bY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); 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(jee),t}var e5e=!!globalThis.__CLADDING_BUNDLED,t5e=e5e||import.meta.url===`file://${V.argv[1]}`;t5e&&Q8e().parse();export{z8e as TIER_STAGES,Q8e as createProgram,Y8e as runBundleCommand,G8e as runCheckCommand,xA as runCheckStages,j8e as runCheckpointCommand,U8e as runContextCommand,Z8e as runDoneCommand,q8e as runImpactCommand,B8e as runInferDepsCommand,C8e as runInitCommand,H8e as runMeasureCommand,V8e as runOracleCommand,M8e as runRollbackCommand,X8e as runRouteCommand,D8e as runRunCommand,P8e as runServeCommand,F8e as runSetupCommand,K8e as runStatusCommand,N8e as runSyncCommand,L8e as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&G.stdout.write(` ${Nde(e.trim(),160)} +`)}}function Nde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function g5e(t){let e=q();if(t.json){G.stdout.write(`${JSON.stringify(Qx(e,"."),null,2)} +`),G.exitCode=0;return}G.stdout.write(`${Bte(e,".",{internal:t.internal})} +`),G.exit(0)}function y5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function _5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),G.exit(1);return}let n;try{let i=q(e),o=Qx(i,e),s={gitHead:va(e),version:Xl(),generatedAt:t.now??new Date().toISOString()},a=gl(i),c;try{let l=t.since??rs(e),u=ns(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:ml(u),auditMarkdown:hl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=kG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{X8e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${y5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function b5e(t){let e=HA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function v5e(){let t=new x4;t.name("clad").description("Reference Ironclad CLI").version("0.9.1"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) 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.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(e5e),t.command("run [goal]").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(t5e),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(r5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(o5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(s5e),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(f5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(n5e),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(p5e),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)=>m5e(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(i5e),t.command("status").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").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(g5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(c5e),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)=>l5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>FX(r,{checkStages:kA})),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=>u5e(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 report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>d5e(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=>cte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>lte()),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=>{ute(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)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>fG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the four-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>wY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>_5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(b5e),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(OX),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(Q8e),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").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){YY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}kY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); 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(Gee),t}var S5e=!!globalThis.__CLADDING_BUNDLED,w5e=S5e||import.meta.url===`file://${G.argv[1]}`;w5e&&v5e().parse();export{a5e as TIER_STAGES,v5e as createProgram,_5e as runBundleCommand,f5e as runCheckCommand,kA as runCheckStages,n5e as runCheckpointCommand,c5e as runContextCommand,p5e as runDoneCommand,l5e as runImpactCommand,u5e as runInferDepsCommand,e5e as runInitCommand,d5e as runMeasureCommand,m5e as runOracleCommand,i5e as runRollbackCommand,b5e as runRouteCommand,t5e as runRunCommand,Q8e as runServeCommand,o5e as runSetupCommand,g5e as runStatusCommand,r5e as runSyncCommand,s5e as runUpdateCommand}; diff --git a/plugins/codex/.codex-plugin/plugin.json b/plugins/codex/.codex-plugin/plugin.json index f2d4db2..8f3a1e0 100644 --- a/plugins/codex/.codex-plugin/plugin.json +++ b/plugins/codex/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.0", + "version": "0.9.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/codex/skills/init/SKILL.md b/plugins/codex/skills/init/SKILL.md index 1de064d..a7cb315 100644 --- a/plugins/codex/skills/init/SKILL.md +++ b/plugins/codex/skills/init/SKILL.md @@ -19,7 +19,7 @@ If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. 4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. 5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. -6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that onboarding is complete and that the next step is to author the first feature's spec — its acceptance criteria and the files it will cover — before writing any code; the feature cycle starts there, not with scaffolding. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/plugins/gemini-cli/commands/init.toml b/plugins/gemini-cli/commands/init.toml index 9548cf1..760cf3d 100644 --- a/plugins/gemini-cli/commands/init.toml +++ b/plugins/gemini-cli/commands/init.toml @@ -16,7 +16,7 @@ If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. 4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. 5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. -6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that onboarding is complete and that the next step is to author the first feature's spec — its acceptance criteria and the files it will cover — before writing any code; the feature cycle starts there, not with scaffolding. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/plugins/gemini-cli/gemini-extension.json b/plugins/gemini-cli/gemini-extension.json index bf5cf11..a20d7a3 100644 --- a/plugins/gemini-cli/gemini-extension.json +++ b/plugins/gemini-cli/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.0", + "version": "0.9.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/skills/init/SKILL.md b/skills/init/SKILL.md index 1de064d..a7cb315 100644 --- a/skills/init/SKILL.md +++ b/skills/init/SKILL.md @@ -19,7 +19,7 @@ If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. 4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. 5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. -6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that onboarding is complete and that the next step is to author the first feature's spec — its acceptance criteria and the files it will cover — before writing any code; the feature cycle starts there, not with scaffolding. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/spec.yaml b/spec.yaml index 89d69ec..c7444b7 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.9.0" + version: "0.9.1" repository: "https://github.com/qwerfunch/cladding" intent_summary: "Make AI-coupled development measurably safer and more honest — 41 drift detectors + 4-tier SSoT governance + A/B-measurable cladding-vs-vanilla evaluation." deliverable: @@ -54,7 +54,7 @@ project: # Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand. inventory: - features: 255 + features: 262 scenarios: 2 capabilities: 6 - test_files: 237 + test_files: 243 diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 533e67e..a36e8d8 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -17,15 +17,15 @@ attested_modules: .claude/settings.json: d0bba3583aef0960 .github/workflows/ci.yml: 8ea99219cb80df60 .gitignore: 1294975ba3b47043 - CHANGELOG.md: 1524903097b4f9b0 + CHANGELOG.md: c3353cc4baf17ec7 CLAUDE.md: 16212c1749e6005d GOVERNANCE.md: 21cc28eaaf637a20 - README.html: dd6c44fc6c151ad4 - README.ja.md: d4de131ac59941f8 - README.ko.html: a494606ab7bfce8e - README.ko.md: 45c1a27b3f25c983 - README.md: 5831410ed5c38337 - README.zh.md: a6aef09c240f2b62 + README.html: f9378f61e0073367 + README.ja.md: 1b94669e076dd9c9 + README.ko.html: 9209820dc1e7a57a + README.ko.md: 160a0845e8775bf6 + README.md: 81c9c6691e1ce51b + README.zh.md: 1572f023debba60d SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -38,10 +38,10 @@ attested_modules: docs/ab-evaluation/README.md: 2467808b9871dcf0 docs/ab-evaluation/case-doverunner-scale.md: 2a435b6855823d41 docs/ab-evaluation/case-efficiency-measurement.md: 348aca146a7b2faa - docs/ab-evaluation/case-existing-adoption.md: ec78b64f115d9c91 + docs/ab-evaluation/case-existing-adoption.md: 240a7c641da50a42 docs/ab-evaluation/case-graph-efficiency.md: 83d3956d14a1517d docs/ab-evaluation/case-iterative-vs-fixed-vapt.md: 1d242b8b6071f343 - docs/ab-evaluation/case-payment-saas.md: ca1a9a22b933c5cf + docs/ab-evaluation/case-payment-saas.md: a316271b319816f6 docs/ab-evaluation/case-working-set-landmine.md: b4f44dc463e99722 docs/ab-evaluation/summary.md: 59e527a531f13209 docs/b1-adoption-protocol.md: a041d8ad5ba1447f @@ -67,21 +67,21 @@ attested_modules: docs/spec-ids-multi-dev.md: 28d58e84879f58b1 docs/ssot-model.md: 66b9439e2f71ac4b docs/ssot-testing.md: abf3b2bd5acb29a1 - package-lock.json: 84fce6dd31da5308 - package.json: fb5fc393fb3f5e49 - plugins/claude-code/.claude-plugin/plugin.json: 3ece00e95ac4e232 + package-lock.json: dc094f923ab99ab8 + package.json: 5fc7fe2a9f18a959 + plugins/claude-code/.claude-plugin/plugin.json: 4daaab360fbbea9e plugins/claude-code/agents/developer.md: 40af2943253f6c72 plugins/claude-code/agents/observability.md: 5ea8f14b1c9b4a61 plugins/claude-code/agents/orchestrator.md: 443c6e13ade590cf plugins/claude-code/agents/planner.md: 5750002ebdfb43f1 plugins/claude-code/agents/reviewer.md: 9c4e095e60040473 - plugins/claude-code/commands/init.md: bf567f3b4e22069a + plugins/claude-code/commands/init.md: 5529b13d0f1ab4bf plugins/claude-code/hooks/hooks.json: 42321ead26fb1da8 - plugins/codex/.codex-plugin/plugin.json: 26d1bc595d1b996a + plugins/codex/.codex-plugin/plugin.json: 835ff6366182f1ea plugins/codex/.mcp.json: 43e3f4b2af24aa18 plugins/codex/skills/check/SKILL.md: 6a665422af510e72 plugins/codex/skills/developer/SKILL.md: 40af2943253f6c72 - plugins/codex/skills/init/SKILL.md: bf567f3b4e22069a + plugins/codex/skills/init/SKILL.md: 5529b13d0f1ab4bf plugins/codex/skills/observability/SKILL.md: 5ea8f14b1c9b4a61 plugins/codex/skills/orchestrator/SKILL.md: 443c6e13ade590cf plugins/codex/skills/planner/SKILL.md: 5750002ebdfb43f1 @@ -92,8 +92,8 @@ attested_modules: plugins/codex/skills/sync/SKILL.md: 775c0f990a52a3d9 plugins/gemini-cli/GEMINI.md: ba08eaf2cd557a65 plugins/gemini-cli/commands/README.md: 3527d771578431bd - plugins/gemini-cli/commands/init.toml: e44c7ead9bd927b2 - plugins/gemini-cli/gemini-extension.json: 9d2f839716b55869 + plugins/gemini-cli/commands/init.toml: e7f310fd7af23f95 + plugins/gemini-cli/gemini-extension.json: 85ff27830d2db32e scripts/build-plugin.mjs: 7fabe2b6301b142a scripts/build.mjs: 3a4b204063024ef1 scripts/migrate-dogfood-v0.3.16.mjs: 1e265fb370019996 @@ -105,7 +105,7 @@ attested_modules: skills/checkpoint/SKILL.md: f723e8cfb8286a64 skills/clarify/SKILL.md: 5d08bbb821258d03 skills/doctor/SKILL.md: 6581c6c900c72d68 - skills/init/SKILL.md: bf567f3b4e22069a + skills/init/SKILL.md: 5529b13d0f1ab4bf skills/oracle/SKILL.md: 11e111ac0a4963c1 skills/rollback/SKILL.md: d472dc3a562b347b skills/route/SKILL.md: 5958830fef280c67 @@ -113,7 +113,7 @@ attested_modules: skills/serve/SKILL.md: f08bbdbbfeb05041 skills/status/SKILL.md: 09faadc50b3449da skills/sync/SKILL.md: 775c0f990a52a3d9 - spec.yaml: 59840b10bd055d32 + spec.yaml: f3b85cd5c92644ce spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -146,16 +146,17 @@ attested_modules: src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f src/cli/changelog.ts: 2de1adb009b89ab4 - src/cli/clad.ts: 00d049c7acb5f761 - src/cli/clarify.ts: 393cc93a6feb698a + src/cli/clad.ts: e882d44ef304fce0 + src/cli/clarify.ts: f17177969d5b75ff src/cli/doctor-hosts.ts: 1f0c2cec5a310b81 src/cli/doctor.ts: b98b955fe75e7f7e - src/cli/done.ts: 02bd4397eaf34fa1 + src/cli/done.ts: 7eba807b6ec5a1aa + src/cli/enforcement-advisory.ts: 395c5be696e88b5c src/cli/graph-serve.ts: 23e6e389225d0f98 src/cli/graph.ts: bab410061b8c746a - src/cli/hook.ts: 201f82f4c89e173f + src/cli/hook.ts: 59d5fddd52d330ac src/cli/host-onboarding.ts: b046571d4be7280c - src/cli/init.ts: ccd14da690621d88 + src/cli/init.ts: 91cf7be2b7427fbf src/cli/intent-from-path.ts: e69862821d979f22 src/cli/measure.ts: 3a562f16589e26c2 src/cli/report.ts: 911f859b2446834b @@ -202,7 +203,7 @@ attested_modules: src/hitl/audit.ts: 79b06e904815469a src/hitl/identity.ts: 52ff84aa666f1dab src/init/agents-md.ts: 7dc05f6d82e5c3ce - src/init/git-hook.ts: 4e02f177b3764ae8 + src/init/git-hook.ts: b77910b0df392cbf src/init/host-instructions.ts: 7a066c646f0b6133 src/init/host-setup.ts: 158cc9306a746da1 src/optimizer: a4d0f0eb87fed960 @@ -227,7 +228,7 @@ attested_modules: src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: 4b2d0b94854d3fb5 + src/serve/server.ts: db452db2b4366605 src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: 294a1e99c42d4aef src/spec/cli.ts: 7a9bcd0f66677810 @@ -260,7 +261,7 @@ attested_modules: src/stages/detectors/architecture-from-spec.ts: ee36fa5f94a5be2a src/stages/detectors/architecture-violation.ts: b5035317a61e5ebe src/stages/detectors/capabilities-feature-mapping.ts: fa245f053f98a78a - src/stages/detectors/convention-drift.ts: 450cb86924dfcf82 + src/stages/detectors/convention-drift.ts: 571500224c124e53 src/stages/detectors/coverage-drop.ts: 809d13599596793e src/stages/detectors/deliverable-integrity.ts: d0fbc1dd05bd245a src/stages/detectors/dependency-cycle.ts: 873c8fdde00aa48b @@ -299,16 +300,16 @@ attested_modules: src/stages/detectors/with-spec.ts: dcf3205e8d563574 src/stages/disposition.ts: b7fd2e591235a326 src/stages/drift.ts: d3993f3b168ceb34 - src/stages/finding-parser.ts: 19a10c5fe216059c + src/stages/finding-parser.ts: d9cd56dbe3c3b9a7 src/stages/graph-health.ts: a294f06796b0e293 src/stages/junit-report.ts: f8466dc1e00140f1 - src/stages/lint.ts: c1513a7c710fb13b + src/stages/lint.ts: e9c4505e587e6088 src/stages/perf.ts: 2b27c12427f65b2e src/stages/secret.ts: b90abc0e00c86219 src/stages/skip-policy.ts: 1a6412d708561cf0 src/stages/smoke.ts: cbe55596f6b0a49e src/stages/spec-conformance.ts: 1e9b052a2a268d7a - src/stages/test-run-cache.ts: 46df49ab73a1a72e + src/stages/test-run-cache.ts: 462a5ef1d30eb766 src/stages/toolchain/coverage-tool.ts: 310883060ed6d92e src/stages/toolchain/detect.ts: 36d4947e5567bd5f src/stages/toolchain/gate-config.ts: 818a0a549d875581 @@ -317,16 +318,16 @@ attested_modules: src/stages/toolchain/scoped-command.ts: f2dd6410c063279f src/stages/toolchain/types.ts: 05f018fb3dddc321 src/stages/type.ts: 0ac37e45b407446d - src/stages/types.ts: 24b4dc30ec7d7f33 + src/stages/types.ts: 95e8c9e13187d85b src/stages/uat.ts: 62ec3e37a124f8c5 - src/stages/unit.ts: fe5bf9e4bec1de77 + src/stages/unit.ts: b503350b0e5c7e5a src/stages/util.ts: a024afe34884d653 src/stages/vacuous-tests.ts: 8e71b81e151325af src/stages/visual.ts: 2b60dd991fa8124e src/ui: a4d0f0eb87fed960 src/ui/panel.ts: 8b78cb14dafb28fb src/ui/pulse.ts: ee4255f5c6e49f51 - src/ui/softShell.ts: 6db9d46de2d2e1b0 + src/ui/softShell.ts: 57a9b5d02fc94339 src/verdict/gate-progress.ts: ac75e3082cc97a40 src/verdict/verdict.ts: 493251b3a2c494d3 tests/adapters/anthropic.test.ts: fa2fc7faf032a782 @@ -334,7 +335,7 @@ attested_modules: tests/adapters/transport.test.ts: 68f22e9e8df7b813 tests/agents/loader.test.ts: a7df7b1c9a95d37d tests/cli/benchmark.test.ts: b4a87289605ee75f - tests/cli/clad.test.ts: 19a2f5950d84da42 + tests/cli/clad.test.ts: 7c61f7d2e759f792 tests/cli/gate-golden-matrix.test.ts: 39cf615407a55abe tests/cli/init.test.ts: 3428a89708fc9330 tests/cli/intent-onboarding.test.ts: 0681b98ce2e74c22 @@ -391,7 +392,7 @@ attested_modules: tests/stages/architecture-violation.test.ts: f713ac001d4a797f tests/stages/audit.test.ts: 8785d8fb21008d49 tests/stages/commit.test.ts: e387291e76ffc5d2 - tests/stages/convention-drift.test.ts: f16176d8c9e97753 + tests/stages/convention-drift.test.ts: f5638d887e5533f3 tests/stages/cov.test.ts: c50dda16447f94ab tests/stages/coverage-drop.test.ts: 272d118239cda6be tests/stages/detector-purity.test.ts: cc8d4a60e6956198 @@ -529,6 +530,7 @@ attested_features: F-16746b: ok F-17df0a: ok F-18e951: ok + F-195cb59e: ok F-1c9166: ok F-1d23a6: ok F-1e7a10c3: ok @@ -556,6 +558,7 @@ attested_features: F-417ff0: ok F-42af48: ok F-43d8e3: ok + F-4643d99d: ok F-4747ef: ok F-47b8bee5: ok F-49f6f2d2: ok @@ -586,6 +589,7 @@ attested_features: F-6ed216f3: ok F-6f80e7: ok F-7076f7: ok + F-70ed1afd: ok F-723c81dd: ok F-7794a6bc: ok F-77a90ac6: ok @@ -639,6 +643,7 @@ attested_features: F-bc8ad013: ok F-bd07d7: ok F-bdcd90: ok + F-be5306eb: ok F-c037ae: ok F-c2c996: ok F-c3747d7d: ok @@ -670,6 +675,7 @@ attested_features: F-e8912be3: ok F-e940fffe: ok F-eb732f: ok + F-ebbb20af: ok F-ede6fa75: ok F-ee47fc2b: ok F-ee5f643e: ok @@ -677,8 +683,10 @@ attested_features: F-f334fa: ok F-f44d1b: ok F-f46d5c61: ok + F-f4e184f7: ok F-f6cc5e5a: ok F-f6d13e: ok + F-f9891175: ok F-fb9b48a5: ok F-fcece7: ok F-fe0f7a96: ok diff --git a/spec/features/adoption-honors-host-capabilities-70ed1afd.yaml b/spec/features/adoption-honors-host-capabilities-70ed1afd.yaml new file mode 100644 index 0000000..d7a98d1 --- /dev/null +++ b/spec/features/adoption-honors-host-capabilities-70ed1afd.yaml @@ -0,0 +1,34 @@ +id: F-70ed1afd +slug: adoption-honors-host-capabilities +title: "Existing-project adoption honors the host draft's approved capabilities" +status: done +modules: + - src/cli/init.ts +acceptance_criteria: + - id: AC-d20df076 + ears: event + condition: "when an existing project is adopted through the onboarding flow and the host/LLM draft dispatch fires fully (onboarding source is 'llm')" + action: "select onboarding.capabilitiesYaml over interp.capabilitiesYaml in the scan branch" + response: "spec/capabilities.yaml carries the draft's id/title/summary/surface entries" + text: "The system shall write the draft's approved capabilities to spec/capabilities.yaml instead of the scanner's README-derived capabilities." + test_refs: ["tests/serve/init-tools.test.ts"] + - id: AC-039f62b6 + ears: unwanted + condition: "if the adopted repository has no README ## headings" + response: "spec/capabilities.yaml is the draft's capabilities, never 'capabilities: []' when a fired draft provided them" + text: "The system shall not write an empty capabilities list when a fired draft supplied capabilities, and shall persist the draft's capabilities instead." + test_refs: ["tests/serve/init-tools.test.ts"] + - id: AC-6421da1f + ears: state + condition: "while the onboarding dispatch did not fire (source is 'deterministic') or no intent was provided so there is no onboarding pass" + text: "The system shall fall back to the scanner-derived capabilities, preserving prior behavior for --no-llm and no-intent scans." + test_refs: ["tests/cli/init.test.ts"] + - id: AC-aa2d0e2c + ears: ubiquitous + text: "The system shall keep docs/conventions.md and spec/architecture.yaml sourced from the scanner (code-grounded), unaffected by the capability-source preference." + test_refs: ["tests/scenarios/existing-adoption-lifecycle.test.ts"] +design_impact: + classification: none + rationale: "Behavioral fix to how the init scan-branch sources spec/capabilities.yaml; it does not alter cladding's own capabilities, architecture, or project-context artifacts." + status: resolved + artifacts: [] diff --git a/spec/features/cold-start-cycle-signal-be5306eb.yaml b/spec/features/cold-start-cycle-signal-be5306eb.yaml new file mode 100644 index 0000000..fd0c196 --- /dev/null +++ b/spec/features/cold-start-cycle-signal-be5306eb.yaml @@ -0,0 +1,41 @@ +id: F-be5306eb +slug: cold-start-cycle-signal +title: "signal when a project has code but no feature specs — the cycle hasn't started" +status: done +modules: + - src/cli/enforcement-advisory.ts + - src/cli/hook.ts + - src/cli/clad.ts +acceptance_criteria: + - id: AC-a0e5840a + test_refs: + - tests/cli/enforcement-advisory.test.ts + ears: event + condition: "when a project has source code on disk but zero feature specs" + response: "return a non-blocking advisory that the feature cycle has not started, pointing to authoring the first feature's spec" + text: "When a project has source code on disk but zero feature specs, the system shall return a non-blocking advisory that the feature cycle has not started and that the next step is to author the first feature's spec so the code is governed rather than running ahead of the spec." + notes: "The ungoverned-code resting state: onboarding done, features: [], code scaffolded. Neither the unbound-edit nudge (reactive, source-edit-triggered) nor the enforcement advisory (needs undone>0) caught it. Source presence is detected with the scan walker (vendor dirs ignored, early exit)." + - id: AC-4e780c47 + test_refs: + - tests/cli/enforcement-advisory.test.ts + ears: unwanted + condition: "if the project has no source code yet, or already has one or more feature specs" + response: "return no cold-start advisory" + text: "If the project has no source code yet (fresh onboarding), or already has at least one feature spec, the system shall return no cold-start advisory, so a clean greenfield is never nagged and an active project is not mislabeled as un-started." + notes: "features.length === 0 AND source exists is the precise trigger; either suppressor silences it." + - id: AC-babf927c + test_refs: + - tests/cli/cold-start-signal.test.ts + ears: state + condition: "while a session starts in a project that has code but no feature specs" + response: "surface the cold-start signal in the SessionStart card" + text: "While a session starts in a project that has source code but no feature specs, the SessionStart card shall surface the cold-start signal, so the resting state is caught every session regardless of how it was reached." + notes: "SessionStart is the always-on net: it does not depend on catching the edit stream and survives across sessions." + - id: AC-7cf9593d + test_refs: + - tests/cli/enforcement-advisory.test.ts + ears: state + condition: "while clad check evaluates feature-cycle health" + response: "return the cold-start advisory when un-started, else the enforcement advisory, from one graduated evaluator, informational only" + text: "While clad check evaluates feature-cycle health, a single graduated evaluator shall return the cold-start advisory when the cycle is un-started, otherwise the enforcement advisory, and it shall be informational only — never changing the exit status." + notes: "featureCycleAdvisory = coldStartAdvisory ?? enforcementAdvisory. The existing F-f4e184f7 enforcementAdvisory stays unchanged; clad check calls the graduated wrapper." diff --git a/spec/features/enforcement-advisory-f4e184f7.yaml b/spec/features/enforcement-advisory-f4e184f7.yaml new file mode 100644 index 0000000..fbf2b89 --- /dev/null +++ b/spec/features/enforcement-advisory-f4e184f7.yaml @@ -0,0 +1,31 @@ +id: F-f4e184f7 +slug: enforcement-advisory +title: "clad check advisory when the feature cycle has no hook or CI enforcement" +status: done +modules: + - src/cli/enforcement-advisory.ts + - src/init/git-hook.ts + - src/cli/clad.ts +acceptance_criteria: + - id: AC-4566fd98 + test_refs: + - tests/cli/enforcement-advisory.test.ts + ears: event + condition: "when clad check runs in a project that has features not yet done and neither a cladding pre-commit/pre-push hook nor a .github/workflows directory is present" + response: "return one non-blocking advisory that the checks are unenforced" + text: "When clad check runs in a project that has features not yet done and no cladding git hook and no CI workflow is wired, the system shall surface one non-blocking advisory naming how many features are undone and how to wire enforcement." + notes: "The gap: a project can run for months with authored-but-undone features while every commit stays green because pre-commit is not --strict and no hook/CI is installed. Reuses the existsSync('.github/workflows') idiom from clad update; the hook reader matches the `cladding hook` marker." + - id: AC-2fd01eaa + test_refs: + - tests/cli/enforcement-advisory.test.ts + ears: unwanted + condition: "if an enforcing cladding hook is installed, or a CI workflow directory exists, or no feature is undone" + response: "return no advisory" + text: "If an enforcing cladding hook is installed, or a CI workflow directory exists, or no feature is not-yet-done, the system shall return no advisory, so a project that already wired enforcement is never nagged." + notes: "Any ONE of the three suppressors is enough. A missing/invalid spec also yields no advisory — it is not this check's place to speak." + - id: AC-be0cbdaa + test_refs: + - tests/cli/enforcement-advisory.test.ts + ears: ubiquitous + text: "The advisory shall be informational only: it is derived without the gate outcome and shall not change clad check's exit status." + notes: "enforcementAdvisory takes only cwd (never a stage result), so it cannot depend on or alter pass/fail; runCheckCommand prints it but still sets process.exitCode from the gate's worst status." diff --git a/spec/features/lint-multi-finding-4643d99d.yaml b/spec/features/lint-multi-finding-4643d99d.yaml new file mode 100644 index 0000000..6a7a8bd --- /dev/null +++ b/spec/features/lint-multi-finding-4643d99d.yaml @@ -0,0 +1,33 @@ +id: F-4643d99d +slug: lint-multi-finding +title: "check-only formatter lint findings — list every dirty file, with a fix hint" +status: done +modules: + - src/stages/finding-parser.ts + - src/stages/lint.ts + - src/cli/clad.ts +acceptance_criteria: + - id: AC-7b620bf4 + test_refs: + - tests/stages/lint-multi-finding.test.ts + ears: event + condition: "when a check-only formatter fails and its output lists changed files (e.g. `dart format`'s `Changed ` lines)" + response: "produce one structured LINT finding per listed file, each carrying that file's path" + text: "When a check-only formatter fails and its output lists changed files, the lint parser shall produce one structured LINT finding per listed file, each carrying the file path, so every dirty file surfaces at once instead of only the first line." + notes: "The bug: dart format prints `Changed ` per dirty file plus a summary; none match the ESLint stylish regex, so parseToolFindings collapsed 11 files to one pathless synthetic finding (whack-a-mole). The renderer already lists up to 3 + '… and N more' and shows `— ` when a finding has a path." + - id: AC-6c16b63e + test_refs: + - tests/stages/lint-multi-finding.test.ts + ears: state + condition: "while a check-only formatter (dart/dotnet format) fails the lint stage" + response: "attach a one-line remediation hint naming the fix command" + text: "While a recognised check-only formatter fails the lint stage, the stage result shall carry a one-line remediation hint naming the command that fixes the formatting (e.g. `dart format .`), which the check renderer prints under the findings." + notes: "No stage prints a fix hint today; the house style is a backticked command in a short imperative. Derived from the resolved lint command, not hard-coded per project." + - id: AC-83a47b38 + test_refs: + - tests/stages/lint-multi-finding.test.ts + ears: unwanted + condition: "if a failing formatter's output matches no known per-file pattern" + response: "keep the existing single raw-tail synthetic finding" + text: "If a failing formatter's output matches no known per-file pattern, the system shall keep the existing single raw-tail synthetic finding, so an unstructured failure still reads as a problem rather than as silence." + notes: "Preserves F-b7873005 AC-20b69848: 'no structure' never becomes 'no problem'. The per-file parser runs only after the ESLint parser and before the synthetic fallback." diff --git a/spec/features/onboarding-handoff-steer-195cb59e.yaml b/spec/features/onboarding-handoff-steer-195cb59e.yaml new file mode 100644 index 0000000..03320e2 --- /dev/null +++ b/spec/features/onboarding-handoff-steer-195cb59e.yaml @@ -0,0 +1,32 @@ +id: F-195cb59e +slug: onboarding-handoff-steer +title: "onboarding hands off to authoring the first feature spec, not straight to code" +status: done +modules: + - skills/init/SKILL.md + - src/cli/clarify.ts +acceptance_criteria: + - id: AC-f75cc3de + test_refs: + - tests/cli/onboarding-handoff-steer.test.ts + ears: state + condition: "while reporting that onboarding has no questions remaining" + response: "instruct the host that the next step is to author the first feature's spec before writing code, not that ordinary development can begin" + text: "While reporting onboarding completion, the init host instruction shall state that the next step is to author the first feature's spec before writing code — it shall not tell the host that ordinary development can simply begin." + notes: "Root cause of the ungoverned-code case: skills/init/SKILL.md said 'report that ordinary development can begin', so the host read it as 'write code now' and scaffolded a whole project with features: []. The handoff is where the feature cycle must be pointed at." + - id: AC-3b2026e1 + test_refs: + - tests/cli/clarify.test.ts + ears: state + condition: "while the CLI reports onboarding complete" + response: "tell the user to author the first feature's spec before writing code" + text: "While the CLI reports onboarding complete, its message shall tell the user that the next step is to author the first feature's spec before writing code, so the spec-first cycle is triggered at the handoff." + notes: "src/cli/clarify.ts final message previously ended at 'onboarding complete' with no next-step steer." + - id: AC-d21ead41 + test_refs: + - tests/cli/onboarding-handoff-steer.test.ts + ears: state + condition: "while steering to the first feature spec" + response: "name what the spec contains — its acceptance criteria and the files it will cover" + text: "While steering to the first feature spec, the message shall name what that spec contains — its acceptance criteria (the testable promises) and the files it will cover — so 'author a spec' is never vague about what to write." + notes: "Closes the audit gap that no user-facing string bundled 'what it must do (acceptance criteria) + which files it covers'. Plain language: no 'shard', no MCP tool name." diff --git a/spec/features/soft-shell-leak-closure-ebbb20af.yaml b/spec/features/soft-shell-leak-closure-ebbb20af.yaml new file mode 100644 index 0000000..c7651a3 --- /dev/null +++ b/spec/features/soft-shell-leak-closure-ebbb20af.yaml @@ -0,0 +1,50 @@ +id: F-ebbb20af +slug: soft-shell-leak-closure +title: "close Soft Shell jargon leaks and tighten the plain-language enforcement" +status: done +modules: + - src/ui/softShell.ts + - src/cli/clad.ts + - src/cli/done.ts + - src/cli/hook.ts + - src/cli/init.ts +acceptance_criteria: + - id: AC-77f0ec75 + test_refs: + - tests/soft-shell-leak-closure.test.ts + ears: state + condition: "while rendering user-facing output (the drift plain table, clad check/done messages)" + response: "use plain domain words (spec, spec entry, feature) and never the internal word 'shard'" + text: "While rendering user-facing output, the system shall never use the internal word 'shard' — it shall say spec, spec entry, or feature — so a reader who never saw the source is never shown a term only maintainers know." + notes: "Leaks the audit found: INVENTORY_DRIFT.lead (softShell.ts), the clad check footer (clad.ts), and the clad done git-op / no-feature refusals (done.ts). Iron Core surfaces (code comments, field names, persona prompts) keep 'shard' by design." + - id: AC-78c153fa + test_refs: + - tests/soft-shell-leak-closure.test.ts + ears: unwanted + condition: "if a user-facing card would surface a raw detector name or a raw stage id as its lead" + response: "render the plain-English lead instead, with any machine id demoted to a trailing tail" + text: "If a user-facing card would surface a raw detector name or a raw stage id as its lead, the system shall render the plain-English lead instead — the machine id may appear only as a demoted tail." + notes: "The SessionStart stop-block line led with failures[0].detector (a raw detector name); the clad sync deliverable note leaked a raw stage id (stage_2.4). Reuse plainLead (already imported in hook.ts)." + - id: AC-c7c1c6e1 + test_refs: + - tests/soft-shell-leak-closure.test.ts + ears: state + condition: "while writing the scenarios README (spec/scenarios/README.md) prose the user reads" + response: "name no MCP tool and no 'shard'" + text: "While generating the scenarios README prose, the system shall name no MCP tool (no clad_-shaped identifier) and shall not use the word 'shard', describing what happens in plain language instead." + notes: "init.ts wrote `clad_create_feature` into the scenarios README prose. The spec.yaml first line is a structured, documented, tier-tagged provenance banner (Tier A · Refreshed by: ), verified by verb-residue + tier-banner tests — that is Iron Core metadata, out of scope here, and keeps its verb clause." + - id: AC-0cece94c + test_refs: + - tests/plain-render.test.ts + - tests/human-first-cards.test.ts + ears: unwanted + condition: "if a future edit reintroduces 'shard' into a plain-table lead or a raw detector-name lead into a card" + response: "the plain-language enforcement tests shall fail" + text: "If a future edit reintroduces the word 'shard' into a DETECTOR_PLAIN lead, or a raw detector-name lead into a driven card, the tightened enforcement tests shall fail, so these leaks cannot recur." + notes: "plain-render.test.ts scanned only `action` for MCP names; extend it to scan each `lead` for 'shard'. human-first-cards.test.ts banned MCP names + 'shard' per line; extend the stop-block case so a raw detector-name lead fails." + - id: AC-408e6838 + test_refs: + - tests/soft-shell-leak-closure.test.ts + ears: ubiquitous + text: "The behavior-triggered signals (the unbound-edit nudge and the enforcement advisory) shall fire from the same single English source regardless of the user's language — an all-non-ASCII spec (titles, paths) still triggers them — so the host can relay one message into any language." + notes: "cladding emits one English string; the host AI relays it into the user's language (instruction-led-language: English-only catalog, no locale keys). Firing is behavior-driven (edits, spec status), so it is language-agnostic by construction; this AC pins that." diff --git a/spec/features/test-run-dedup-49f6f2d2.yaml b/spec/features/test-run-dedup-49f6f2d2.yaml index 8126a19..7092638 100644 --- a/spec/features/test-run-dedup-49f6f2d2.yaml +++ b/spec/features/test-run-dedup-49f6f2d2.yaml @@ -4,6 +4,7 @@ title: "gate-scoped test-run dedup — run the suite once, without disabling the status: done modules: - src/stages/test-run-cache.ts + - src/stages/unit.ts acceptance_criteria: - id: AC-9a1c4e21 test_refs: @@ -41,3 +42,18 @@ acceptance_criteria: ears: ubiquitous text: "When no gate run is primed (a standalone stage call or the MCP read path), the shared-run cache shall be a pass-through, leaving unit and coverage behavior byte-for-byte unchanged." notes: "Same pass-through discipline as detector-result-cache: a fresh map per gate run, cleared in finally, so the long-lived MCP server never serves a stale test result across requests." + - id: AC-d769e24f + test_refs: + - tests/stages/test-run-dedup.test.ts + ears: state + condition: "while a gate is primed and the coverage runner is pytest" + text: "While a gate run is primed and the coverage runner is pytest, the system shall execute the suite exactly once by having the unit stage run the coverage-instrumented `coverage run -m pytest` and publishing it so the coverage stage folds the same process." + notes: "The Python analogue of #215's vitest dedup: coverage.py's exit code IS pytest's, so one instrumented run yields both the unit pass/fail and the coverage data. cov.ts's peekSharedRun fold is already language-agnostic; the producer gate lives in unit.ts (tryReuseSharedPytestRun)." + - id: AC-f8e85a99 + test_refs: + - tests/stages/test-run-dedup.test.ts + ears: unwanted + condition: "if the unit stage reuses the shared pytest run under --strict" + response: "still evaluate the zero-executed-tests guard against the shared run output before returning a passing unit result" + text: "If the unit stage reuses the shared pytest run under --strict, the system shall evaluate the zero-executed-tests guard against the shared run's own summary and shall never return a passing unit result for a run that collected zero tests." + notes: "Mirrors AC-6b2d81f7 for pytest: the reuse-pass path is not a guard bypass. reportsZeroExecutedTests recognizes pytest's `collected 0 items`, so a coverage-instrumented pytest run that exits 0 yet collected nothing blocks instead of reading as verified." diff --git a/spec/features/unbound-edit-nudge-f9891175.yaml b/spec/features/unbound-edit-nudge-f9891175.yaml new file mode 100644 index 0000000..f2fe6db --- /dev/null +++ b/spec/features/unbound-edit-nudge-f9891175.yaml @@ -0,0 +1,37 @@ +id: F-f9891175 +slug: unbound-edit-nudge +title: "PostToolUse nudge when sustained source edits are bound to no feature" +status: done +modules: + - src/cli/hook.ts +acceptance_criteria: + - id: AC-8542cc63 + test_refs: + - tests/cli/hook-unbound-nudge.test.ts + ears: event + condition: "when watched source edits that resolve to no owning feature reach the nudge threshold within one window" + response: "include exactly one non-blocking nudge line in the PostToolUse card" + text: "When watched source edits that resolve to no owning feature reach the nudge threshold within one window, the PostToolUse card shall include exactly one non-blocking nudge line naming how many recent source edits are unbound and how to start a feature." + notes: "The feature cycle is never TRIGGERED for a stream of edits that touch no feature's modules — cladding stays silent (impact_card_skipped{owner_miss}). This nudge closes that gap without blocking, reusing the owner_miss site in emitCardForPath." + - id: AC-388518f4 + test_refs: + - tests/cli/hook-unbound-nudge.test.ts + ears: unwanted + condition: "if the event is a Read, a non-source path, still below the threshold, or an edit to a file already bound to a feature's modules" + response: "emit no nudge" + text: "If a PostToolUse event is a Read, a non-source path, still below the threshold, or an edit to a file already bound to a feature's modules, the system shall emit no nudge." + notes: "Bound files resolve to an owner (a real card fires) and never reach the owner_miss counter, so binding a file suppresses the nudge for that file with no extra logic." + - id: AC-5d379d4e + test_refs: + - tests/cli/hook-unbound-nudge.test.ts + ears: state + condition: "while a nudge has already fired within the current window" + response: "suppress further nudges until the window rolls over" + text: "While a nudge has already fired within the current window, the system shall suppress further nudges until the window rolls over, so unbound editing cannot spam the card." + notes: "Mirrors the SkipAgg once-per-window discipline: a dedicated .cladding/hook-unbound-agg.json sidecar keyed to a rolling window, flushed/reset the same way." + - id: AC-228fdc15 + test_refs: + - tests/cli/hook-unbound-nudge.test.ts + ears: ubiquitous + text: "The nudge shall never block the tool call, and a sidecar or telemetry failure shall leave the hook's stdout byte-identical to the output produced without the nudge feature." + notes: "Preserves F-6ba22c5c AC-e9d041de (observer-only, byte-identical on failure) and the PostToolUse never-block invariant: the nudge is advisory text appended to the card, wrapped so any sidecar throw returns ''." diff --git a/spec/index.yaml b/spec/index.yaml index 1daf12c..a9a1b7f 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -102,6 +102,7 @@ features: 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} + F-195cb59e: {slug: onboarding-handoff-steer, status: done, modules: 2} F-1c9166: {slug: readme-capability-sync, status: done, modules: 2} F-1d23a6: {slug: host-hooks, status: done, modules: 5} F-1e7a10c3: {slug: adoption-report-surface, status: done, modules: 2} @@ -129,9 +130,10 @@ features: F-417ff0: {slug: scan-llm-dispatcher-chain, status: done, modules: 5} F-42af48: {slug: architecture-from-spec, status: done, modules: 2} F-43d8e3: {slug: smoke-probe-token-pass, status: done, modules: 3} + F-4643d99d: {slug: lint-multi-finding, status: done, modules: 3} F-4747ef: {slug: ssot-lifecycle-tests, status: done, modules: 9} F-47b8bee5: {slug: ts-toolchain-jest-and-multiext-arch, status: done, modules: 1} - F-49f6f2d2: {slug: test-run-dedup, status: done, modules: 1} + F-49f6f2d2: {slug: test-run-dedup, status: done, modules: 2} F-49facde9: {slug: loop-engineering-readme, status: done, modules: 4} F-4db939: {slug: ab-evaluation, status: done, modules: 9} F-4ef09f38: {slug: multi-probe-smoke, status: done, modules: 3} @@ -159,6 +161,7 @@ features: F-6ed216f3: {slug: interactive-drift-profile, status: done, modules: 5} F-6f80e7: {slug: claude-code-dogfood, status: done, modules: 1} F-7076f7: {slug: smoke-probe-demand, status: done, modules: 3} + F-70ed1afd: {slug: adoption-honors-host-capabilities, status: done, modules: 1} F-723c81dd: {slug: agent-interpreter-rule, status: done, modules: 7} F-7794a6bc: {slug: impact-blast-radius, status: done, modules: 3} F-77a90ac6: {slug: scan-layer-glob-source-root, status: done, modules: 1} @@ -214,6 +217,7 @@ features: F-bc8ad013: {slug: mcp-description-diet, status: done, modules: 2} F-bd07d7: {slug: greenfield-seeds, status: done, modules: 5} F-bdcd90: {slug: oracle-policy-risk-weighted, status: done, modules: 8} + F-be5306eb: {slug: cold-start-cycle-signal, status: done, modules: 3} F-c037ae: {slug: test-refs-repair, status: done, modules: 4} F-c2c996: {slug: checkpoint-events, status: done, modules: 3} F-c3747d7d: {slug: spec-first-window-complete, status: done, modules: 5} @@ -245,6 +249,7 @@ features: F-e8912be3: {slug: status-aware-missing-impl, status: done, modules: 3} F-e940fffe: {slug: audit-bundle-html, status: done, modules: 3} F-eb732f: {slug: spec-authoring-anti-hollow, status: done, modules: 2} + F-ebbb20af: {slug: soft-shell-leak-closure, status: done, modules: 5} F-ede6fa75: {slug: self-measuring-release, status: done, modules: 3} F-ee47fc2b: {slug: reverse-index-core, status: done, modules: 1} F-ee5f643e: {slug: doc-graph-links, status: done, modules: 5} @@ -252,8 +257,10 @@ features: F-f334fa: {slug: ab-ext-scenarios-emit, status: done, modules: 3} F-f44d1b: {slug: hollow-governance-detector, status: done, modules: 2} F-f46d5c61: {slug: human-first-cards, status: done, modules: 3} + F-f4e184f7: {slug: enforcement-advisory, status: done, modules: 3} F-f6cc5e5a: {slug: pr-review-packet, status: done, modules: 4} F-f6d13e: {slug: capabilities-in-spec, status: done, modules: 3} + F-f9891175: {slug: unbound-edit-nudge, status: done, modules: 1} F-fb9b48a5: {slug: session-start-guidance, status: done, modules: 1} F-fcece7: {slug: external-docs-update-v0-3-13, status: done, modules: 3} F-fe0f7a96: {slug: removed-verb-guidance, status: done, modules: 2} diff --git a/src/cli/clad.ts b/src/cli/clad.ts index 6cffdd9..5eeac08 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -20,6 +20,7 @@ import {runReportCommand} from './report.js'; import {runDoctorCommand} from './doctor.js'; import {runDoctorHosts} from './doctor-hosts.js'; import {runDone} from './done.js'; +import {featureCycleAdvisory} from './enforcement-advisory.js'; import {runHookCommand} from './hook.js'; import {runVerdictCommand} from './verdict.js'; import {runUpdate} from './update.js'; @@ -300,7 +301,7 @@ export function runSyncCommand(opts: {proposeArchive?: boolean} = {}): void { pulse( 'note', 'deliverable', - `auto-detected entry '${autoDeliverable.path}' — the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`, + `auto-detected entry '${autoDeliverable.path}' — the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`, ); } } @@ -674,7 +675,7 @@ export function runCheckStages(opts: {internal?: boolean; strict?: boolean; tier // agent fixes in one pass instead of re-running to discover where + what. process.stdout.write(`${JSON.stringify({tier, worst, anyFailed, stages: collected}, null, 2)}\n`); } else if (anyFailed && !silent) { - process.stdout.write('\nℹ Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n'); + process.stdout.write('\nℹ Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n'); } // F-b84c38 — verification freshness needs a data source: every tier run // lands in the ledger (best-effort, deduped per identical HEAD/tier/strict/ @@ -822,12 +823,20 @@ export function runCheckCommand(opts: {internal?: boolean; strict?: boolean; tie process.exit(1); } } + const result = runCheckStages({...opts, focusModules}); + // F-f4e184f7 + F-be5306eb: a non-blocking advisory when the feature cycle isn't + // being driven — code with no feature specs (cold-start), or undone features with + // no hook/CI. Suppressed under --json. + if (!opts.json) { + const advisory = featureCycleAdvisory('.'); + if (advisory) process.stdout.write(`ℹ ${advisory}\n`); + } // Set process.exitCode rather than process.exit(): the machine-output mode // (--json) can write >64KB to stdout, and process.exit() terminates before a // buffered stdout PIPE flushes — truncating the document for any consumer // that pipes (vs. redirects to a file). Letting the event loop drain // guarantees the full payload is emitted, then Node exits with this code. - process.exitCode = runCheckStages({...opts, focusModules}).worst; + process.exitCode = result.worst; } /** @@ -902,6 +911,7 @@ export function runOracleCommand(featureId: string | undefined, opts: {ac?: stri function printStageDetails( r: { stderr?: string; + hint?: string; findings?: readonly {detector: string; severity: string; message: string; path?: string}[]; }, ): void { @@ -920,6 +930,8 @@ function printStageDetails( if (surface.length > 3) { process.stdout.write(` … and ${surface.length - 3} more finding(s)\n`); } + // F-4643d99d: a one-line remediation hint under a failing tool stage. + if (r.hint) process.stdout.write(` fix: run \`${r.hint}\`\n`); return; } if (r.stderr && r.stderr.trim().length > 0) { @@ -1038,7 +1050,7 @@ export function runRouteCommand(prompt: string): void { */ export function createProgram(): Command { const program = new Command(); - program.name('clad').description('Reference Ironclad CLI').version('0.9.0'); + program.name('clad').description('Reference Ironclad CLI').version('0.9.1'); program .command('init [intent...]') diff --git a/src/cli/clarify.ts b/src/cli/clarify.ts index 71e522c..b541d2e 100644 --- a/src/cli/clarify.ts +++ b/src/cli/clarify.ts @@ -351,7 +351,10 @@ export async function runClarifyCommand( process.stdout.write(`\n${outcome.report!.remainingQuestions} question(s) left · continue with \`clad clarify \`.\n\n`); } } else if (outcome.report?.status === 'done') { - process.stdout.write('\n✓ All questions answered — onboarding complete. state.yaml status: done.\n\n'); + process.stdout.write( + '\n✓ All questions answered — onboarding complete.\n' + + " Next: author your first feature's spec — its acceptance criteria (the testable promises) and the files it will cover — before writing code. The feature cycle starts there.\n\n", + ); } else if ((outcome.report?.remainingQuestions ?? 0) > 0) { process.stdout.write(`\n${outcome.report!.remainingQuestions} question(s) left. continue with \`clad clarify \`.\n\n`); } diff --git a/src/cli/done.ts b/src/cli/done.ts index 9ea18a6..ce7e227 100644 --- a/src/cli/done.ts +++ b/src/cli/done.ts @@ -135,7 +135,7 @@ export function runDone(cwd: string, featureId: string, deps: DoneDeps): DoneRes featureId, reason: `${op} in progress — refusing done until the tree settles.` + - ` Complete or abort the ${op}, then re-run \`clad done\`. No shard, attestation, or index was written.`, + ` Complete or abort the ${op}, then re-run \`clad done\`. Nothing in the spec or its records was changed.`, }; } const hit = findShardFile(cwd, featureId); @@ -145,7 +145,7 @@ export function runDone(cwd: string, featureId: string, deps: DoneDeps): DoneRes code: 1, featureId, reason: - `no feature shard under spec/features/ declares id '${featureId}'` + + `no feature in the spec declares id '${featureId}'` + ' (inline features: edit spec.yaml then run `clad check --tier=pre-push --strict` manually)', }; } diff --git a/src/cli/enforcement-advisory.ts b/src/cli/enforcement-advisory.ts new file mode 100644 index 0000000..03bc807 --- /dev/null +++ b/src/cli/enforcement-advisory.ts @@ -0,0 +1,85 @@ +// Cladding · feature-cycle advisory (F-f4e184f7 enforcement + F-be5306eb cold-start) +// +// Non-blocking, cwd-derived advisories that tell the user the feature cycle isn't +// being driven. Two graduated cases: +// 1. COLD-START (F-be5306eb): the project has source code but zero feature specs +// — code is running ahead of the spec; the cycle never started. +// 2. ENFORCEMENT (F-f4e184f7): features are in flight but no hook/CI enforce the +// gate, so the checks run only when asked. +// Both are derived from cwd alone (never the gate outcome), so they can only +// inform — never change pass/fail. + +import {existsSync} from 'node:fs'; +import {join} from 'node:path'; + +import {walk} from './scan/walker.js'; +import {enforcingHookInstalled} from '../init/git-hook.js'; +import {loadSpec} from '../spec/load.js'; + +/** True when a CI workflow directory exists (the authoritative, unbypassable gate). */ +function ciWorkflowPresent(cwd: string): boolean { + return existsSync(join(cwd, '.github', 'workflows')); +} + +/** True when at least one source file exists (vendor dirs / dotfiles ignored, early exit). */ +function hasSourceCode(cwd: string): boolean { + try { + return walk({root: cwd, maxFiles: 1}).length > 0; + } catch { + return false; + } +} + +// Statuses of a feature still moving through the cycle. This is the advisory's own +// "work in flight" notion (a UX cadence count), NOT the detectors' spec-first +// severity window (isSpecFirstWindow, F-c3747d7d) — kept separate on purpose. +const UNDONE_STATUSES: ReadonlySet = new Set(['planned', 'in_progress']); + +/** + * Cold-start advisory (F-be5306eb): the project has source code but zero feature + * specs, so the feature cycle never started — else `undefined`. Either suppressor + * (a feature already exists, or no source code yet) silences it. + */ +export function coldStartAdvisory(cwd = '.'): string | undefined { + try { + if ((loadSpec(cwd).features ?? []).length > 0) return undefined; // cycle already started + } catch { + return undefined; // no / invalid spec → onboarding not done; not this check's place + } + if (!hasSourceCode(cwd)) return undefined; // clean greenfield — nothing to nag + return ( + "This project has source code but no feature specs yet — the feature cycle hasn't started. " + + "Author your first feature's spec (its acceptance criteria and the files it covers) so the code " + + 'is governed by the spec, not running ahead of it.' + ); +} + +/** + * Enforcement advisory (F-f4e184f7): undone features but no local hook and no CI + * enforce the checks — else `undefined`. Any ONE of {enforcing hook, CI workflow, + * zero undone features, unreadable spec} suppresses it. + */ +export function enforcementAdvisory(cwd = '.'): string | undefined { + let undone: number; + try { + const spec = loadSpec(cwd); + undone = (spec.features ?? []).filter((f) => UNDONE_STATUSES.has(f.status)).length; + } catch { + return undefined; // no / invalid spec → not this check's place to speak + } + if (undone === 0) return undefined; + if (enforcingHookInstalled(cwd) || ciWorkflowPresent(cwd)) return undefined; + return ( + `${undone} feature${undone === 1 ? '' : 's'} not yet done, and nothing enforces the checks ` + + '(no pre-push hook, no CI) — the gate runs only when you ask. ' + + 'Wire it with `clad init --with-hook`, or add a CI workflow.' + ); +} + +/** + * Graduated feature-cycle advisory: the cold-start signal when the cycle is + * un-started, otherwise the enforcement signal. One source for clad check to print. + */ +export function featureCycleAdvisory(cwd = '.'): string | undefined { + return coldStartAdvisory(cwd) ?? enforcementAdvisory(cwd); +} diff --git a/src/cli/hook.ts b/src/cli/hook.ts index 9cf6249..0fa688f 100644 --- a/src/cli/hook.ts +++ b/src/cli/hook.ts @@ -47,6 +47,7 @@ import {dependSegment, formatWorkingSetCard, formatPushOneLiner, guardSegment, U import {estTokens} from '../optimizer/code-excerpt.js'; import {loadSpec} from '../spec/load.js'; import {WATCHED_EXTENSIONS} from '../stages/toolchain/language-config.js'; +import {coldStartAdvisory} from './enforcement-advisory.js'; import {driftNudge, plainFinding, plainLead, stopBlockMessage} from '../ui/softShell.js'; // --- shared helpers ---------------------------------------------------- @@ -187,6 +188,10 @@ function renderSessionStartCard(cwd: string): string { ? 'cladding: spec.yaml present but unparseable — counts unavailable (run clad check)' : `cladding: ${total} features (${done} done, ${inProgress.length} in progress) · ${scenarios} scenarios`, ]; + // F-be5306eb: code exists but no feature specs → the cycle never started. Only + // fires at zero features, so it never pushes the card past the line cap. + const coldStart = coldStartAdvisory(cwd); + if (coldStart) lines.push(`cladding: ${coldStart}`); if (inProgress.length > 0) { lines.push(`in progress: ${inProgress.slice(0, 3).map((f) => `${f.id} ${f.slug}`).join(', ')}`); } @@ -200,7 +205,9 @@ function renderSessionStartCard(cwd: string): string { if (existsSync(blockPath)) { try { const sb = JSON.parse(readFileSync(blockPath, 'utf8')) as {count?: unknown; first?: unknown}; - lines.push(`unresolved stop-block: ${Number(sb.count ?? 0)} finding(s) — ${asString(sb.first) || 'unknown'}`); + // Plain-first (AC-78c153fa): sb.first is a raw detector name; render its + // plain lead so the card never surfaces the internal id as its lead. + lines.push(`unresolved stop-block: ${Number(sb.count ?? 0)} finding(s) — ${plainLead(asString(sb.first), 'a prior check')}`); } catch { /* unreadable block file → omit the resurface line */ } @@ -572,6 +579,78 @@ function recordImpactSkip(cwd: string, reason: ImpactSkipReason): void { recordEvent(cwd, 'impact_card_skipped', {reason}); } +// --- unbound-edit nudge (F-f9891175) ----------------------------------- +// +// When watched source edits keep resolving to no owning feature, the feature +// cycle is never TRIGGERED — cladding otherwise stays silent (owner_miss skips). +// This counts owner_miss edits in a rolling window and, once past a small +// threshold, returns ONE advisory nudge line for the PostToolUse card, fired +// once per window (AC-5d379d4e). Same sidecar discipline as SkipAgg; every path +// is wrapped so a failure returns '' and stdout stays byte-identical (AC-228fdc15). + +const UNBOUND_AGG_FILE = 'hook-unbound-agg.json'; +const UNBOUND_NUDGE_THRESHOLD = 3; +const UNBOUND_WINDOW_MS = 10 * 60_000; // rolling 10-minute accumulation window + +interface UnboundAgg { + windowStart: number; + count: number; + nudged: boolean; +} + +function unboundAggPath(cwd: string): string { + return join(cwd, '.cladding', UNBOUND_AGG_FILE); +} + +/** Read the sidecar; corrupt/missing → a fresh window (never throws). */ +function readUnboundAgg(cwd: string, now: number): UnboundAgg { + try { + const o = JSON.parse(readFileSync(unboundAggPath(cwd), 'utf8')) as Partial; + return { + windowStart: Number.isFinite(o.windowStart) ? Number(o.windowStart) : now, + count: Number.isFinite(o.count) ? Number(o.count) : 0, + nudged: o.nudged === true, + }; + } catch { + return {windowStart: now, count: 0, nudged: false}; + } +} + +function writeUnboundAgg(cwd: string, agg: UnboundAgg): void { + try { + mkdirSync(dirname(unboundAggPath(cwd)), {recursive: true}); + writeFileSync(unboundAggPath(cwd), JSON.stringify(agg), 'utf8'); + } catch { + /* unwritable sidecar → nudge just won't persist; never a throw */ + } +} + +/** + * Counts one owner_miss (unbound) source edit and, when the rolling-window count + * first crosses the threshold, returns ONE advisory nudge line — otherwise ''. + * Observer-only: any failure returns '' so the caller's stdout is byte-identical + * to the output produced without this feature (AC-228fdc15). + */ +function unboundEditNudge(cwd: string): string { + try { + const now = Date.now(); + let agg = readUnboundAgg(cwd, now); + if (now - agg.windowStart >= UNBOUND_WINDOW_MS) agg = {windowStart: now, count: 0, nudged: false}; + agg.count += 1; + let line = ''; + if (agg.count >= UNBOUND_NUDGE_THRESHOLD && !agg.nudged) { + agg.nudged = true; + line = + `cladding: ${agg.count} recent source edits aren't tracked by any feature — ` + + "start a feature for this work (or add these files to one you've already started) so the spec-first cycle covers them."; + } + writeUnboundAgg(cwd, agg); + return line; + } catch { + return ''; + } +} + /** Records one impact_card_fired + closes the aggregate window. `tier` is optional so the * shipped fallback path (AC-38141a9e) emits the byte-identical pre-tier payload. */ function recordFiredEvent(cwd: string, payload: Record): void { @@ -738,12 +817,15 @@ function emitCardForPath(cwd: string, sessionId: string, rel: string, lane?: 'ba const slice = buildImpactSlice(spec, rel); if ('not_found' in slice) { recordImpactSkip(cwd, 'owner_miss'); - return ''; + return lane ? '' : unboundEditNudge(cwd); } const card = formatImpactCard(slice, rel); - if (card) recordImpactFired(cwd, rel, slice, lane); - else recordImpactSkip(cwd, 'owner_miss'); // found slice but no primary owner → no output - return card; + if (card) { + recordImpactFired(cwd, rel, slice, lane); + return card; + } + recordImpactSkip(cwd, 'owner_miss'); // found slice but no primary owner → no output + return lane ? '' : unboundEditNudge(cwd); } catch { recordImpactSkip(cwd, 'spec_unreadable'); // spec unreadable → no card return ''; diff --git a/src/cli/init.ts b/src/cli/init.ts index c6875ee..eb277a4 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -101,11 +101,9 @@ const SCENARIOS_README = [ 'Scenarios in cladding capture **user journeys** — the business flows your', 'system enables, not the architecture layers your code is organised into.', '', - 'You do not author scenario YAML by hand. They are auto-registered when you', - 'request a feature through natural-language conversation with your AI host —', - 'the host invokes the `clad` CLI (or the `clad_create_feature` MCP tool when', - 'cladding is wired as an MCP server). The scenario your request belongs to is', - 'inferred together with the feature itself.', + 'You do not author scenario YAML by hand. They are registered for you when you', + 'ask your AI assistant to add a feature in ordinary conversation. The scenario', + 'your request belongs to is inferred together with the feature itself.', '', 'This directory is intentionally empty at scan time. The first scenario lands', 'when you ship the first feature.', @@ -123,7 +121,7 @@ const SCENARIOS_README = [ '', '- `docs/conventions.md` — observed conventions (auto-generated)', '- `spec/architecture.yaml` — observed layers + forbidden_imports candidates', - '- `spec.yaml` — feature registry (grown by clad_create_feature)', + '- `spec.yaml` — feature registry (grown as you add features in conversation)', '', ].join('\n'); @@ -511,7 +509,20 @@ export async function runInit(opts: InitOptions = {}): Promise { // directly instead of re-parsing docs/project-context.md. LLM // refinement (when a dispatcher is available) adds `summary` + // `surface` per entry; deterministic mode ships id + title only. - writeArtifact(cwd, 'spec/capabilities.yaml', interp.capabilitiesYaml, created, proposals); + // + // v0.9.1 — an existing-project adoption still carries the host/LLM's + // approved, domain-aware capabilities via the onboarding pass. The scan + // interpreter can't see them: its total-fallback fires on the absent + // CONVENTIONS_MD sentinel (a host draft never emits it) and re-derives + // capabilities from README headings — or `[]` when there are none — + // silently discarding the draft's schema-validated 3–8 entries. Prefer + // the onboarding capabilities when the dispatcher genuinely fired + // (`source === 'llm'`), mirroring the greenfield branch below; the + // scanner still owns conventions.md + architecture.yaml, which are + // code-grounded and correct for a real codebase. + const capabilitiesYaml = + onboarding?.source === 'llm' ? onboarding.capabilitiesYaml : interp.capabilitiesYaml; + writeArtifact(cwd, 'spec/capabilities.yaml', capabilitiesYaml, created, proposals); // v0.3.30 — scenarios are not auto-extracted from observed code. // A user journey is *intent*, not architecture, so cladding leaves diff --git a/src/init/git-hook.ts b/src/init/git-hook.ts index c6d2f02..8925683 100644 --- a/src/init/git-hook.ts +++ b/src/init/git-hook.ts @@ -23,6 +23,23 @@ import {join} from 'node:path'; /** Marker prefix identifying a hook as cladding-authored (for idempotency). */ const HOOK_MARKER_PREFIX = 'cladding '; +/** + * True when a cladding-owned pre-commit or pre-push hook is installed (its marker + * line present). Used by the enforcement advisory (F-f4e184f7) to tell whether + * local git enforcement is wired, without installing or modifying anything. + */ +export function enforcingHookInstalled(cwd: string): boolean { + for (const kind of ['pre-commit', 'pre-push'] as const) { + try { + const body = readFileSync(join(cwd, '.git', 'hooks', kind), 'utf8'); + if (body.includes(`${HOOK_MARKER_PREFIX}${kind} hook`)) return true; + } catch { + /* hook file missing/unreadable → not installed for this kind */ + } + } + return false; +} + export type HookKind = 'pre-commit' | 'pre-push'; /** Per-kind gate invocation. pre-push carries --strict: it is the local diff --git a/src/serve/server.ts b/src/serve/server.ts index eebae42..76869c8 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -174,7 +174,7 @@ export function buildServer(opts: ServerOptions = {}): McpServer { const server = new McpServer( { name: opts.name ?? 'cladding', - version: opts.version ?? '0.9.0', + version: opts.version ?? '0.9.1', }, { instructions: diff --git a/src/stages/detectors/convention-drift.ts b/src/stages/detectors/convention-drift.ts index 177ded8..4862986 100644 --- a/src/stages/detectors/convention-drift.ts +++ b/src/stages/detectors/convention-drift.ts @@ -5,8 +5,8 @@ // behind the `reviewer` agent in v0.2. This brick ships the // deterministic v0.1 floor: // -// For every features[].modules[] file ending in `.ts`, verify the -// first non-empty line begins a comment (line or block). The intent +// For every feature module in the project's configured language, verify the +// first non-empty line begins a language-appropriate comment or docstring. The intent // is the "Documentation: Why > What" guardrail from // ironclad-design/13-philosophical-guardrails.md — code without a // header comment is the cheapest, highest-signal style violation @@ -24,7 +24,13 @@ const NAME = 'CONVENTION_DRIFT'; function startsWithComment(content: string): boolean { const trimmed = content.trimStart(); - return trimmed.startsWith('//') || trimmed.startsWith('/*'); + return ( + trimmed.startsWith('//') || + trimmed.startsWith('/*') || + trimmed.startsWith('#') || + trimmed.startsWith('"""') || + trimmed.startsWith("'''") + ); } function runConventionDrift(opts: CommandStageOptions): readonly DriftFinding[] { diff --git a/src/stages/finding-parser.ts b/src/stages/finding-parser.ts index 62ac63a..dac6e00 100644 --- a/src/stages/finding-parser.ts +++ b/src/stages/finding-parser.ts @@ -248,6 +248,30 @@ const KIND_DETECTOR: Record<'type' | 'lint' | 'unit', string> = { unit: 'UNIT', }; +// Check-only formatters (dart format --set-exit-if-changed, and peers) print one +// `Changed ` line per dirty file plus a summary. None match the ESLint +// stylish regex, so the raw-tail fallback used to collapse the whole set to a +// single pathless finding (whack-a-mole: fix one, re-run, the next appears). This +// lifts each listed file to its own LINT finding so every dirty file surfaces at +// once (F-4643d99d AC-7b620bf4). +const CHANGED_FILE = /^Changed\s+(.+)$/; // dart format --output=none + +function parseFormatterFindings(text: string): DriftFinding[] { + const out: DriftFinding[] = []; + for (const line of text.split(/\r?\n/)) { + const m = CHANGED_FILE.exec(stripAnsi(line).trim()); + if (m && m[1]) { + out.push({ + detector: 'LINT', + severity: 'error', + path: m[1], + message: 'not formatting-clean — differs from the formatter output', + }); + } + } + return out; +} + /** * Routes a tool stage's captured output to its parser and applies the AC-20b69848 * synthetic raw-tail fallback: when the stage FAILED (exitCode ≠ 0) but no @@ -280,6 +304,9 @@ export function parseToolFindings( break; case 'lint': findings = parseEslintFindings(combined); + // Check-only formatters (dart/dotnet) list dirty files, not ESLint rows — + // parse them per-file before the single raw-tail fallback (AC-7b620bf4). + if (findings.length === 0) findings = parseFormatterFindings(combined); break; case 'unit': findings = parseVitestFindings(combined); diff --git a/src/stages/lint.ts b/src/stages/lint.ts index 9c51e23..5fa08b8 100644 --- a/src/stages/lint.ts +++ b/src/stages/lint.ts @@ -19,6 +19,17 @@ import {missingToolSkip, ranToolResult} from './util.js'; const STAGE = 'stage_1.2'; +/** + * Fix command for a recognised check-only formatter, else undefined. These tools + * verify formatting and exit non-zero on any diff but do not fix in place; the + * hint tells the user which one command makes the stage green (F-4643d99d). + */ +function formatterFixHint(cmd: string, args: readonly string[]): string | undefined { + if (cmd === 'dart' && args[0] === 'format') return 'dart format .'; + if (cmd === 'dotnet' && args.includes('format')) return 'dotnet format'; + return undefined; +} + /** * Runs the project's linter and returns an Ironclad-shaped stage result. * @@ -60,7 +71,14 @@ export function runLint(opts: CommandStageOptions = {}): StageResult { // any non-zero exit → blocking fail (1), never the tool's raw 2 (= skip). // ADDITIVE (F-b7873005): on failure, attach structured findings parsed from // the linter's own output — the raw stderr is preserved unchanged. - return withFindings('lint', ranToolResult(STAGE, proc), proc); + const result = withFindings('lint', ranToolResult(STAGE, proc), proc); + // ADDITIVE (F-4643d99d): on a failing check-only formatter, carry a one-line + // fix hint the renderer prints under the per-file findings. + if (!result.pass) { + const hint = formatterFixHint(cmd, args); + if (hint) return {...result, hint}; + } + return result; } // CLI entry — `tsx stages/lint.ts` or `npm run stage:lint`. diff --git a/src/stages/test-run-cache.ts b/src/stages/test-run-cache.ts index 7b0fa2b..bb149b6 100644 --- a/src/stages/test-run-cache.ts +++ b/src/stages/test-run-cache.ts @@ -1,11 +1,11 @@ // Cladding · stages · shared test-run cache — run-scoped, gate-seam-lifetimed // -// WHY (issue #215). One `clad check --tier=pre-push` runs the SAME vitest suite -// TWICE: stage_2.1 (unit) spawns `vitest run` and stage_2.2 (coverage) spawns -// `vitest run --coverage`. On cladding's own ~1600-test suite that is the single +// WHY (issue #215). One `clad check --tier=pre-push` can run the SAME suite +// TWICE: stage_2.1 (unit) spawns the test runner and stage_2.2 (coverage) spawns +// it again under coverage. On large Vitest and pytest suites that is the single // biggest chunk of gate wall-clock. This module lets the unit stage spawn the // COVERAGE command ONCE — augmented with the vacuous-test guard's dual json -// reporter — and publish that one process so the coverage stage folds the cached +// reporter when applicable — and publish that one process so the coverage stage folds the cached // exit signal instead of re-spawning vitest. // // GUARD-COMPATIBLE (the reason PR #216 was rejected). #216 deduped by having the diff --git a/src/stages/types.ts b/src/stages/types.ts index 00df594..2a6ad7d 100644 --- a/src/stages/types.ts +++ b/src/stages/types.ts @@ -55,6 +55,12 @@ export interface StageResult { * verdict reducer prefers the first path-bearing finding for `next_action`. */ readonly findings?: readonly DriftFinding[]; + /** + * NEW (F-4643d99d) — a one-line remediation hint the check renderer prints + * under a failing tool stage's findings (e.g. `dart format .`). Additive; + * absent on green stages and on stages with no known fix command. + */ + readonly hint?: string; } /** Shared options for any stage that wraps an external command. */ diff --git a/src/stages/unit.ts b/src/stages/unit.ts index 39a6007..192b188 100644 --- a/src/stages/unit.ts +++ b/src/stages/unit.ts @@ -41,6 +41,11 @@ function isVitestRunner(cmd: string, args: readonly string[]): boolean { return cmd === 'vitest' || cmd.endsWith('/vitest') || args.includes('vitest'); } +/** True when a command directly or indirectly invokes pytest. */ +function isPytestRunner(cmd: string, args: readonly string[]): boolean { + return [cmd, ...args].some((part) => part === 'pytest' || part.endsWith('/pytest')); +} + /** * Returns true only when a successful runner output definitively reports that * every aggregate test count was zero. Multiple summaries can occur in npm @@ -53,6 +58,9 @@ function reportsZeroExecutedTests(proc: {readonly stdout?: unknown; readonly std /^\s*#\s*tests\s+(\d+)\s*$/gim, /^\s*ℹ\s+tests\s+(\d+)\s*$/gim, /^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim, + // pytest / coverage.py: "collected 0 items" is the zero-executed signal a + // green exit can still carry (e.g. an over-narrow -k / testpaths selection). + /^\s*collected\s+(\d+)\s+items?\b.*$/gim, ]; for (const pattern of patterns) { for (const match of output.matchAll(pattern)) counts.push(Number(match[1])); @@ -120,6 +128,47 @@ function tryReuseSharedRun(opts: UnitStageOptions, cwd: string, guardOn: boolean return {stage: STAGE, pass: true, exitCode: 0}; } +/** + * Shares one coverage-instrumented pytest run across Unit and Coverage. + * + * Pytest has no Cladding per-test json reporter equivalent, so the reuse path is + * limited to a green coverage command that itself invokes pytest. A non-green run + * falls back to the tests-only command for sound failure attribution, while + * Coverage later reuses the cached failing result. Under --strict the shared run's + * own summary still feeds the zero-executed-tests guard (AC-f8e85a99), so the + * dedup can never turn a vacuous pytest run into a passing unit result — the same + * discipline AC-6b2d81f7 pins for the vitest reuse path. + */ +function tryReuseSharedPytestRun(opts: UnitStageOptions, cwd: string): StageResult | null { + const {strict = false} = opts; + let covCmd: string | undefined; + let covArgs: readonly string[] | undefined; + try { + ({cmd: covCmd, args: covArgs} = resolveStageCommand('coverage', opts)); + } catch { + return null; + } + if (!covCmd || !covArgs || !isPytestRunner(covCmd, covArgs)) return null; + const runCmd = covCmd; + const runArgs = covArgs; + const shared = getOrRunSharedCoverage(cwd, () => + execaSync(runCmd, [...runArgs], {cwd, reject: false}), + ); + if (!shared) return null; + if (missingToolSkip(STAGE, runCmd, shared.proc, runArgs)) return null; + const covResult = ranToolResult(STAGE, shared.proc); + if (unitActionFromCoverage(covResult) === 'fallback') return null; + if (strict && reportsZeroExecutedTests(shared.proc)) { + const finding = { + detector: 'VACUOUS_TESTS', + severity: 'error' as const, + message: 'The unit test command exited successfully but reported zero executed tests.', + }; + return {stage: STAGE, pass: false, exitCode: 1, findings: [finding], stderr: finding.message}; + } + return {stage: STAGE, pass: true, exitCode: 0}; +} + /** * Runs the project's unit-test suite and returns an Ironclad-shaped result. * @@ -156,6 +205,7 @@ export function runUnit(opts: UnitStageOptions = {}): StageResult { // Guard applies only under --strict on a vitest runner (the only path we can // capture per-file json for). Otherwise the invocation is unchanged. const testIsVitest = isVitestRunner(cmd, args); + const testIsPytest = isPytestRunner(cmd, args); const guardOn = strict && testIsVitest; // Dedup fast path (F-49f6f2d2): on a primed vitest gate, reuse the ONE shared // coverage+dual-json run stage_2.2 also folds, so the suite runs once (#215). @@ -165,6 +215,10 @@ export function runUnit(opts: UnitStageOptions = {}): StageResult { const reused = tryReuseSharedRun(opts, cwd, guardOn); if (reused) return reused; } + if (isTestRunPrimed() && testIsPytest) { + const reused = tryReuseSharedPytestRun(opts, cwd); + if (reused) return reused; + } let jsonFile: string | undefined; let runArgs: readonly string[] = args; if (guardOn) { diff --git a/src/ui/softShell.ts b/src/ui/softShell.ts index 62d4cd7..e58a970 100644 --- a/src/ui/softShell.ts +++ b/src/ui/softShell.ts @@ -165,7 +165,7 @@ export const DETECTOR_PLAIN: Readonly> = { FIXTURE_REFERENCE_INVALID: {lead: 'A criterion refers to a test fixture that is not registered', action: 'register the fixture or fix the reference name'}, SLUG_CONFLICT: {lead: 'Two features or two scenarios share the same short name', action: 'rename one so each short name is unique'}, ID_COLLISION: {lead: 'Two features or two scenarios share the same id', action: 'give one of them a new id'}, - INVENTORY_DRIFT: {lead: 'The spec summary counts do not match the shard files on disk', action: 'run `clad sync` to refresh the counts'}, + INVENTORY_DRIFT: {lead: 'The spec summary counts do not match the spec files on disk', action: 'run `clad sync` to refresh the counts'}, AC_DUPLICATE_WITHIN_FEATURE: {lead: 'The same criterion id appears twice inside one feature', action: 'renumber or remove the duplicate criterion'}, ARCHITECTURE_FROM_SPEC: {lead: 'The code imports across layers in a way the architecture rules forbid', action: 'remove the cross-layer import or update the architecture rules'}, CAPABILITIES_FEATURE_MAPPING: {lead: 'A capability lists a feature id that does not exist', action: 'fix the capability feature list'}, diff --git a/tests/cli/clad.test.ts b/tests/cli/clad.test.ts index 3e54a8a..8399728 100644 --- a/tests/cli/clad.test.ts +++ b/tests/cli/clad.test.ts @@ -561,7 +561,7 @@ describe('cli/clad — createProgram', () => { test('program version matches current package version', () => { const program = clad.createProgram(); - expect(program.version()).toBe('0.9.0'); + expect(program.version()).toBe('0.9.1'); }); }); diff --git a/tests/cli/clarify.test.ts b/tests/cli/clarify.test.ts index 3026b90..55b9117 100644 --- a/tests/cli/clarify.test.ts +++ b/tests/cli/clarify.test.ts @@ -192,6 +192,12 @@ describe('runClarifyCommand', () => { expect(exitCalls).toEqual([0]); const after = loadState(dir)!; expect(after.status).toBe('done'); + // F-195cb59e AC-3b2026e1 — the completion message steers to authoring the + // first feature's spec (with its acceptance criteria + files) before code. + const out = stdoutChunks.join(''); + expect(out).toContain('first feature'); + expect(out).toContain('acceptance criteria'); + expect(out).toContain('before writing code'); }); test('--json emits a RefineReport', async () => { diff --git a/tests/cli/cold-start-signal.test.ts b/tests/cli/cold-start-signal.test.ts new file mode 100644 index 0000000..abcb143 --- /dev/null +++ b/tests/cli/cold-start-signal.test.ts @@ -0,0 +1,49 @@ +// Cladding · F-be5306eb AC-babf927c — SessionStart surfaces the cold-start signal. +// +// The always-on net: when a session starts in a project that has source code but +// zero feature specs, the SessionStart card says the feature cycle hasn't started — +// regardless of how that state was reached. + +import {mkdirSync, mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; + +import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'; + +vi.mock('../../src/stages/drift.js', () => ({runDrift: () => ({pass: true, exitCode: 0, findings: []})})); +vi.mock('../../src/stages/arch.js', () => ({runArch: () => ({pass: true, exitCode: 0})})); +vi.mock('../../src/stages/secret.js', () => ({runSecret: () => ({pass: true, exitCode: 0})})); + +const {runHookEvent} = await import('../../src/cli/hook.js'); + +let cwd: string; +beforeEach(() => { + cwd = mkdtempSync(join(tmpdir(), 'clad-cold-')); +}); +afterEach(() => { + rmSync(cwd, {recursive: true, force: true}); + vi.clearAllMocks(); +}); + +function writeSpec(features: string): void { + writeFileSync(join(cwd, 'spec.yaml'), `schema: "0.1"\nproject: {name: t, language: typescript}\nfeatures: ${features}\n`, 'utf8'); +} +function writeSource(): void { + mkdirSync(join(cwd, 'src'), {recursive: true}); + writeFileSync(join(cwd, 'src', 'foo.ts'), 'export const x = 1;\n'); +} + +describe('F-be5306eb AC-babf927c — SessionStart cold-start signal', () => { + test('code but zero feature specs → the card carries the cold-start line', () => { + writeSpec('[]'); + writeSource(); + const card = runHookEvent('SessionStart', {}, cwd); + expect(card).toContain("feature cycle hasn't started"); + }); + + test('a fresh project with no source code → no cold-start line', () => { + writeSpec('[]'); // no source written + const card = runHookEvent('SessionStart', {}, cwd); + expect(card).not.toContain("hasn't started"); + }); +}); diff --git a/tests/cli/done.test.ts b/tests/cli/done.test.ts index 6043027..aee75d0 100644 --- a/tests/cli/done.test.ts +++ b/tests/cli/done.test.ts @@ -219,14 +219,14 @@ describe('runDone', () => { expect(res.reason).toContain('feature id required'); }); - test('no matching shard → code 1 with "no feature shard"', () => { + test('no matching feature → code 1 with "no feature in the spec"', () => { // spec/features/ does not exist at all. const res = runDone(dir, FEATURE_ID, { checkStages: () => ({worst: 0}), }); expect(res.ok).toBe(false); expect(res.code).toBe(1); - expect(res.reason).toContain('no feature shard'); + expect(res.reason).toContain('no feature in the spec'); }); test('flip precedes the gate — the gate sees status: done already on disk', () => { @@ -321,7 +321,7 @@ describe('runDone git-operation guard (F-10cc42d1 · AC-611089cf)', () => { const res = runDone(dir, 'F-nomatch', {checkStages: () => ({worst: 0}), gitOpInProgress: () => 'merge'}); expect(res.ok).toBe(false); expect(res.reason).toContain('merge'); - expect(res.reason).not.toContain('no feature shard'); + expect(res.reason).not.toContain('no feature in the spec'); }); test('a null probe leaves the transition unguarded — the GREEN path still flips to done', () => { diff --git a/tests/cli/enforcement-advisory.test.ts b/tests/cli/enforcement-advisory.test.ts new file mode 100644 index 0000000..bcb3708 --- /dev/null +++ b/tests/cli/enforcement-advisory.test.ts @@ -0,0 +1,145 @@ +// Cladding · F-f4e184f7 — enforcement advisory for the feature cycle. +// +// enforcementAdvisory(cwd) returns one non-blocking line when a project has +// features not yet done but neither a cladding hook nor CI enforces the checks — +// and undefined when any suppressor holds. It is derived from cwd alone (never a +// gate result), so it can only inform. + +import {mkdirSync, mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; + +import {afterEach, beforeEach, describe, expect, test} from 'vitest'; + +import {coldStartAdvisory, enforcementAdvisory, featureCycleAdvisory} from '../../src/cli/enforcement-advisory.js'; + +const spec = (status: string): string => + [ + 'schema: "0.1"', + 'project: {name: t, language: typescript}', + 'features:', + ' - id: F-aaa111', + ' slug: alpha', + ' title: alpha', + ` status: ${status}`, + ' modules: [src/foo.ts]', + ' acceptance_criteria:', + ' - id: AC-001', + ' ears: ubiquitous', + ' text: t', + '', + ].join('\n'); + +let cwd: string; +beforeEach(() => { + cwd = mkdtempSync(join(tmpdir(), 'clad-enf-adv-')); +}); +afterEach(() => rmSync(cwd, {recursive: true, force: true})); + +function writeSpec(status: string): void { + writeFileSync(join(cwd, 'spec.yaml'), spec(status), 'utf8'); +} +function installHook(kind: 'pre-commit' | 'pre-push'): void { + mkdirSync(join(cwd, '.git', 'hooks'), {recursive: true}); + writeFileSync(join(cwd, '.git', 'hooks', kind), `#!/bin/sh\n# cladding ${kind} hook — installed by clad init\nexit 0\n`); +} +function addCiWorkflow(): void { + mkdirSync(join(cwd, '.github', 'workflows'), {recursive: true}); + writeFileSync(join(cwd, '.github', 'workflows', 'ci.yml'), 'name: ci\n'); +} + +describe('F-f4e184f7 — enforcement advisory', () => { + test('AC-4566fd98 — undone features + no hook + no CI → an advisory naming the count', () => { + writeSpec('in_progress'); + const out = enforcementAdvisory(cwd); + expect(out).toBeTypeOf('string'); + expect(out).toContain('1 feature'); + expect(out).toContain('nothing enforces the checks'); + }); + + test('planned (spec-first) features also count as not-yet-done', () => { + writeSpec('planned'); + expect(enforcementAdvisory(cwd)).toContain('not yet done'); + }); + + describe('AC-2fd01eaa — any one suppressor silences it', () => { + test('an installed pre-push hook suppresses it', () => { + writeSpec('in_progress'); + installHook('pre-push'); + expect(enforcementAdvisory(cwd)).toBeUndefined(); + }); + + test('an installed pre-commit hook suppresses it', () => { + writeSpec('in_progress'); + installHook('pre-commit'); + expect(enforcementAdvisory(cwd)).toBeUndefined(); + }); + + test('a CI workflow directory suppresses it', () => { + writeSpec('in_progress'); + addCiWorkflow(); + expect(enforcementAdvisory(cwd)).toBeUndefined(); + }); + + test('no undone features → no advisory', () => { + writeSpec('done'); + expect(enforcementAdvisory(cwd)).toBeUndefined(); + }); + + test('a missing/invalid spec → no advisory (not this check to speak)', () => { + expect(enforcementAdvisory(cwd)).toBeUndefined(); // no spec.yaml written + writeFileSync(join(cwd, 'spec.yaml'), 'not: a valid spec\n'); + expect(enforcementAdvisory(cwd)).toBeUndefined(); + }); + }); + + test('AC-be0cbdaa — a foreign (non-cladding) hook does NOT suppress it', () => { + writeSpec('in_progress'); + mkdirSync(join(cwd, '.git', 'hooks'), {recursive: true}); + writeFileSync(join(cwd, '.git', 'hooks', 'pre-push'), '#!/bin/sh\n# someone elses hook\nexit 0\n'); + expect(enforcementAdvisory(cwd)).toContain('not yet done'); + }); +}); + +describe('F-be5306eb — cold-start / graduated feature-cycle advisory', () => { + const emptySpec = (): void => + writeFileSync(join(cwd, 'spec.yaml'), 'schema: "0.1"\nproject: {name: t, language: typescript}\nfeatures: []\n', 'utf8'); + const writeSource = (): void => { + mkdirSync(join(cwd, 'src'), {recursive: true}); + writeFileSync(join(cwd, 'src', 'foo.ts'), 'export const x = 1;\n'); + }; + + test('AC-a0e5840a — source code but zero feature specs → cold-start advisory', () => { + emptySpec(); + writeSource(); + const out = coldStartAdvisory(cwd); + expect(out).toBeTypeOf('string'); + expect(out).toContain("feature cycle hasn't started"); + expect(out).toContain('first feature'); + }); + + test('AC-4e780c47 — no source code yet (fresh onboarding) → no cold-start advisory', () => { + emptySpec(); // no source written + expect(coldStartAdvisory(cwd)).toBeUndefined(); + }); + + test('AC-4e780c47 — a feature already exists → no cold-start advisory even with code', () => { + writeSpec('in_progress'); // one feature + writeSource(); + expect(coldStartAdvisory(cwd)).toBeUndefined(); + }); + + test('AC-7cf9593d — graduated: cold-start wins when the cycle is un-started', () => { + emptySpec(); + writeSource(); + expect(featureCycleAdvisory(cwd)).toBe(coldStartAdvisory(cwd)); + expect(featureCycleAdvisory(cwd)).toContain("hasn't started"); + }); + + test('AC-7cf9593d — graduated: falls through to enforcement when features exist + no hook/CI', () => { + writeSpec('in_progress'); // undone feature, no hook, no CI + const out = featureCycleAdvisory(cwd); + expect(out).toContain('not yet done'); // enforcement message, not cold-start + expect(out).not.toContain("hasn't started"); + }); +}); diff --git a/tests/cli/hook-telemetry.test.ts b/tests/cli/hook-telemetry.test.ts index 3cd93e8..ae7ed2b 100644 --- a/tests/cli/hook-telemetry.test.ts +++ b/tests/cli/hook-telemetry.test.ts @@ -85,6 +85,12 @@ function clearStamp(): void { function clearPushLedger(): void { rmSync(join(cwd, '.cladding', 'hook-push-ledger.json'), {force: true}); } +// F-f9891175: owner_miss edits also feed the unbound-edit nudge accumulator. This +// corpus isolates the skip-event accounting, so reset that sidecar per iteration +// (the nudge's own once-per-window behavior is covered in hook-unbound-nudge.test.ts). +function clearUnboundAgg(): void { + rmSync(join(cwd, '.cladding', 'hook-unbound-agg.json'), {force: true}); +} function freshStamp(): void { mkdirSync(join(cwd, '.cladding'), {recursive: true}); writeFileSync(stamp(), String(Date.now()), 'utf8'); @@ -145,6 +151,7 @@ describe('PostToolUse telemetry — accounting completeness', () => { // 4) owner_miss — a watched source path owned by no feature for (let i = 0; i < N.owner_miss; i++) { clearStamp(); + clearUnboundAgg(); // isolate skip accounting from the unbound-edit nudge (F-f9891175) expect(post(sourceEdit('src/orphan.ts', 60))).toBe(''); } // 5) fired — an owned module, substantive edit; the FIRST fired flushes the diff --git a/tests/cli/hook-unbound-nudge.test.ts b/tests/cli/hook-unbound-nudge.test.ts new file mode 100644 index 0000000..5729579 --- /dev/null +++ b/tests/cli/hook-unbound-nudge.test.ts @@ -0,0 +1,136 @@ +// Cladding · F-f9891175 — PostToolUse nudge when sustained source edits are +// bound to no feature. +// +// Drives runHookEvent as a FUNCTION (no host, no subprocess). drift/arch/secret +// are stubbed so PostToolUse never spawns a toolchain; the impact-slice path runs +// for real against a throwaway fixture. An edit to a path in no feature's modules +// is an owner_miss; once such edits reach the threshold in a window, the card +// carries one non-blocking nudge. +// +// Covers: +// AC-8542cc63 the nudge fires once the unbound-edit count crosses the threshold +// AC-388518f4 no nudge for a Read, a bound edit, or a sub-threshold count +// AC-5d379d4e once per window — a further unbound edit does not repeat it +// AC-228fdc15 never blocks; a sidecar failure leaves stdout byte-identical + +import {mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; + +import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'; + +type StageResult = {pass: boolean; exitCode: number; stderr?: string}; +type DriftFinding = {detector: string; severity: 'error' | 'warn' | 'info'; path?: string; message: string}; +type DriftReport = StageResult & {findings: DriftFinding[]}; + +const DRIFT_CLEAN: DriftReport = {pass: true, exitCode: 0, findings: []}; +const driftStub = vi.fn((): DriftReport => DRIFT_CLEAN); +const archStub = vi.fn((): StageResult => ({pass: true, exitCode: 0})); +const secretStub = vi.fn((): StageResult => ({pass: true, exitCode: 0})); + +vi.mock('../../src/stages/drift.js', () => ({runDrift: (...a: unknown[]) => driftStub(...(a as []))})); +vi.mock('../../src/stages/arch.js', () => ({runArch: (...a: unknown[]) => archStub(...(a as []))})); +vi.mock('../../src/stages/secret.js', () => ({runSecret: (...a: unknown[]) => secretStub(...(a as []))})); + +const {runHookEvent} = await import('../../src/cli/hook.js'); + +// F-aaa111 owns src/foo.ts; any OTHER src path (e.g. src/orphan.ts) is unbound. +const VALID_SPEC = [ + '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]', + '', +].join('\n'); + +const NUDGE = "recent source edits aren't tracked by any feature"; +const LONG = 'x'.repeat(60); // > MIN_EDIT_CHARS so the edit is not a trivial skip + +let cwd: string; + +function clearStamp(): void { + rmSync(join(cwd, '.cladding', 'hook-drift-ts'), {force: true}); +} +function post(input: unknown): string { + return runHookEvent('PostToolUse', input, cwd); +} +/** An Edit to an UNBOUND path, debounce cleared so it is not rate-limited. */ +function editUnbound(path = 'src/orphan.ts'): string { + clearStamp(); + return post({tool_name: 'Edit', tool_input: {file_path: path, old_string: '', new_string: LONG}}); +} + +beforeEach(() => { + cwd = mkdtempSync(join(tmpdir(), 'clad-vt-nudge-')); + writeFileSync(join(cwd, 'spec.yaml'), VALID_SPEC, 'utf8'); + driftStub.mockImplementation(() => DRIFT_CLEAN); +}); +afterEach(() => { + rmSync(cwd, {recursive: true, force: true}); + vi.clearAllMocks(); +}); + +describe('AC-8542cc63 — the nudge fires once unbound edits cross the threshold', () => { + test('third unbound edit carries the nudge; the first two are silent', () => { + expect(editUnbound()).not.toContain(NUDGE); // 1 + expect(editUnbound()).not.toContain(NUDGE); // 2 + const third = editUnbound(); // 3 → threshold + expect(third).toContain(NUDGE); + expect(third).toContain('3 recent source edits'); + expect(third).toContain('start a feature for this work'); + }); +}); + +describe('AC-388518f4 — no false nudge', () => { + test('a Read never nudges', () => { + for (let i = 0; i < 5; i++) { + clearStamp(); + expect(post({tool_name: 'Read', tool_input: {file_path: 'src/orphan.ts'}})).not.toContain(NUDGE); + } + }); + + test('edits to a BOUND file never nudge (they resolve to an owner)', () => { + for (let i = 0; i < 5; i++) { + clearStamp(); + const out = post({tool_name: 'Edit', tool_input: {file_path: 'src/foo.ts', old_string: '', new_string: LONG}}); + expect(out).not.toContain(NUDGE); + } + }); + + test('a single unbound edit (sub-threshold) is silent', () => { + expect(editUnbound()).not.toContain(NUDGE); + }); +}); + +describe('AC-5d379d4e — once per window', () => { + test('a further unbound edit after the nudge does not repeat it', () => { + editUnbound(); + editUnbound(); + expect(editUnbound()).toContain(NUDGE); // fires on the 3rd + expect(editUnbound()).not.toContain(NUDGE); // 4th — suppressed this window + expect(editUnbound()).not.toContain(NUDGE); // 5th — still suppressed + }); +}); + +describe('AC-228fdc15 — never blocks; byte-identical on sidecar failure', () => { + test('a sabotaged .cladding leaves the nudge silent (no throw, no block)', () => { + // Make .cladding a FILE so every sidecar read/write throws. + rmSync(join(cwd, '.cladding'), {recursive: true, force: true}); + writeFileSync(join(cwd, '.cladding'), 'x', 'utf8'); + let out = ''; + expect(() => { + out = post({tool_name: 'Edit', tool_input: {file_path: 'src/orphan.ts', old_string: '', new_string: LONG}}); + }).not.toThrow(); + // Without a persistable counter the nudge can never accumulate → byte-identical '' (no block). + expect(out).toBe(''); + }); +}); diff --git a/tests/cli/hook.test.ts b/tests/cli/hook.test.ts index e3c0172..7c29f8d 100644 --- a/tests/cli/hook.test.ts +++ b/tests/cli/hook.test.ts @@ -93,7 +93,7 @@ describe('SessionStart — context card', () => { expect(lines[0]).toBe('cladding: 3 features (1 done, 1 in progress) · 2 scenarios'); expect(lines[1]).toBe('in progress: F-bbb222 beta'); expect(lines[2]).toBe('last gate: pre-push strict=true → GREEN @ abcdef12'); - expect(lines[3]).toBe('unresolved stop-block: 2 finding(s) — AC_DRIFT'); + expect(lines[3]).toBe('unresolved stop-block: 2 finding(s) — An acceptance criterion is incomplete or out of sync with the spec'); // context capability line precedes policy; no ai_hints → no prefer lines. Both lines are // plain English with NO MCP tool names / no "shard" / no "SSoT" (F-f46d5c61, AC-2c63b999). expect(lines[4]).toBe( diff --git a/tests/cli/onboarding-handoff-steer.test.ts b/tests/cli/onboarding-handoff-steer.test.ts new file mode 100644 index 0000000..52d9cc5 --- /dev/null +++ b/tests/cli/onboarding-handoff-steer.test.ts @@ -0,0 +1,33 @@ +// Cladding · F-195cb59e — the onboarding→development handoff steers to the first +// feature's spec, not straight to code. +// +// The ungoverned-code case (a whole project scaffolded with features: []) traced +// to the init host instruction: "report that ordinary development can begin". This +// pins the corrected instruction so the handoff points at the spec-first cycle. + +import {readFileSync} from 'node:fs'; +import {join} from 'node:path'; + +import {describe, expect, test} from 'vitest'; + +const SKILL = readFileSync(join(process.cwd(), 'skills', 'init', 'SKILL.md'), 'utf8'); + +describe('F-195cb59e — onboarding handoff steer (init SKILL.md)', () => { + test('AC-f75cc3de — the completion instruction steers to authoring the first feature spec, not bare "ordinary development can begin"', () => { + expect(SKILL).not.toContain('ordinary development can begin'); + expect(SKILL).toMatch(/author the first feature'?s spec/i); + expect(SKILL).toMatch(/before writing (any )?code/i); + }); + + test('AC-d21ead41 — the steer names what the spec contains (acceptance criteria + the files it covers) and stays plain', () => { + // isolate the steer SENTENCE (the init skill legitimately names clad_* tools + // elsewhere — that is agent-facing protocol, not the user-facing steer). + const start = SKILL.indexOf('author the first feature'); + const steer = SKILL.slice(start, SKILL.indexOf('scaffolding', start) + 'scaffolding'.length); + // names WHAT to write — not vague + expect(steer).toContain('acceptance criteria'); + expect(steer).toMatch(/files it will cover/i); + // plain: the steer never says "shard" + expect(steer).not.toMatch(/\bshard\b/i); + }); +}); diff --git a/tests/human-first-cards.test.ts b/tests/human-first-cards.test.ts index f312dea..a650775 100644 --- a/tests/human-first-cards.test.ts +++ b/tests/human-first-cards.test.ts @@ -185,6 +185,9 @@ describe('AC-2c63b999 — zero MCP tool names, zero the retired term, on every u // vacuous-render guard: this must actually be the RICH multi-line card, not a degenerate one. expect(card.split('\n').length).toBeGreaterThanOrEqual(6); for (const line of card.split('\n')) expectHumanFirst(line, `SessionStart line "${line}"`); + // F-ebbb20af AC-78c153fa — the stop-block line is seeded with the raw detector + // name AC_DRIFT; it must be rendered as its plain lead, never surfaced raw. + expect(card, 'stop-block line must not surface the raw detector name').not.toContain('AC_DRIFT'); }); const PROMPT_SAMPLES: Readonly> = { diff --git a/tests/plain-render.test.ts b/tests/plain-render.test.ts index 433a61f..1bb0857 100644 --- a/tests/plain-render.test.ts +++ b/tests/plain-render.test.ts @@ -123,6 +123,20 @@ describe('DETECTOR_PLAIN catalog completeness (AC-746969b3)', () => { const actions = names.map((n) => DETECTOR_PLAIN[n].action).filter((a): a is string => Boolean(a)); expect(actions.some((a) => a.includes('clad '))).toBe(true); }); + + // F-ebbb20af AC-0cece94c — the leak that slipped past the action-only scan: + // INVENTORY_DRIFT.lead said "shard files". Scan LEADS too, for the internal + // word "shard" and for any MCP tool name. + test('no lead uses the internal word "shard" or names an MCP tool (and no action says "shard")', () => { + const shardWord = /\bshards?\b/i; + const mcpShapePattern = /\bclad_[a-z_]+/; + for (const name of names) { + const {lead, action} = DETECTOR_PLAIN[name]; + expect(lead, `${name}.lead must not say "shard"`).not.toMatch(shardWord); + expect(lead, `${name}.lead must not name an MCP tool`).not.toMatch(mcpShapePattern); + if (action) expect(action, `${name}.action must not say "shard"`).not.toMatch(shardWord); + } + }); }); // ─── AC-263adf79 — plain lead first, machine detail demoted to a tail ────── diff --git a/tests/serve/init-tools.test.ts b/tests/serve/init-tools.test.ts index fe3c7cd..dadf735 100644 --- a/tests/serve/init-tools.test.ts +++ b/tests/serve/init-tools.test.ts @@ -7,6 +7,7 @@ import {dirname, join} from 'node:path'; import {Client} from '@modelcontextprotocol/sdk/client/index.js'; import {InMemoryTransport} from '@modelcontextprotocol/sdk/inMemory.js'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; +import {parse as parseYaml} from 'yaml'; import {refineOnboarding, resolveOnboardingReview} from '../../src/cli/clarify.js'; import {prepareHostClarify, prepareHostInit, renderHostDraft} from '../../src/cli/host-onboarding.js'; import {runInit} from '../../src/cli/init.js'; @@ -427,6 +428,16 @@ describe('serve/server — natural-language init tools', () => { const conventions = readFileSync(join(dir, 'docs', 'conventions.md'), 'utf8'); expect(conventions).toContain('derived from observed code'); expect(conventions).toContain('## Observed style'); + // Regression: an existing-project adoption with no README `##` headings must still + // persist the host draft's approved capabilities — not land `capabilities: []`. + const capabilitiesBody = readFileSync(join(dir, 'spec', 'capabilities.yaml'), 'utf8'); + expect(capabilitiesBody).not.toContain('capabilities: []'); + const capabilities = (parseYaml(capabilitiesBody) as {capabilities?: Array<{id?: string}>}).capabilities ?? []; + expect(capabilities.length).toBeGreaterThanOrEqual(3); + const capabilityIds = capabilities.map((capability) => capability.id); + for (const id of ['payments', 'audit', 'webhooks']) { + expect(capabilityIds).toContain(id); + } } finally { await cleanup(); } diff --git a/tests/soft-shell-leak-closure.test.ts b/tests/soft-shell-leak-closure.test.ts new file mode 100644 index 0000000..3cda03c --- /dev/null +++ b/tests/soft-shell-leak-closure.test.ts @@ -0,0 +1,106 @@ +// Cladding · F-ebbb20af — Soft Shell leak closure + language-agnostic firing. +// +// Proves the closed leaks stay closed (no "shard"/MCP name in user-facing output +// or generated files; a stop-block renders a plain lead, not a raw detector id) +// and that the behavior-triggered signals fire from one English source regardless +// of the user's language (an all-Korean spec still triggers them). + +import {existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; + +import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'; + +type DriftReport = {pass: boolean; exitCode: number; findings: unknown[]}; +const DRIFT_CLEAN: DriftReport = {pass: true, exitCode: 0, findings: []}; +vi.mock('../src/stages/drift.js', () => ({runDrift: () => DRIFT_CLEAN})); +vi.mock('../src/stages/arch.js', () => ({runArch: () => ({pass: true, exitCode: 0})})); +vi.mock('../src/stages/secret.js', () => ({runSecret: () => ({pass: true, exitCode: 0})})); + +const {DETECTOR_PLAIN, plainLead} = await import('../src/ui/softShell.js'); +const {runDone} = await import('../src/cli/done.js'); +const {enforcementAdvisory} = await import('../src/cli/enforcement-advisory.js'); +const {runInit} = await import('../src/cli/init.js'); +const {runHookEvent} = await import('../src/cli/hook.js'); + +const SHARD = /\bshards?\b/i; +const MCP = /\bclad_[a-z_]+/; +const NUDGE = "recent source edits aren't tracked by any feature"; + +let dir: string; +beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-ssl-')); +}); +afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + vi.clearAllMocks(); +}); + +describe('F-ebbb20af — Soft Shell leak closure', () => { + test('AC-77f0ec75 — the INVENTORY_DRIFT lead says "spec", not "shard"', () => { + expect(DETECTOR_PLAIN.INVENTORY_DRIFT.lead).not.toMatch(SHARD); + expect(DETECTOR_PLAIN.INVENTORY_DRIFT.lead).toContain('spec'); + }); + + test('AC-77f0ec75 — the clad done no-feature refusal says "spec", not "shard"', () => { + writeFileSync(join(dir, 'spec.yaml'), 'schema: "0.1"\nproject: {name: t, language: typescript}\nfeatures: []\n'); + const res = runDone(dir, 'F-nope', {checkStages: () => ({worst: 0})}); + expect(res.ok).toBe(false); + expect(res.reason).not.toMatch(SHARD); + expect(res.reason).toContain('no feature in the spec'); + }); + + test('AC-78c153fa — a stop-block detector renders its plain lead, never the raw id', () => { + expect(plainLead('AC_DRIFT', 'a prior check')).toBe(DETECTOR_PLAIN.AC_DRIFT.lead); + expect(plainLead('AC_DRIFT', 'a prior check')).not.toBe('AC_DRIFT'); + // an unregistered detector falls back to a plain phrase, not the raw token + expect(plainLead('WEIRD_UNREGISTERED', 'a prior check')).toBe('a prior check'); + }); + + test('AC-c7c1c6e1 — the init-generated scenarios README prose names no MCP tool and no "shard"', async () => { + await runInit({cwd: dir}); + const readmePath = join(dir, 'spec', 'scenarios', 'README.md'); + expect(existsSync(readmePath), 'scenarios README should be generated').toBe(true); + const readme = readFileSync(readmePath, 'utf8'); + expect(readme, 'scenarios README').not.toMatch(MCP); + expect(readme, 'scenarios README').not.toMatch(SHARD); + }); + + // ── per-language firing: one English source, triggered by behavior, not words ── + + // NOTE: by design a slug is a machine id (ASCII kebab-case, schema-pinned); + // the human-facing title, project name, and AC text are any language. So the + // realistic Korean project keeps ASCII slugs and Korean everywhere a human reads. + test('AC-408e6838 — the enforcement advisory fires on a spec with Korean title/name/text', () => { + writeFileSync( + join(dir, 'spec.yaml'), + 'schema: "0.1"\nproject: {name: 한글프로젝트, language: typescript}\nfeatures:\n' + + ' - id: F-aaa111\n slug: login\n title: 사용자 로그인 기능\n status: in_progress\n' + + ' modules: [src/login.ts]\n acceptance_criteria:\n' + + ' - id: AC-001\n ears: ubiquitous\n text: 사용자는 로그인할 수 있어야 한다\n', + ); + const out = enforcementAdvisory(dir); + expect(out).toBeTypeOf('string'); // fires despite non-ASCII human content + expect(out).toContain('not yet done'); + }); + + test('AC-408e6838 — the unbound-edit nudge fires on a Korean-named path under a Korean-titled spec', () => { + writeFileSync( + join(dir, 'spec.yaml'), + 'schema: "0.1"\nproject: {name: 프로젝트, language: typescript}\nfeatures:\n' + + ' - id: F-aaa111\n slug: alpha\n title: 알파 기능\n status: done\n' + + ' modules: [src/foo.ts]\n acceptance_criteria:\n' + + ' - id: AC-001\n ears: ubiquitous\n text: t\n', + ); + const editKoreanUnbound = (): string => { + rmSync(join(dir, '.cladding', 'hook-drift-ts'), {force: true}); + return runHookEvent('PostToolUse', { + tool_name: 'Edit', + tool_input: {file_path: 'src/주문처리.ts', old_string: '', new_string: '한'.repeat(60)}, + }, dir); + }; + expect(editKoreanUnbound()).not.toContain(NUDGE); // 1 + expect(editKoreanUnbound()).not.toContain(NUDGE); // 2 + expect(editKoreanUnbound()).toContain(NUDGE); // 3 — fires regardless of language + }); +}); diff --git a/tests/stages/convention-drift.test.ts b/tests/stages/convention-drift.test.ts index 5d50be0..9cf214f 100644 --- a/tests/stages/convention-drift.test.ts +++ b/tests/stages/convention-drift.test.ts @@ -2,8 +2,8 @@ // // Detector under test enforces the "Documentation: Why > What" guardrail // from ironclad-design/13-philosophical-guardrails.md. For every -// features[].modules[] file ending in `.ts`, the first non-empty line -// must begin a comment (line `//` or block `/*`). Missing header → warn. +// features[].modules[] source file for the configured language, the first non-empty line +// must begin a language-appropriate comment or Python docstring. Missing header → warn. // // The detector intentionally: // - skips non-`.ts` modules (yaml, json, md are out of scope) @@ -62,6 +62,40 @@ describe('CONVENTION_DRIFT detector', () => { expect(conventionDrift.run({cwd: dir})).toEqual([]); }); + test.each([ + ['hash comment', '# Why this exists: intent stated up front.\nVALUE = 1\n'], + ['double-quoted module docstring', '"""Why this module exists."""\nVALUE = 1\n'], + ['single-quoted module docstring', "'''Why this module exists.'''\nVALUE = 1\n"], + ])('Python module with a leading %s → no finding', (_label, source) => { + writeFileSync( + join(dir, 'spec.yaml'), + 'schema: "0.1"\nproject: {name: x, language: python}\nfeatures: []\n', + ); + mkdirSync(join(dir, 'backend'), {recursive: true}); + writeFileSync(join(dir, 'backend', 'good.py'), source); + writeFileSync( + join(dir, 'spec', 'features', 'F-001.yaml'), + 'id: F-001\ntitle: t\nstatus: done\nmodules: [backend/good.py]\n', + ); + expect(conventionDrift.run({cwd: dir})).toEqual([]); + }); + + test('Python module without a header comment or docstring → warn finding', () => { + writeFileSync( + join(dir, 'spec.yaml'), + 'schema: "0.1"\nproject: {name: x, language: python}\nfeatures: []\n', + ); + mkdirSync(join(dir, 'backend'), {recursive: true}); + writeFileSync(join(dir, 'backend', 'bare.py'), 'VALUE = 1\n'); + writeFileSync( + join(dir, 'spec', 'features', 'F-001.yaml'), + 'id: F-001\ntitle: t\nstatus: done\nmodules: [backend/bare.py]\n', + ); + const findings = conventionDrift.run({cwd: dir}); + expect(findings).toHaveLength(1); + expect(findings[0].path).toBe('backend/bare.py'); + }); + test('TS module without any header comment → warn finding', () => { writeFileSync(join(dir, 'stages', 'bare.ts'), 'export const x = 1;\n'); writeFileSync( diff --git a/tests/stages/lint-multi-finding.test.ts b/tests/stages/lint-multi-finding.test.ts new file mode 100644 index 0000000..3646b5c --- /dev/null +++ b/tests/stages/lint-multi-finding.test.ts @@ -0,0 +1,76 @@ +// Cladding · F-4643d99d — check-only formatter lint findings. +// +// A check-only formatter (dart format --set-exit-if-changed, dotnet format +// --verify-no-changes) prints one `Changed ` line per dirty file. Those +// don't match the ESLint stylish regex, so the raw-tail fallback used to collapse +// the whole set to a single pathless finding (whack-a-mole). This proves every +// dirty file now surfaces with its path, plus a one-line fix hint. + +import {mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; + +import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'; + +import {parseToolFindings} from '../../src/stages/finding-parser.js'; + +vi.mock('execa', () => ({execaSync: vi.fn()})); +const {runLint} = await import('../../src/stages/lint.js'); +const execaMod = await import('execa'); +const execaSyncMock = execaMod.execaSync as unknown as ReturnType; + +describe('F-4643d99d — check-only formatter lint findings', () => { + test('AC-7b620bf4 — dart `Changed ` lines → one finding per file, each with a path', () => { + const out = [ + 'Changed lib/a.dart', + 'Changed lib/nested/b.dart', + 'Changed test/c_test.dart', + 'Formatted 12 files (3 changed) in 0.40 seconds.', + ].join('\n'); + const findings = parseToolFindings('lint', out, '', 1); + expect(findings).toHaveLength(3); + expect(findings.map((f) => f.path)).toEqual(['lib/a.dart', 'lib/nested/b.dart', 'test/c_test.dart']); + expect(findings.every((f) => f.detector === 'LINT' && f.severity === 'error')).toBe(true); + }); + + test('AC-83a47b38 — an unstructured formatter failure keeps ONE raw-tail synthetic finding', () => { + const findings = parseToolFindings('lint', 'panic: could not run formatter\n at main', '', 1); + expect(findings).toHaveLength(1); + expect(findings[0].detector).toBe('LINT'); + expect(findings[0].path).toBeUndefined(); + expect(findings[0].message).toContain('panic'); + }); + + test('a green stage (exit 0) yields no findings', () => { + expect(parseToolFindings('lint', 'Formatted 5 files (0 changed).', '', 0)).toEqual([]); + }); + + describe('AC-6c16b63e — fix hint on a failing check-only formatter (lint stage)', () => { + let dir: string; + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-lint-mf-')); + writeFileSync(join(dir, 'pubspec.yaml'), 'name: x\nversion: 0.0.0\n'); // plain dart → `dart format` + execaSyncMock.mockReset(); + }); + afterEach(() => rmSync(dir, {recursive: true, force: true})); + + test('dart format failure → hint `dart format .` and every dirty file listed', () => { + execaSyncMock.mockReturnValue({ + exitCode: 1, + stdout: 'Changed lib/a.dart\nChanged lib/b.dart\nFormatted 5 files (2 changed).', + stderr: '', + }); + const r = runLint({cwd: dir}); + expect(r.pass).toBe(false); + expect(r.hint).toBe('dart format .'); + expect(r.findings?.map((f) => f.path)).toEqual(['lib/a.dart', 'lib/b.dart']); + }); + + test('a green dart run → no hint, no findings', () => { + execaSyncMock.mockReturnValue({exitCode: 0, stdout: 'Formatted 5 files (0 changed).', stderr: ''}); + const r = runLint({cwd: dir}); + expect(r.pass).toBe(true); + expect(r.hint).toBeUndefined(); + }); + }); +}); diff --git a/tests/stages/test-run-dedup.test.ts b/tests/stages/test-run-dedup.test.ts index a228fbd..52bbefc 100644 --- a/tests/stages/test-run-dedup.test.ts +++ b/tests/stages/test-run-dedup.test.ts @@ -51,6 +51,13 @@ function vitestProject(prefix: string): string { return dir; } +/** A temp dir that resolves to the Python pytest + coverage.py toolchain. */ +function pytestProject(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + writeFileSync(join(dir, 'pyproject.toml'), '[project]\nname = "x"\nversion = "0.0.0"\n'); + return dir; +} + const CLEAN = {exitCode: 0, stdout: '', stderr: ''}; /** vitest `--reporter=json` document shape (mirrors vacuous-tests.test.ts). */ @@ -289,6 +296,43 @@ describe('AC-9a1c4e21 / AC-3f7e0c94 — primed vitest gate: the suite runs ONCE }); }); +describe('primed pytest gate: Unit and Coverage share one coverage-instrumented run', () => { + let dir: string; + beforeEach(() => { + dir = pytestProject('clad-trd-pytest-'); + primeTestRunCache(dir); + }); + afterEach(() => rmSync(dir, {recursive: true, force: true})); + + test('runUnit then runCov spawn pytest exactly once through coverage.py', () => { + execaSyncMock.mockReturnValueOnce(CLEAN); + const unitResult = runUnit({cwd: dir, strict: true}); + const covResult = runCov({cwd: dir}); + + expect(unitResult.pass).toBe(true); + expect(covResult.pass).toBe(true); + expect(execaSyncMock).toHaveBeenCalledTimes(1); + const [cmd, args] = execaSyncMock.mock.calls[0] as [string, string[]]; + expect(cmd).toBe('coverage'); + expect(args).toEqual(['run', '-m', 'pytest']); + }); + + test('AC-f8e85a99 — a green shared run that collected ZERO tests blocks under --strict (guard not bypassed)', () => { + // coverage.py exits 0 but pytest collected nothing (e.g. an over-narrow selection). + execaSyncMock.mockReturnValueOnce({ + exitCode: 0, + stdout: 'collected 0 items\n\nno tests ran in 0.01s\n', + stderr: '', + }); + const unitResult = runUnit({cwd: dir, strict: true}); + + expect(unitResult.pass).toBe(false); + expect(unitResult.findings?.[0]?.detector).toBe('VACUOUS_TESTS'); + // still one spawn — the guard reads the shared run's own summary, no re-run. + expect(execaSyncMock).toHaveBeenCalledTimes(1); + }); +}); + // ─── AC-8c5a2fb0 (stage level) — a non-green shared run falls back, sound attribution ─── describe('AC-8c5a2fb0 — non-green shared run: unit falls back to its own tests-only run', () => {