diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 99984092..cbb1ced3 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.2", + "version": "0.9.3", "author": { "name": "qwerfunch" }, diff --git a/CHANGELOG.md b/CHANGELOG.md index 01c82a82..4b2041b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,50 @@ 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.3] — The review packet shows how the contract itself moved (2026-08-04) + +**In one line:** a pull request now shows which acceptance criteria were rewritten while the code changed, and the architecture gate stops failing on generated build output. + +### Added + +- **"How the acceptance criteria moved" in `clad report`.** For every feature spec entry the range touched, each criterion is classified new / rewritten / removed / unchanged by matching on its id, alongside the entry's status transition and any EARS pattern shift. Rewriting a requirement to match what you built leaves code and spec agreeing, so no drift check can see it; this is the surface that does. +- **"Declared tests" in `clad report`** — for each criterion, whether the test it names also changed in the range, telling apart a real path that did not change, a concrete path with no file behind it, and a placeholder the harness suggested. It grades nothing: whether a test genuinely verifies its criterion is not mechanically decidable, so the packet shows what was declared and leaves the judgement to the reviewer. The dangling-path case matters because every other existence check in the harness only looks at finished features. +- **The packet names the revision it compared against**, when that is not the commit you named. The range anchors on the merge base of your ref and HEAD, which on a branch that forked earlier is a different commit — an audit artifact that silently compared against something else cannot be reproduced by hand. + +### Fixed + +- **The architecture gate no longer scans generated build output.** A bundler's output legitimately contains mutual imports, so scanning it reported circular dependencies that exist in no hand-written file — and blocked the gate on them. `dist`, `build`, `out`, `coverage`, `target`, `.next`, `.nuxt`, `.output`, `.svelte-kit` and `.vite` are now excluded, matched at the repository root only, so a source directory that merely happens to be named `build/` deeper in the tree is still scanned. `dist`, `coverage` and the framework caches are excluded at any depth, because a monorepo package or a front-end subdirectory keeps its bundle one level down; `build`, `out` and `target` stay anchored at the root, because they name real source directories often enough that excluding them deeper would drop hand-written code from the scan. + + **If your project has its own madge exclusion in force, cladding passes none of its own and your rules are the only ones that apply** — madge replaces its configured exclusions with a command-line flag rather than merging them, so the two cannot coexist. That is decided the way madge decides it: by reading `.madgerc` up the directory tree, plus `$HOME` and `/etc`, and by checking that an exclusion is actually set rather than that a file merely exists. +- **A review range that forked earlier no longer charges the base branch's commits to the range under review.** +- **The packet described itself as four sections when it renders six** — in `clad report --help`, in the module that assembles it, and in the acceptance criterion that enumerates them. The criterion appears as `REWRITTEN` in this release's own packet, which is the correct outcome. +- **A section lead asserted that the code had been changed to match a rewritten criterion.** The population is deliberately status-blind, so the line also sat above entries with no code yet; it is now conditional. +- **A rewritten obligation could pass as unchanged.** The criterion comparison read only the statement, the pattern and the trigger — not `action` and `response`, which state the obligation itself and which four out of five criteria in this project carry. Rewriting one of them classified as no change at all; in this repository's own history that hid 31 rewrites. +- **An instruction the schema rejects.** The `planner` brief asked for an `archive_reason` on a removed acceptance criterion, but that field exists only at feature level and the criterion schema refuses unknown keys — following the instruction failed the sync barrier. +- **A failing scanner said what KIND of problem it found, never which one.** The architecture + stage reported "the code has an import loop" and stopped there, because the code that builds + the message preferred the tool's progress output over its report — madge writes its progress + to one stream and the numbered cycle list to the other — and then cut what survived to two + hundred characters. The gate now shows the list, and the terminal prints the specifics under + the plain sentence instead of replacing them with it. An adopter spent sixteen days on this + and recorded the wrong cause; in a controlled run, three of three agents given the old build + "fixed" it by deleting or rewriting their own build output. +- **Nothing said what language to write a spec entry in.** Four adopter projects diverged on + their own — two reached nearly all Korean titles, two stayed fully English — because the + question was never answered anywhere. The managed AGENTS.md block now answers it: English by + default, but match the entries already in the spec, because those are the project's own voice + and they cannot go stale the way a setting can. Asking for another language covers the title, + the notes and the statement, and carries forward on its own; existing entries are never + rewritten into another language. Only four words are fixed — `when`, `while`, `if`, `where` — + because the gate matches them literally, and only as the FIRST word of a condition, so + `when 앱이 종료될 때` is valid. +- **Nothing shipped to an adopter said how to write an acceptance criterion.** The managed + AGENTS.md block now carries the EARS table — which trigger word each pattern requires, with a + working example per row — and a test asserts every example in it against the real validator, + so the table cannot drift from the rule it teaches. `docs/` is not in the published package, + so agents were reverse-engineering the rules from the minified bundle. +- **Stale and self-contradicting counts across the six READMEs**, where feature and test-file totals disagreed with the spec and, in places, with each other inside the same file. + ## [0.9.2] — Completions record whether anything checked them independently (2026-07-26) **In one line:** every finished feature is now marked `independent` or `self-certified` from the evidence it actually recorded, and cladding stops prescribing how you arrange your agents. diff --git a/README.html b/README.html index d4ec8110..1a91d7f2 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -271,7 +271,7 @@

cladding

- cladding builds itself with cladding too — 266 of its 270 features cleared this same gate, the first L4 implementation of the Ironclad standard. + cladding builds itself with cladding too — 269 of its 273 features cleared this same gate, the first L4 implementation of the Ironclad standard.

@@ -556,7 +556,7 @@

Status

version
-
v0.9.2
+
v0.9.3
2026-07
@@ -566,7 +566,7 @@

Status

tests
-
2736/2736
+
2815/2815
all pass
@@ -576,13 +576,13 @@

Status

features
-
270
-
266 done · self-spec
+
273
+
269 done · self-spec
-

248 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector

+

249 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector

Road to Ironclad 1.0 — 1.0 locks only when two independent implementations pass the L4 conformance fixtures (GOVERNANCE § 1). cladding is the first.
diff --git a/README.ja.md b/README.ja.md index c9f552db..13fb81ce 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -31,7 +31,7 @@ - **たどれる** — **出荷されたものは記録に残る**: 何を検証したかはコミットされた内容に刻まれ、誰がいつやったかはローカルのセッション台帳に、なぜかは spec に残る — だから引き継ぎもレビューも、掘り起こさずに済む。 - **拡張しても揺るがない** — 人と AI が増えれば、普通は衝突と乖離も増える。だが全員が一つの spec を基準に働くので、それらは自動でせき止められる — だから規模を広げても崩れない。 -cladding は **自分自身も cladding で作っている** — 270 個の feature のうち 266 個が同じゲートを通過した、[Ironclad](https://github.com/qwerfunch/ironclad) 標準を L4 で実装した最初の事例だ。 +cladding は **自分自身も cladding で作っている** — 273 個の feature のうち 269 個が同じゲートを通過した、[Ironclad](https://github.com/qwerfunch/ironclad) 標準を L4 で実装した最初の事例だ。 @@ -347,9 +347,9 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2736 / 2736 | 15 段階 · 41 detectors | 270(266 done) | +| v0.9.3(2026-08) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 | 15 段階 · 41 detectors | 273(269 done) | -248 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック +249 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック > **Ironclad 1.0 への道** — 1.0 は *独立した二つの実装が L4 準拠フィクスチャを通過してはじめて* 確定する([GOVERNANCE § 1](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md))。cladding はその一つ目だ。 diff --git a/README.ko.html b/README.ko.html index cec6e50a..a99bc012 100644 --- a/README.ko.html +++ b/README.ko.html @@ -277,7 +277,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -304,7 +304,7 @@

cladding

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

@@ -590,7 +590,7 @@

Status

version
-
v0.9.2
+
v0.9.3
2026-07
@@ -600,7 +600,7 @@

Status

tests
-
2736/2736
+
2815/2815
all pass
@@ -610,13 +610,13 @@

Status

features
-
270
-
266 done · 자기 스펙
+
273
+
269 done · 자기 스펙
-

248 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단

+

249 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단

Ironclad 1.0까지의 길 — 1.0은 독립적인 두 개의 구현이 L4 검증 셋을 통과해야 잠긴다 (GOVERNANCE § 1). cladding이 첫 번째.
diff --git a/README.ko.md b/README.ko.md index b21ce565..bbfa7ee1 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -31,7 +31,7 @@ - **추적** — **나간 것은 기록에 남는다**: 무엇을 검증했는지는 커밋된 내용에 새겨지고, 누가·언제는 로컬 세션 로그에, 왜는 스펙에 남아, 인수인계와 리뷰가 파헤치지 않아도 된다. - **확장** — 사람과 AI를 늘리면 보통 충돌과 어긋남도 함께 불어난다. 하지만 모두가 스펙 하나를 기준으로 일하니 그게 자동으로 걸린다 — 그래서 규모를 키워도 무너지지 않는다. -cladding은 **자기 자신도 cladding으로 만든다** — 기능 270개 중 266개가 같은 게이트를 통과했고, [Ironclad](https://github.com/qwerfunch/ironclad) 표준을 L4로 구현한 첫 사례다. +cladding은 **자기 자신도 cladding으로 만든다** — 기능 273개 중 269개가 같은 게이트를 통과했고, [Ironclad](https://github.com/qwerfunch/ironclad) 표준을 L4로 구현한 첫 사례다. @@ -346,9 +346,9 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2736 / 2736 · all pass | 15 단계 · 41 detectors | 270 · 266 done · 자기 스펙 | +| v0.9.3 · 2026-08 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | -248 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 +249 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 > **Ironclad 1.0까지의 길** — 1.0은 *독립적인 두 개의 구현이 L4 검증 셋을 통과해야* 잠긴다 ([GOVERNANCE § 1](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md)). cladding이 첫 번째. diff --git a/README.md b/README.md index 37c5b8d1..48df0442 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -31,7 +31,7 @@ So you can ship AI-written code held to **the same standard as human-written cod - **Traced** — **What shipped is on the record**: what was verified is stamped into committed content, who and when land in the local session ledger, and the why lives in the spec — so handoff and review skip the archaeology. - **Scales** — adding people and AIs would normally multiply conflicts and drift; because everyone works from one shared spec, those get caught automatically — so you can grow without it breaking down. -cladding builds **itself** with cladding too — 266 of its 270 features cleared this same gate, the first L4 implementation of the [Ironclad](https://github.com/qwerfunch/ironclad) standard. +cladding builds **itself** with cladding too — 269 of its 273 features cleared this same gate, the first L4 implementation of the [Ironclad](https://github.com/qwerfunch/ironclad) standard. @@ -360,9 +360,9 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2736 / 2736 | 15 stages · 41 detectors | 270 (266 done) | +| v0.9.3 (2026-08) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 | 15 stages · 41 detectors | 273 (269 done) | -248 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector +249 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector > **Road to Ironclad 1.0** — 1.0 locks only when *two independent implementations pass the L4 conformance fixtures* ([GOVERNANCE § 1](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md)). cladding is the first. diff --git a/README.zh.md b/README.zh.md index b8533d80..ff68b5df 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -31,7 +31,7 @@ - **可追溯** —— **交付出去的一切都留有记录**:验证了什么,写进已提交的内容;谁、何时,记在本地会话账本;为什么,留在 spec —— 于是交接与评审无需考古,就能追溯每一个决定。 - **可扩展** —— 人和 AI 越多,通常冲突和漂移也越多。但所有人都以同一份 spec 为基准,这些会被自动挡下 —— 所以不断扩张也不会崩。 -cladding 连**自己**也是用 cladding 造的 —— 270 个 feature 里有 266 个通过了同一道门禁,成为 [Ironclad](https://github.com/qwerfunch/ironclad) 标准的首个 L4 实现。 +cladding 连**自己**也是用 cladding 造的 —— 273 个 feature 里有 269 个通过了同一道门禁,成为 [Ironclad](https://github.com/qwerfunch/ironclad) 标准的首个 L4 实现。 @@ -343,9 +343,9 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2736 / 2736 | 15 阶段 · 41 检测器 | 270(266 done) | +| v0.9.3(2026-08) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 | 15 阶段 · 41 检测器 | 273(269 done) | -248 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 +249 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 > **通往 Ironclad 1.0 之路** —— 只有当*两个独立实现都通过 L4 一致性测试夹具*时,1.0 才会锁定([GOVERNANCE § 1](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md))。cladding 是第一个。 diff --git a/docs/gate-scope.md b/docs/gate-scope.md index e145ec00..8c347bc3 100644 --- a/docs/gate-scope.md +++ b/docs/gate-scope.md @@ -110,6 +110,21 @@ gate: Precedence, highest first: explicit per-call `cmd` override → `gate.commands` → auto module-scope → repo gate. +## Architecture stage — what it scans in a TS/JS project + +The circular-dependency scan runs from the repository root and **skips generated +build output** — `dist/`, `build/`, `out/`, `coverage/`, `target/`, `.next/`, +`.nuxt/`, `.output/`, `.svelte-kit/`, `.vite/` — matched at the root only, so a +source directory that merely happens to be named `build/` deeper in the tree is +still scanned. A bundler's output legitimately contains mutual imports, and +scanning it reports cycles that exist in no hand-written file. + +**To control this yourself**, declare a `.madgerc` (or a `madge` block in +`package.json`) with your own `excludeRegExp`. When you do, cladding passes no +exclusion of its own and your rules are the only ones in force — madge *replaces* +its configured exclusions with a command-line flag rather than merging them, so +the two cannot coexist. + ## Backward compatibility Non-Gradle languages, modules-less features, and `gate.scope: repo` all run diff --git a/docs/glossary.md b/docs/glossary.md index 91bff1a7..5aca0da2 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -70,7 +70,7 @@ | `graph` | stable (0.7.0) | Render the spec↔code↔doc knowledge graph: `export` → mermaid/dot/json/Obsidian-vault or a self-contained offline `html` viewer (WebGL, three.js bundled); `serve` → the same viewer live on localhost, auto-reloading as spec/docs change; `stats` → counts + hubs. | 지식 그래프 | | `hook` | stable (0.6.0) | Host hook protocol adapter — consumes one host lifecycle event (SessionStart / UserPromptSubmit / PreToolUse / PostToolUse / Stop) as stdin JSON; always exits 0. Honest limit: PreToolUse blocking only sees Edit/Write tool calls — a YAML edit made through Bash bypasses lane one; the Stop hook's post-hoc detectors are lane two. Neither lane alone is the guarantee. | 호스트 훅 프로토콜 어댑터 | | `changelog` | stable (0.6.0) | Render shipped changes since a git ref into human-facing documents — capability-grouped markdown / `--json` manifest / `--audit` verification table / `--catalog` spec listing. Named `changelog` deliberately, NOT `digest` (which means cryptographic hash in this domain — see Naming conventions). | 변경 이력 렌더링 | -| `report` | stable (0.8.0) | Render one deterministic review packet for a git range — spec-shard movement (from `changelog`), changed source files resolved to their owning features via the reverse index, the deduped regression set, and gate + attestation state. `--format md \| sarif \| json`. For PR reviewers/team-leads/auditors: it RENDERS, it gates nothing. | 리뷰 패킷 렌더링 | +| `report` | stable (0.8.0) | Render one deterministic review packet for a git range — spec entry movement (from `changelog`), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. `--format md \| sarif \| json`. For PR reviewers/team-leads/auditors: it RENDERS, it gates nothing. | 리뷰 패킷 렌더링 | | `bundle` | stable (0.8.0) | Write ONE self-contained offline HTML audit bundle (`--out [--since ]`) a non-coder can double-click — provenance banner, project header + inventory, feature × stage matrix, capability catalog, shipped changes, audit table, attestation summary. Zero network, no scripts. Deterministic modulo the date stamp; a range that cannot be anchored degrades the changelog + audit sections to a notice while the rest still renders. | 감사 번들 | > **Internal name — the drive loop.** The `run` verb's loop is internally the diff --git a/package-lock.json b/package-lock.json index 2495dd1c..75f0bdaf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cladding", - "version": "0.9.2", + "version": "0.9.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cladding", - "version": "0.9.2", + "version": "0.9.3", "license": "MIT", "dependencies": { "@anthropic-ai/sdk": "^0.96.0", diff --git a/package.json b/package.json index afb136d5..a0834f37 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.2", + "version": "0.9.3", "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/planner/SKILL.md b/plugins/antigravity/skills/planner/SKILL.md index 74a4755f..f3cacac9 100644 --- a/plugins/antigravity/skills/planner/SKILL.md +++ b/plugins/antigravity/skills/planner/SKILL.md @@ -52,7 +52,7 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read ## What you don't do - You do not write production code or tests (`developer` does). - You do not pass philosophical judgement (`reviewer` does). -- You do not silently drop ACs — every removal needs an `archive_reason`. +- You do not silently drop ACs — say why in the criterion's `notes` first. ## EARS reminder diff --git a/plugins/claude-code/.claude-plugin/plugin.json b/plugins/claude-code/.claude-plugin/plugin.json index 48f15822..ff06fc9a 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.2", + "version": "0.9.3", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Claude Code.", "author": { "name": "qwerfunch" diff --git a/plugins/claude-code/agents/planner.md b/plugins/claude-code/agents/planner.md index 74a4755f..f3cacac9 100644 --- a/plugins/claude-code/agents/planner.md +++ b/plugins/claude-code/agents/planner.md @@ -52,7 +52,7 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read ## What you don't do - You do not write production code or tests (`developer` does). - You do not pass philosophical judgement (`reviewer` does). -- You do not silently drop ACs — every removal needs an `archive_reason`. +- You do not silently drop ACs — say why in the criterion's `notes` first. ## EARS reminder diff --git a/plugins/claude-code/dist/agents/planner.md b/plugins/claude-code/dist/agents/planner.md index 74a4755f..f3cacac9 100644 --- a/plugins/claude-code/dist/agents/planner.md +++ b/plugins/claude-code/dist/agents/planner.md @@ -52,7 +52,7 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read ## What you don't do - You do not write production code or tests (`developer` does). - You do not pass philosophical judgement (`reviewer` does). -- You do not silently drop ACs — every removal needs an `archive_reason`. +- You do not silently drop ACs — say why in the criterion's `notes` first. ## EARS reminder diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index b34f9083..5b5522e8 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 Ude=Object.create;var EA=Object.defineProperty;var qde=Object.getOwnPropertyDescriptor;var Bde=Object.getOwnPropertyNames;var Hde=Object.getPrototypeOf,Gde=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),Cr=(t,e)=>{for(var r in e)EA(t,r,{get:e[r],enumerable:!0})},Zde=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Bde(e))!Gde.call(t,i)&&i!==r&&EA(t,i,{get:()=>e[i],enumerable:!(n=qde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Ude(Hde(t)):{},Zde(e||!t||!t.__esModule?EA(r,"default",{value:t,enumerable:!0}):r,t));var of=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:Vde}=of(),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 Vde(`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 Wde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}RA.Argument=OA;RA.humanReadableArgName=Wde});var CA=v(PA=>{var{humanReadableArgName:Kde}=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=>Kde(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 d4(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),Dr=(t,e)=>{for(var r in e)PA(t,r,{get:e[r],enumerable:!0})},rfe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Qde(e))!tfe.call(t,i)&&i!==r&&PA(t,i,{get:()=>e[i],enumerable:!(n=Xde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Yde(efe(t)):{},rfe(e||!t||!t.__esModule?PA(r,"default",{value:t,enumerable:!0}):r,t));var lf=v(DA=>{var ky=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}},CA=class extends ky{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};DA.CommanderError=ky;DA.InvalidArgumentError=CA});var Ey=v(jA=>{var{InvalidArgumentError:nfe}=lf(),NA=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 nfe(`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 ife(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}jA.Argument=NA;jA.humanReadableArgName=ife});var LA=v(FA=>{var{humanReadableArgName:ofe}=Ey(),MA=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=>ofe(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 _4(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 d4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}PA.Help=IA;PA.stripColor=d4});var MA=v(jA=>{var{InvalidArgumentError:Jde}=of(),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=Yde(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 Jde(`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?f4(this.name().replace(/^no-/,"")):f4(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 f4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Yde(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 _4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}FA.Help=MA;FA.stripColor=_4});var BA=v(qA=>{var{InvalidArgumentError:sfe}=lf(),zA=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=afe(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 sfe(`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?b4(this.name().replace(/^no-/,"")):b4(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}},UA=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 b4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function afe(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}}jA.Option=DA;jA.DualOptions=NA});var m4=v(p4=>{function Xde(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=Xde(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}}qA.Option=zA;qA.DualOptions=UA});var S4=v(v4=>{function cfe(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 lfe(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=cfe(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]}?)`:""}p4.suggestSimilar=Qde});var _4=v(qA=>{var efe=Ge("node:events").EventEmitter,FA=Ge("node:child_process"),fo=Ge("node:path"),Sy=Ge("node:fs"),Be=Ge("node:process"),{Argument:tfe,humanReadableArgName:rfe}=vy(),{CommanderError:LA}=of(),{Help:nfe,stripColor:ife}=CA(),{Option:h4,DualOptions:ofe}=MA(),{suggestSimilar:g4}=m4(),zA=class t extends efe{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=>ife(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 nfe,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 tfe(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 h4(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 h4)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 +(Did you mean ${n[0]}?)`:""}v4.suggestSimilar=lfe});var k4=v(WA=>{var ufe=Ge("node:events").EventEmitter,HA=Ge("node:child_process"),po=Ge("node:path"),Ay=Ge("node:fs"),Be=Ge("node:process"),{Argument:dfe,humanReadableArgName:ffe}=Ey(),{CommanderError:GA}=lf(),{Help:pfe,stripColor:mfe}=LA(),{Option:w4,DualOptions:hfe}=BA(),{suggestSimilar:x4}=S4(),ZA=class t extends ufe{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:()=>VA()??(Be.stdout.isTTY&&Be.stdout.hasColors?.()),getErrHasColors:()=>VA()??(Be.stderr.isTTY&&Be.stderr.hasColors?.()),stripColor:r=>mfe(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 pfe,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 dfe(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 GA(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 w4(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 w4)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(Ay.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=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=y4(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=y4(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} + - ${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=po.resolve(u,d);if(Ay.existsSync(f))return f;if(i.includes(po.extname(d)))return;let p=i.find(m=>Ay.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=Ay.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=po.resolve(po.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=po.basename(this._scriptPath,po.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(po.extname(s));let c;Be.platform!=="win32"?n?(r.unshift(s),r=$4(Be.execArgv).concat(r),c=HA.spawn(Be.argv[0],r,{stdio:"inherit"})):c=HA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=$4(Be.execArgv).concat(r),c=HA.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 GA(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 GA(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 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 ofe(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=g4(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=g4(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=>rfe(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. +`),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 hfe(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=x4(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=x4(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=>ffe(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=po.basename(e,po.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 y4(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 w4=v(An=>{var{Argument:b4}=vy(),{Command:BA}=_4(),{CommanderError:sfe,InvalidArgumentError:v4}=of(),{Help:afe}=CA(),{Option:S4}=MA();An.program=new BA;An.createCommand=t=>new BA(t);An.createOption=(t,e)=>new S4(t,e);An.createArgument=(t,e)=>new b4(t,e);An.Command=BA;An.Option=S4;An.Argument=b4;An.Help=afe;An.CommanderError=sfe;An.InvalidArgumentError=v4;An.InvalidOptionArgumentError=v4});var De=v(Qt=>{"use strict";var GA=Symbol.for("yaml.alias"),E4=Symbol.for("yaml.document"),wy=Symbol.for("yaml.map"),A4=Symbol.for("yaml.pair"),ZA=Symbol.for("yaml.scalar"),xy=Symbol.for("yaml.seq"),po=Symbol.for("yaml.node.type"),pfe=t=>!!t&&typeof t=="object"&&t[po]===GA,mfe=t=>!!t&&typeof t=="object"&&t[po]===E4,hfe=t=>!!t&&typeof t=="object"&&t[po]===wy,gfe=t=>!!t&&typeof t=="object"&&t[po]===A4,T4=t=>!!t&&typeof t=="object"&&t[po]===ZA,yfe=t=>!!t&&typeof t=="object"&&t[po]===xy;function O4(t){if(t&&typeof t=="object")switch(t[po]){case wy:case xy:return!0}return!1}function _fe(t){if(t&&typeof t=="object")switch(t[po]){case GA:case wy:case ZA:case xy:return!0}return!1}var bfe=t=>(T4(t)||O4(t))&&!!t.anchor;Qt.ALIAS=GA;Qt.DOC=E4;Qt.MAP=wy;Qt.NODE_TYPE=po;Qt.PAIR=A4;Qt.SCALAR=ZA;Qt.SEQ=xy;Qt.hasAnchor=bfe;Qt.isAlias=pfe;Qt.isCollection=O4;Qt.isDocument=mfe;Qt.isMap=hfe;Qt.isNode=_fe;Qt.isPair=gfe;Qt.isScalar=T4;Qt.isSeq=yfe});var sf=v(VA=>{"use strict";var Ut=De(),Dr=Symbol("break visit"),R4=Symbol("skip children"),Ai=Symbol("remove node");function $y(t,e){let r=I4(e);Ut.isDocument(t)?Qc(null,t.contents,r,Object.freeze([t]))===Ai&&(t.contents=null):Qc(null,t,r,Object.freeze([]))}$y.BREAK=Dr;$y.SKIP=R4;$y.REMOVE=Ai;function Qc(t,e,r,n){let i=P4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return C4(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 D4=De(),vfe=sf(),Sfe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},wfe=t=>t.replace(/[!,[\]{}]/g,e=>Sfe[e]),af=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+wfe(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&&D4.isNode(e.contents)){let o={};vfe.visit(e.contents,(s,a)=>{D4.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(` -`)}};af.defaultYaml={explicit:!1,version:"1.2"};af.defaultTags={"!!":"tag:yaml.org,2002:"};N4.Directives=af});var Ey=v(cf=>{"use strict";var j4=De(),xfe=sf();function $fe(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 M4(t){let e=new Set;return xfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function F4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function kfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=M4(t));let s=F4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(j4.isScalar(s.node)||j4.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}}cf.anchorIsValid=$fe;cf.anchorNames=M4;cf.createNodeAnchors=kfe;cf.findNewAnchor=F4});var KA=v(L4=>{"use strict";function lf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Efe=De();function z4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>z4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Efe.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}U4.toJS=z4});var Ay=v(B4=>{"use strict";var Afe=KA(),q4=De(),Tfe=Zo(),JA=class{constructor(e){Object.defineProperty(this,q4.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(!q4.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=Tfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Afe.applyReviver(o,{"":a},"",a):a}};B4.NodeBase=JA});var uf=v(H4=>{"use strict";var Ofe=Ey(),Rfe=sf(),tl=De(),Ife=Ay(),Pfe=Zo(),YA=class extends Ife.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=[],Rfe.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||(Pfe.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(Ofe.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}H4.Alias=YA});var Dt=v(XA=>{"use strict";var Cfe=De(),Dfe=Ay(),Nfe=Zo(),jfe=t=>!t||typeof t!="function"&&typeof t!="object",Vo=class extends Dfe.NodeBase{constructor(e){super(Cfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Nfe.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=jfe});var df=v(Z4=>{"use strict";var Mfe=uf(),da=De(),G4=Dt(),Ffe="tag:yaml.org,2002:";function Lfe(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 zfe(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 Mfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Ffe+e.slice(2));let l=Lfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new G4.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 G4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Z4.createNode=zfe});var Ry=v(Oy=>{"use strict";var Ufe=df(),Ti=De(),qfe=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 Ufe.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 V4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,eT=class extends qfe.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(V4(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=V4});var ff=v(Iy=>{"use strict";var Bfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function tT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Hfe=(t,e,r)=>t.endsWith(` -`)?tT(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 $4(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 VA(){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}WA.Command=ZA;WA.useColor=VA});var O4=v(Tn=>{var{Argument:E4}=Ey(),{Command:KA}=k4(),{CommanderError:gfe,InvalidArgumentError:A4}=lf(),{Help:yfe}=LA(),{Option:T4}=BA();Tn.program=new KA;Tn.createCommand=t=>new KA(t);Tn.createOption=(t,e)=>new T4(t,e);Tn.createArgument=(t,e)=>new E4(t,e);Tn.Command=KA;Tn.Option=T4;Tn.Argument=E4;Tn.Help=yfe;Tn.CommanderError=gfe;Tn.InvalidArgumentError=A4;Tn.InvalidOptionArgumentError=A4});var De=v(Qt=>{"use strict";var YA=Symbol.for("yaml.alias"),C4=Symbol.for("yaml.document"),Ty=Symbol.for("yaml.map"),D4=Symbol.for("yaml.pair"),XA=Symbol.for("yaml.scalar"),Oy=Symbol.for("yaml.seq"),mo=Symbol.for("yaml.node.type"),xfe=t=>!!t&&typeof t=="object"&&t[mo]===YA,$fe=t=>!!t&&typeof t=="object"&&t[mo]===C4,kfe=t=>!!t&&typeof t=="object"&&t[mo]===Ty,Efe=t=>!!t&&typeof t=="object"&&t[mo]===D4,N4=t=>!!t&&typeof t=="object"&&t[mo]===XA,Afe=t=>!!t&&typeof t=="object"&&t[mo]===Oy;function j4(t){if(t&&typeof t=="object")switch(t[mo]){case Ty:case Oy:return!0}return!1}function Tfe(t){if(t&&typeof t=="object")switch(t[mo]){case YA:case Ty:case XA:case Oy:return!0}return!1}var Ofe=t=>(N4(t)||j4(t))&&!!t.anchor;Qt.ALIAS=YA;Qt.DOC=C4;Qt.MAP=Ty;Qt.NODE_TYPE=mo;Qt.PAIR=D4;Qt.SCALAR=XA;Qt.SEQ=Oy;Qt.hasAnchor=Ofe;Qt.isAlias=xfe;Qt.isCollection=j4;Qt.isDocument=$fe;Qt.isMap=kfe;Qt.isNode=Tfe;Qt.isPair=Efe;Qt.isScalar=N4;Qt.isSeq=Afe});var uf=v(QA=>{"use strict";var Ut=De(),Nr=Symbol("break visit"),M4=Symbol("skip children"),Ti=Symbol("remove node");function Ry(t,e){let r=F4(e);Ut.isDocument(t)?tl(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):tl(null,t,r,Object.freeze([]))}Ry.BREAK=Nr;Ry.SKIP=M4;Ry.REMOVE=Ti;function tl(t,e,r,n){let i=L4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return z4(t,n,i),tl(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 U4=De(),Rfe=uf(),Ife={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Pfe=t=>t.replace(/[!,[\]{}]/g,e=>Ife[e]),df=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+Pfe(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&&U4.isNode(e.contents)){let o={};Rfe.visit(e.contents,(s,a)=>{U4.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(` +`)}};df.defaultYaml={explicit:!1,version:"1.2"};df.defaultTags={"!!":"tag:yaml.org,2002:"};q4.Directives=df});var Py=v(ff=>{"use strict";var B4=De(),Cfe=uf();function Dfe(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 H4(t){let e=new Set;return Cfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function G4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Nfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=H4(t));let s=G4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(B4.isScalar(s.node)||B4.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}}ff.anchorIsValid=Dfe;ff.anchorNames=H4;ff.createNodeAnchors=Nfe;ff.findNewAnchor=G4});var tT=v(Z4=>{"use strict";function pf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var jfe=De();function V4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>V4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!jfe.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}W4.toJS=V4});var Cy=v(J4=>{"use strict";var Mfe=tT(),K4=De(),Ffe=Vo(),rT=class{constructor(e){Object.defineProperty(this,K4.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(!K4.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=Ffe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Mfe.applyReviver(o,{"":a},"",a):a}};J4.NodeBase=rT});var mf=v(Y4=>{"use strict";var Lfe=Py(),zfe=uf(),nl=De(),Ufe=Cy(),qfe=Vo(),nT=class extends Ufe.NodeBase{constructor(e){super(nl.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=[],zfe.visit(e,{Node:(o,s)=>{(nl.isAlias(s)||nl.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||(qfe.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=Dy(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(Lfe.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 Dy(t,e,r){if(nl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(nl.isCollection(e)){let n=0;for(let i of e.items){let o=Dy(t,i,r);o>n&&(n=o)}return n}else if(nl.isPair(e)){let n=Dy(t,e.key,r),i=Dy(t,e.value,r);return Math.max(n,i)}return 1}Y4.Alias=nT});var Dt=v(iT=>{"use strict";var Bfe=De(),Hfe=Cy(),Gfe=Vo(),Zfe=t=>!t||typeof t!="function"&&typeof t!="object",Wo=class extends Hfe.NodeBase{constructor(e){super(Bfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Gfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Wo.BLOCK_FOLDED="BLOCK_FOLDED";Wo.BLOCK_LITERAL="BLOCK_LITERAL";Wo.PLAIN="PLAIN";Wo.QUOTE_DOUBLE="QUOTE_DOUBLE";Wo.QUOTE_SINGLE="QUOTE_SINGLE";iT.Scalar=Wo;iT.isScalarValue=Zfe});var hf=v(Q4=>{"use strict";var Vfe=mf(),fa=De(),X4=Dt(),Wfe="tag:yaml.org,2002:";function Kfe(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 Jfe(t,e,r){if(fa.isDocument(t)&&(t=t.contents),fa.isNode(t))return t;if(fa.isPair(t)){let d=r.schema[fa.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 Vfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Wfe+e.slice(2));let l=Kfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new X4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[fa.MAP]:Symbol.iterator in Object(t)?s[fa.SEQ]:s[fa.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 X4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Q4.createNode=Jfe});var jy=v(Ny=>{"use strict";var Yfe=hf(),Oi=De(),Xfe=Cy();function oT(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 Yfe.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 e6=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,sT=class extends Xfe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Oi.isNode(n)||Oi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(e6(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Oi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,oT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Oi.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Oi.isScalar(o)?o.value:o:Oi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Oi.isPair(r))return!1;let n=r.value;return n==null||e&&Oi.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Oi.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Oi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,oT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Ny.Collection=sT;Ny.collectionFromPath=oT;Ny.isEmptyPath=e6});var gf=v(My=>{"use strict";var Qfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function aT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var epe=(t,e,r)=>t.endsWith(` +`)?aT(r,e):r.includes(` `)?` -`+tT(r,e):(t.endsWith(" ")?"":" ")+r;Iy.indentComment=tT;Iy.lineComment=Hfe;Iy.stringifyComment=Bfe});var K4=v(pf=>{"use strict";var Gfe="flow",rT="block",Py="quoted";function Zfe(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=W4(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=W4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+aT(r,e):(t.endsWith(" ")?"":" ")+r;My.indentComment=aT;My.lineComment=epe;My.stringifyComment=Qfe});var r6=v(yf=>{"use strict";var tpe="flow",cT="block",Fy="quoted";function rpe(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===cT&&(h=t6(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Fy&&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===cT&&(h=t6(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===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 Jn=Dt(),Wo=K4(),Dy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ny=t=>/^(%|---|\.\.\.)/m.test(t);function Vfe(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 mf(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=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Fy){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 Yn=Dt(),Ko=r6(),zy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Uy=t=>/^(%|---|\.\.\.)/m.test(t);function npe(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 _f(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Uy(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(iT,`$&${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=zy(n,!0);s!=="folded"&&e!==Yn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let A=Ko.foldFlowLines(`${_}${w}${p}`,l,Ko.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function Wfe(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!==Jn.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 Kfe(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!==Jn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Jn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Jn.Scalar.BLOCK_FOLDED:case Jn.Scalar.BLOCK_LITERAL:return i||o?rl(s.value,e):Cy(s,e,r,n);case Jn.Scalar.QUOTE_DOUBLE:return mf(s.value,e);case Jn.Scalar.QUOTE_SINGLE:return nT(s.value,e);case Jn.Scalar.PLAIN:return Wfe(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}J4.stringifyString=Kfe});var gf=v(oT=>{"use strict";var Jfe=Ey(),Ko=De(),Yfe=ff(),Xfe=hf();function Qfe(t,e){let r=Object.assign({blockQuote:!0,commentString:Yfe.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 epe(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 tpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Ko.isScalar(t)||Ko.isCollection(t))&&t.anchor;o&&Jfe.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 rpe(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=epe(e.doc.schema.tags,o));let s=tpe(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)?Xfe.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=Qfe;oT.stringify=rpe});var e6=v(Q4=>{"use strict";var mo=De(),Y4=Dt(),X4=gf(),yf=ff();function npe({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===Y4.Scalar.BLOCK_FOLDED||t.type===Y4.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=X4.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+=yf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=yf.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=yf.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=X4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +${l}${_}${r}${p}`}function ipe(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 il(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?il(o,e):Ly(t,e,r,n);if(!a&&!u&&i!==Yn.Scalar.PLAIN&&o.includes(` +`))return Ly(t,e,r,n);if(Uy(o)){if(c==="")return e.forceBlockIndent=!0,Ly(t,e,r,n);if(a&&c===l)return il(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 il(o,e)}return a?d:Ko.foldFlowLines(d,c,Ko.FOLD_FLOW,zy(e,!1))}function ope(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!==Yn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Yn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Yn.Scalar.BLOCK_FOLDED:case Yn.Scalar.BLOCK_LITERAL:return i||o?il(s.value,e):Ly(s,e,r,n);case Yn.Scalar.QUOTE_DOUBLE:return _f(s.value,e);case Yn.Scalar.QUOTE_SINGLE:return lT(s.value,e);case Yn.Scalar.PLAIN:return ipe(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}n6.stringifyString=ope});var vf=v(dT=>{"use strict";var spe=Py(),Jo=De(),ape=gf(),cpe=bf();function lpe(t,e){let r=Object.assign({blockQuote:!0,commentString:ape.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 upe(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(Jo.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 dpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Jo.isScalar(t)||Jo.isCollection(t))&&t.anchor;o&&spe.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 fpe(t,e,r,n){if(Jo.isPair(t))return t.toString(e,r,n);if(Jo.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=Jo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=upe(e.doc.schema.tags,o));let s=dpe(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):Jo.isScalar(o)?cpe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Jo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}dT.createStringifyContext=lpe;dT.stringify=fpe});var a6=v(s6=>{"use strict";var ho=De(),i6=Dt(),o6=vf(),Sf=gf();function ppe({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=ho.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(ho.isCollection(t)||!ho.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||ho.isCollection(t)||(ho.isScalar(t)?t.type===i6.Scalar.BLOCK_FOLDED||t.type===i6.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=o6.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+=Sf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Sf.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=Sf.lineComment(g,r.indent,l(f))));let b,_,S;ho.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&&ho.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&ho.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=o6.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let T=l(_);O+=` -${yf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` +${Sf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` `):O+=` -${r.indent}`}else if(!p&&mo.isCollection(e)){let T=w[0],A=w.indexOf(` +${r.indent}`}else if(!p&&ho.isCollection(e)){let T=w[0],A=w.indexOf(` `),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let re=!1;if(D&&(T==="&"||T==="!")){let K=w.indexOf(" ");T==="&"&&K!==-1&&K{"use strict";var t6=Ge("process");function ipe(t,...e){t==="debug"&&console.log(...e)}function ope(t,e){(t==="debug"||t==="warn")&&(typeof t6.emitWarning=="function"?t6.emitWarning(e):console.warn(e))}sT.debug=ipe;sT.warn=ope});var zy=v(Ly=>{"use strict";var Fy=De(),r6=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 r6.Scalar(Symbol(jy)),{addToJSMap:n6}),stringify:()=>jy},spe=(t,e)=>(My.identify(e)||Fy.isScalar(e)&&(!e.type||e.type===r6.Scalar.PLAIN)&&My.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===My.tag&&r.default);function n6(t,e,r){let n=i6(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=i6(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 i6(t,e){return t&&Fy.isAlias(e)?e.resolve(t.doc,t):e}Ly.addMergeToJSMap=n6;Ly.isMergeKey=spe;Ly.merge=My});var uT=v(a6=>{"use strict";var ape=aT(),o6=zy(),cpe=gf(),s6=De(),lT=Zo();function lpe(t,e,{key:r,value:n}){if(s6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(o6.isMergeKey(t,r))o6.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=upe(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 upe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(s6.isNode(t)&&r?.doc){let n=cpe.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)+'..."'),ape.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)}a6.addPairToJSMap=lpe});var Jo=v(dT=>{"use strict";var c6=df(),dpe=e6(),fpe=uT(),Uy=De();function ppe(t,e,r){let n=c6.createNode(t,void 0,r),i=c6.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 fpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?dpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};dT.Pair=qy;dT.createPair=ppe});var fT=v(u6=>{"use strict";var fa=De(),l6=gf(),By=ff();function mpe(t,e,r){return(e.inFlow??t.flow?gpe:hpe)(t,e,r)}function hpe({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;m{"use strict";var c6=Ge("process");function mpe(t,...e){t==="debug"&&console.log(...e)}function hpe(t,e){(t==="debug"||t==="warn")&&(typeof c6.emitWarning=="function"?c6.emitWarning(e):console.warn(e))}fT.debug=mpe;fT.warn=hpe});var Zy=v(Gy=>{"use strict";var Hy=De(),l6=Dt(),qy="<<",By={identify:t=>t===qy||typeof t=="symbol"&&t.description===qy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new l6.Scalar(Symbol(qy)),{addToJSMap:u6}),stringify:()=>qy},gpe=(t,e)=>(By.identify(e)||Hy.isScalar(e)&&(!e.type||e.type===l6.Scalar.PLAIN)&&By.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===By.tag&&r.default);function u6(t,e,r){let n=d6(t,r);if(Hy.isSeq(n))for(let i of n.items)mT(t,e,i);else if(Array.isArray(n))for(let i of n)mT(t,e,i);else mT(t,e,n)}function mT(t,e,r){let n=d6(t,r);if(!Hy.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 d6(t,e){return t&&Hy.isAlias(e)?e.resolve(t.doc,t):e}Gy.addMergeToJSMap=u6;Gy.isMergeKey=gpe;Gy.merge=By});var gT=v(m6=>{"use strict";var ype=pT(),f6=Zy(),_pe=vf(),p6=De(),hT=Vo();function bpe(t,e,{key:r,value:n}){if(p6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(f6.isMergeKey(t,r))f6.addMergeToJSMap(t,e,n);else{let i=hT.toJS(r,"",t);if(e instanceof Map)e.set(i,hT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=vpe(r,i,t),s=hT.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 vpe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(p6.isNode(t)&&r?.doc){let n=_pe.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)+'..."'),ype.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)}m6.addPairToJSMap=bpe});var Yo=v(yT=>{"use strict";var h6=hf(),Spe=a6(),wpe=gT(),Vy=De();function xpe(t,e,r){let n=h6.createNode(t,void 0,r),i=h6.createNode(e,void 0,r);return new Wy(n,i)}var Wy=class t{constructor(e,r=null){Object.defineProperty(this,Vy.NODE_TYPE,{value:Vy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Vy.isNode(r)&&(r=r.clone(e)),Vy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return wpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Spe.stringifyPair(this,e,r,n):JSON.stringify(this)}};yT.Pair=Wy;yT.createPair=xpe});var _T=v(y6=>{"use strict";var pa=De(),g6=vf(),Ky=gf();function $pe(t,e,r){return(e.inFlow??t.flow?Epe:kpe)(t,e,r)}function kpe({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+=Ky.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+=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?` +`+Ky.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function Epe({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+=Ky.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 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())}}u6.stringifyCollection=mpe});var Xo=v(mT=>{"use strict";var ype=fT(),_pe=uT(),bpe=Ry(),Yo=De(),Gy=Jo(),vpe=Dt();function _f(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 bpe.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=_f(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Yo.isScalar(i.value)&&vpe.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=_f(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=_f(this.items,e)?.value;return(!r&&Yo.isScalar(i)?i.value:i)??void 0}has(e){return!!_f(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)_pe.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})),ype.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};mT.YAMLMap=pT;mT.findPair=_f});var nl=v(f6=>{"use strict";var Spe=De(),d6=Xo(),wpe={collection:"map",default:!0,nodeClass:d6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Spe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>d6.YAMLMap.from(t,e,r)};f6.map=wpe});var Qo=v(p6=>{"use strict";var xpe=df(),$pe=fT(),kpe=Ry(),Vy=De(),Epe=Dt(),Ape=Zo(),hT=class extends kpe.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}p6.YAMLSeq=hT});var il=v(h6=>{"use strict";var Tpe=De(),m6=Qo(),Ope={collection:"seq",default:!0,nodeClass:m6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Tpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>m6.YAMLSeq.from(t,e,r)};h6.seq=Ope});var bf=v(g6=>{"use strict";var Rpe=hf(),Ipe={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),Rpe.stringifyString(t,e,r,n)}};g6.string=Ipe});var Wy=v(b6=>{"use strict";var y6=Dt(),_6={identify:t=>t==null,createNode:()=>new y6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new y6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&_6.test.test(t)?t:e.options.nullStr};b6.nullTag=_6});var gT=v(S6=>{"use strict";var Ppe=Dt(),v6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Ppe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&v6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};S6.boolTag=v6});var ol=v(w6=>{"use strict";function Cpe({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}w6.stringifyNumber=Cpe});var _T=v(Ky=>{"use strict";var Dpe=Dt(),yT=ol(),Npe={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},jpe={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)}},Mpe={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 Dpe.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=Mpe;Ky.floatExp=jpe;Ky.floatNaN=Npe});var vT=v(Yy=>{"use strict";var x6=ol(),Jy=t=>typeof t=="bigint"||Number.isInteger(t),bT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function $6(t,e,r){let{value:n}=t;return Jy(n)&&n>=0?r+n.toString(e):x6.stringifyNumber(t)}var Fpe={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=>$6(t,8,"0o")},Lpe={identify:Jy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>bT(t,0,10,r),stringify:x6.stringifyNumber},zpe={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=>$6(t,16,"0x")};Yy.int=Lpe;Yy.intHex=zpe;Yy.intOct=Fpe});var E6=v(k6=>{"use strict";var Upe=nl(),qpe=Wy(),Bpe=il(),Hpe=bf(),Gpe=gT(),ST=_T(),wT=vT(),Zpe=[Upe.map,Bpe.seq,Hpe.string,qpe.nullTag,Gpe.boolTag,wT.intOct,wT.int,wT.intHex,ST.floatNaN,ST.floatExp,ST.float];k6.schema=Zpe});var O6=v(T6=>{"use strict";var Vpe=Dt(),Wpe=nl(),Kpe=il();function A6(t){return typeof t=="bigint"||Number.isInteger(t)}var Xy=({value:t})=>JSON.stringify(t),Jpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Xy},{identify:t=>t==null,createNode:()=>new Vpe.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:A6,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})=>A6(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}],Ype={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Xpe=[Wpe.map,Kpe.seq].concat(Jpe,Ype);T6.schema=Xpe});var $T=v(R6=>{"use strict";var vf=Ge("buffer"),xT=Dt(),Qpe=hf(),eme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof vf.Buffer=="function")return vf.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(),tme=Dt(),rme=Qo();function I6(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 tme.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Jy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Ky.indentComment(e(n),t);r.push(o.trimStart())}}y6.stringifyCollection=$pe});var Qo=v(vT=>{"use strict";var Ape=_T(),Tpe=gT(),Ope=jy(),Xo=De(),Yy=Yo(),Rpe=Dt();function wf(t,e){let r=Xo.isScalar(e)?e.value:e;for(let n of t)if(Xo.isPair(n)&&(n.key===e||n.key===r||Xo.isScalar(n.key)&&n.key.value===r))return n}var bT=class extends Ope.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Xo.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(Yy.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;Xo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Yy.Pair(e,e?.value):n=new Yy.Pair(e.key,e.value);let i=wf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Xo.isScalar(i.value)&&Rpe.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=wf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=wf(this.items,e)?.value;return(!r&&Xo.isScalar(i)?i.value:i)??void 0}has(e){return!!wf(this.items,e)}set(e,r){this.add(new Yy.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)Tpe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Xo.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})),Ape.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};vT.YAMLMap=bT;vT.findPair=wf});var ol=v(b6=>{"use strict";var Ipe=De(),_6=Qo(),Ppe={collection:"map",default:!0,nodeClass:_6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Ipe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>_6.YAMLMap.from(t,e,r)};b6.map=Ppe});var es=v(v6=>{"use strict";var Cpe=hf(),Dpe=_T(),Npe=jy(),Qy=De(),jpe=Dt(),Mpe=Vo(),ST=class extends Npe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Qy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Xy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Xy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Qy.isScalar(i)?i.value:i}has(e){let r=Xy(e);return typeof r=="number"&&r=0?e:null}v6.YAMLSeq=ST});var sl=v(w6=>{"use strict";var Fpe=De(),S6=es(),Lpe={collection:"seq",default:!0,nodeClass:S6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Fpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>S6.YAMLSeq.from(t,e,r)};w6.seq=Lpe});var xf=v(x6=>{"use strict";var zpe=bf(),Upe={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),zpe.stringifyString(t,e,r,n)}};x6.string=Upe});var e_=v(E6=>{"use strict";var $6=Dt(),k6={identify:t=>t==null,createNode:()=>new $6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new $6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&k6.test.test(t)?t:e.options.nullStr};E6.nullTag=k6});var wT=v(T6=>{"use strict";var qpe=Dt(),A6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new qpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&A6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};T6.boolTag=A6});var al=v(O6=>{"use strict";function Bpe({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}O6.stringifyNumber=Bpe});var $T=v(t_=>{"use strict";var Hpe=Dt(),xT=al(),Gpe={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:xT.stringifyNumber},Zpe={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():xT.stringifyNumber(t)}},Vpe={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 Hpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:xT.stringifyNumber};t_.float=Vpe;t_.floatExp=Zpe;t_.floatNaN=Gpe});var ET=v(n_=>{"use strict";var R6=al(),r_=t=>typeof t=="bigint"||Number.isInteger(t),kT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function I6(t,e,r){let{value:n}=t;return r_(n)&&n>=0?r+n.toString(e):R6.stringifyNumber(t)}var Wpe={identify:t=>r_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>kT(t,2,8,r),stringify:t=>I6(t,8,"0o")},Kpe={identify:r_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>kT(t,0,10,r),stringify:R6.stringifyNumber},Jpe={identify:t=>r_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>kT(t,2,16,r),stringify:t=>I6(t,16,"0x")};n_.int=Kpe;n_.intHex=Jpe;n_.intOct=Wpe});var C6=v(P6=>{"use strict";var Ype=ol(),Xpe=e_(),Qpe=sl(),eme=xf(),tme=wT(),AT=$T(),TT=ET(),rme=[Ype.map,Qpe.seq,eme.string,Xpe.nullTag,tme.boolTag,TT.intOct,TT.int,TT.intHex,AT.floatNaN,AT.floatExp,AT.float];P6.schema=rme});var j6=v(N6=>{"use strict";var nme=Dt(),ime=ol(),ome=sl();function D6(t){return typeof t=="bigint"||Number.isInteger(t)}var i_=({value:t})=>JSON.stringify(t),sme=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:i_},{identify:t=>t==null,createNode:()=>new nme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:i_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:i_},{identify:D6,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})=>D6(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:i_}],ame={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},cme=[ime.map,ome.seq].concat(sme,ame);N6.schema=cme});var RT=v(M6=>{"use strict";var $f=Ge("buffer"),OT=Dt(),lme=bf(),ume={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 o_=De(),IT=Yo(),dme=Dt(),fme=es();function F6(t,e){if(o_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new IT.Pair(new dme.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]=Qy.isPair(n)?n:new kT.Pair(n)}}else e("Expected a sequence for this tag");return t}function P6(t,e,r){let{replacer:n}=r,i=new rme.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 nme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:I6,createNode:P6};e_.createPairs=P6;e_.pairs=nme;e_.resolvePairs=I6});var TT=v(AT=>{"use strict";var C6=De(),ET=Zo(),Sf=Xo(),ime=Qo(),D6=t_(),pa=class t extends ime.YAMLSeq{constructor(){super(),this.add=Sf.YAMLMap.prototype.add.bind(this),this.delete=Sf.YAMLMap.prototype.delete.bind(this),this.get=Sf.YAMLMap.prototype.get.bind(this),this.has=Sf.YAMLMap.prototype.has.bind(this),this.set=Sf.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(C6.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=D6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};pa.tag="tag:yaml.org,2002:omap";var ome={collection:"seq",identify:t=>t instanceof Map,nodeClass:pa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=D6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)C6.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=ome});var L6=v(OT=>{"use strict";var N6=Dt();function j6({value:t,source:e},r){return e&&(t?M6:F6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var M6={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 N6.Scalar(!0),stringify:j6},F6={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 N6.Scalar(!1),stringify:j6};OT.falseTag=F6;OT.trueTag=M6});var z6=v(r_=>{"use strict";var sme=Dt(),RT=ol(),ame={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},cme={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)}},lme={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 sme.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=lme;r_.floatExp=cme;r_.floatNaN=ame});var q6=v(xf=>{"use strict";var U6=ol(),wf=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(wf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return U6.stringifyNumber(t)}var ume={identify:wf,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")},dme={identify:wf,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")},fme={identify:wf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>n_(t,0,10,r),stringify:U6.stringifyNumber},pme={identify:wf,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")};xf.int=fme;xf.intBin=ume;xf.intHex=pme;xf.intOct=dme});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 mme={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=mme});var NT=v(a_=>{"use strict";var hme=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 B6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return hme.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 gme={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:B6},yme={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:B6},H6={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(H6.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=yme;a_.intTime=gme;a_.timestamp=H6});var V6=v(Z6=>{"use strict";var _me=nl(),bme=Wy(),vme=il(),Sme=bf(),wme=$T(),G6=L6(),jT=z6(),c_=q6(),xme=zy(),$me=TT(),kme=t_(),Eme=CT(),MT=NT(),Ame=[_me.map,vme.seq,Sme.string,bme.nullTag,G6.trueTag,G6.falseTag,c_.intBin,c_.intOct,c_.int,c_.intHex,jT.floatNaN,jT.floatExp,jT.float,wme.binary,xme.merge,$me.omap,kme.pairs,Eme.set,MT.intTime,MT.floatTime,MT.timestamp];Z6.schema=Ame});var nB=v(zT=>{"use strict";var Y6=nl(),Tme=Wy(),X6=il(),Ome=bf(),Rme=gT(),FT=_T(),LT=vT(),Ime=E6(),Pme=O6(),Q6=$T(),$f=zy(),eB=TT(),tB=t_(),W6=V6(),rB=CT(),l_=NT(),K6=new Map([["core",Ime.schema],["failsafe",[Y6.map,X6.seq,Ome.string]],["json",Pme.schema],["yaml11",W6.schema],["yaml-1.1",W6.schema]]),J6={binary:Q6.binary,bool:Rme.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:Y6.map,merge:$f.merge,null:Tme.nullTag,omap:eB.omap,pairs:tB.pairs,seq:X6.seq,set:rB.set,timestamp:l_.timestamp},Cme={"tag:yaml.org,2002:binary":Q6.binary,"tag:yaml.org,2002:merge":$f.merge,"tag:yaml.org,2002:omap":eB.omap,"tag:yaml.org,2002:pairs":tB.pairs,"tag:yaml.org,2002:set":rB.set,"tag:yaml.org,2002:timestamp":l_.timestamp};function Dme(t,e,r){let n=K6.get(e);if(n&&!t)return r&&!n.includes($f.merge)?n.concat($f.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(K6.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($f.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?J6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(J6).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=Cme;zT.getTags=Dme});var BT=v(iB=>{"use strict";var UT=De(),Nme=nl(),jme=il(),Mme=bf(),u_=nB(),Fme=(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:Nme.map}),Object.defineProperty(this,UT.SCALAR,{value:Mme.string}),Object.defineProperty(this,UT.SEQ,{value:jme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Fme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};iB.Schema=qT});var sB=v(oB=>{"use strict";var Lme=De(),HT=gf(),kf=ff();function zme(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(kf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Lme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(kf.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+=kf.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(kf.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(kf.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=o_.isPair(n)?n:new IT.Pair(n)}}else e("Expected a sequence for this tag");return t}function L6(t,e,r){let{replacer:n}=r,i=new fme.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(IT.createPair(a,c,r))}return i}var pme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:F6,createNode:L6};s_.createPairs=L6;s_.pairs=pme;s_.resolvePairs=F6});var DT=v(CT=>{"use strict";var z6=De(),PT=Vo(),kf=Qo(),mme=es(),U6=a_(),ma=class t extends mme.YAMLSeq{constructor(){super(),this.add=kf.YAMLMap.prototype.add.bind(this),this.delete=kf.YAMLMap.prototype.delete.bind(this),this.get=kf.YAMLMap.prototype.get.bind(this),this.has=kf.YAMLMap.prototype.has.bind(this),this.set=kf.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(z6.isPair(i)?(o=PT.toJS(i.key,"",r),s=PT.toJS(i.value,o,r)):o=PT.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=U6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ma.tag="tag:yaml.org,2002:omap";var hme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=U6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)z6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ma,r)},createNode:(t,e,r)=>ma.from(t,e,r)};CT.YAMLOMap=ma;CT.omap=hme});var Z6=v(NT=>{"use strict";var q6=Dt();function B6({value:t,source:e},r){return e&&(t?H6:G6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var H6={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 q6.Scalar(!0),stringify:B6},G6={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 q6.Scalar(!1),stringify:B6};NT.falseTag=G6;NT.trueTag=H6});var V6=v(c_=>{"use strict";var gme=Dt(),jT=al(),yme={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:jT.stringifyNumber},_me={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():jT.stringifyNumber(t)}},bme={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 gme.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:jT.stringifyNumber};c_.float=bme;c_.floatExp=_me;c_.floatNaN=yme});var K6=v(Af=>{"use strict";var W6=al(),Ef=t=>typeof t=="bigint"||Number.isInteger(t);function l_(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 MT(t,e,r){let{value:n}=t;if(Ef(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return W6.stringifyNumber(t)}var vme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>l_(t,2,2,r),stringify:t=>MT(t,2,"0b")},Sme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>l_(t,1,8,r),stringify:t=>MT(t,8,"0")},wme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>l_(t,0,10,r),stringify:W6.stringifyNumber},xme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>l_(t,2,16,r),stringify:t=>MT(t,16,"0x")};Af.int=wme;Af.intBin=vme;Af.intHex=xme;Af.intOct=Sme});var LT=v(FT=>{"use strict";var f_=De(),u_=Yo(),d_=Qo(),ha=class t extends d_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;f_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new u_.Pair(e.key,null):r=new u_.Pair(e,null),d_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=d_.findPair(this.items,e);return!r&&f_.isPair(n)?f_.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=d_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new u_.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(u_.createPair(s,null,n));return o}};ha.tag="tag:yaml.org,2002:set";var $me={collection:"map",identify:t=>t instanceof Set,nodeClass:ha,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ha.from(t,e,r),resolve(t,e){if(f_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ha,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};FT.YAMLSet=ha;FT.set=$me});var UT=v(p_=>{"use strict";var kme=al();function zT(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 kme.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 Eme={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})=>zT(t,r),stringify:J6},Ame={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=>zT(t,!1),stringify:J6},Y6={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(Y6.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=zT(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$/,"")??""};p_.floatTime=Ame;p_.intTime=Eme;p_.timestamp=Y6});var eB=v(Q6=>{"use strict";var Tme=ol(),Ome=e_(),Rme=sl(),Ime=xf(),Pme=RT(),X6=Z6(),qT=V6(),m_=K6(),Cme=Zy(),Dme=DT(),Nme=a_(),jme=LT(),BT=UT(),Mme=[Tme.map,Rme.seq,Ime.string,Ome.nullTag,X6.trueTag,X6.falseTag,m_.intBin,m_.intOct,m_.int,m_.intHex,qT.floatNaN,qT.floatExp,qT.float,Pme.binary,Cme.merge,Dme.omap,Nme.pairs,jme.set,BT.intTime,BT.floatTime,BT.timestamp];Q6.schema=Mme});var uB=v(ZT=>{"use strict";var iB=ol(),Fme=e_(),oB=sl(),Lme=xf(),zme=wT(),HT=$T(),GT=ET(),Ume=C6(),qme=j6(),sB=RT(),Tf=Zy(),aB=DT(),cB=a_(),tB=eB(),lB=LT(),h_=UT(),rB=new Map([["core",Ume.schema],["failsafe",[iB.map,oB.seq,Lme.string]],["json",qme.schema],["yaml11",tB.schema],["yaml-1.1",tB.schema]]),nB={binary:sB.binary,bool:zme.boolTag,float:HT.float,floatExp:HT.floatExp,floatNaN:HT.floatNaN,floatTime:h_.floatTime,int:GT.int,intHex:GT.intHex,intOct:GT.intOct,intTime:h_.intTime,map:iB.map,merge:Tf.merge,null:Fme.nullTag,omap:aB.omap,pairs:cB.pairs,seq:oB.seq,set:lB.set,timestamp:h_.timestamp},Bme={"tag:yaml.org,2002:binary":sB.binary,"tag:yaml.org,2002:merge":Tf.merge,"tag:yaml.org,2002:omap":aB.omap,"tag:yaml.org,2002:pairs":cB.pairs,"tag:yaml.org,2002:set":lB.set,"tag:yaml.org,2002:timestamp":h_.timestamp};function Hme(t,e,r){let n=rB.get(e);if(n&&!t)return r&&!n.includes(Tf.merge)?n.concat(Tf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(rB.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(Tf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?nB[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(nB).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=Bme;ZT.getTags=Hme});var KT=v(dB=>{"use strict";var VT=De(),Gme=ol(),Zme=sl(),Vme=xf(),g_=uB(),Wme=(t,e)=>t.keye.key?1:0,WT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?g_.getTags(e,"compat"):e?g_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?g_.coreKnownTags:{},this.tags=g_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,VT.MAP,{value:Gme.map}),Object.defineProperty(this,VT.SCALAR,{value:Vme.string}),Object.defineProperty(this,VT.SEQ,{value:Zme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Wme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};dB.Schema=WT});var pB=v(fB=>{"use strict";var Kme=De(),JT=vf(),Of=gf();function Jme(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=JT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Of.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Kme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Of.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=JT.stringify(t.contents,i,()=>a=null,c);a&&(l+=Of.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(JT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(Of.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(Of.indentComment(o(c),"")))}return r.join(` `)+` -`}oB.stringifyDocument=zme});var Ef=v(aB=>{"use strict";var Ume=uf(),sl=Ry(),Tn=De(),qme=Jo(),Bme=Zo(),Hme=BT(),Gme=sB(),GT=Ey(),Zme=KA(),Vme=df(),ZT=WA(),VT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Tn.NODE_TYPE,{value:Tn.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,{[Tn.NODE_TYPE]:{value:Tn.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=Tn.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 Ume.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=Vme.createNode(e,u,m);return a&&Tn.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 qme.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 Tn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return sl.isEmptyPath(e)?!r&&Tn.isScalar(this.contents)?this.contents.value:this.contents:Tn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Tn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return sl.isEmptyPath(e)?this.contents!==void 0:Tn.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 Hme.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=Bme.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"?Zme.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 Gme.stringifyDocument(this,e)}};function al(t){if(Tn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}aB.Document=VT});var Of=v(Tf=>{"use strict";var Af=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},WT=class extends Af{constructor(e,r,n){super("YAMLParseError",e,r,n)}},KT=class extends Af{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Wme=(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 +`}fB.stringifyDocument=Jme});var Rf=v(mB=>{"use strict";var Yme=mf(),cl=jy(),On=De(),Xme=Yo(),Qme=Vo(),ehe=KT(),the=pB(),YT=Py(),rhe=tT(),nhe=hf(),XT=eT(),QT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,On.NODE_TYPE,{value:On.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 XT.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,{[On.NODE_TYPE]:{value:On.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=On.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ll(this.contents)&&this.contents.add(e)}addIn(e,r){ll(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=YT.anchorNames(this);e.anchor=!r||n.has(r)?YT.findNewAnchor(r||"a",n):r}return new Yme.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}=YT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=nhe.createNode(e,u,m);return a&&On.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 Xme.Pair(i,o)}delete(e){return ll(this.contents)?this.contents.delete(e):!1}deleteIn(e){return cl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ll(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return On.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return cl.isEmptyPath(e)?!r&&On.isScalar(this.contents)?this.contents.value:this.contents:On.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return On.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return cl.isEmptyPath(e)?this.contents!==void 0:On.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=cl.collectionFromPath(this.schema,[e],r):ll(this.contents)&&this.contents.set(e,r)}setIn(e,r){cl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=cl.collectionFromPath(this.schema,Array.from(e),r):ll(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 XT.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 XT.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 ehe.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=Qme.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"?rhe.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 the.stringifyDocument(this,e)}};function ll(t){if(On.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}mB.Document=QT});var Cf=v(Pf=>{"use strict";var If=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},eO=class extends If{constructor(e,r,n){super("YAMLParseError",e,r,n)}},tO=class extends If{constructor(e,r,n){super("YAMLWarning",e,r,n)}},ihe=(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} -`}};Tf.YAMLError=Af;Tf.YAMLParseError=WT;Tf.YAMLWarning=KT;Tf.prettifyError=Wme});var Rf=v(cB=>{"use strict";function Kme(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}}cB.resolveProps=Kme});var d_=v(lB=>{"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}}lB.containsNewline=JT});var YT=v(uB=>{"use strict";var Jme=d_();function Yme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Jme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}uB.flowIndentCheck=Yme});var XT=v(fB=>{"use strict";var dB=De();function Xme(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||dB.isScalar(o)&&dB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}fB.mapIncludes=Xme});var _B=v(yB=>{"use strict";var pB=Jo(),Qme=Xo(),mB=Rf(),ehe=d_(),hB=YT(),the=XT(),gB="All mapping items must start at the same column";function rhe({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=mB.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",gB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||ehe.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",gB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&hB.flowIndentCheck(n.indent,f,i),r.atKey=!1,the.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=mB.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 nhe=Qo(),ihe=Rf(),ohe=YT();function she({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??nhe.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=ihe.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&&ohe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}bB.resolveBlockSeq=she});var cl=v(SB=>{"use strict";function ahe(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}}SB.resolveEnd=ahe});var kB=v($B=>{"use strict";var che=De(),lhe=Jo(),wB=Xo(),uhe=Qo(),dhe=cl(),xB=Rf(),fhe=d_(),phe=XT(),QT="Block collections are not allowed within flow collections",eO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function mhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?wB.YAMLMap:uhe.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=dhe.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}$B.resolveFlowCollection=mhe});var AB=v(EB=>{"use strict";var hhe=De(),ghe=Dt(),yhe=Xo(),_he=Qo(),bhe=_B(),vhe=vB(),She=kB();function tO(t,e,r,n,i,o){let s=r.type==="block-map"?bhe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?vhe.resolveBlockSeq(t,e,r,n,o):She.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 whe(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=hhe.isNode(u)?u:new ghe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}EB.composeCollection=whe});var nO=v(TB=>{"use strict";var rO=Dt();function xhe(t,e,r){let n=e.offset,i=$he(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?khe(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?` +`}};Pf.YAMLError=If;Pf.YAMLParseError=eO;Pf.YAMLWarning=tO;Pf.prettifyError=ihe});var Df=v(hB=>{"use strict";function ohe(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}}hB.resolveProps=ohe});var y_=v(gB=>{"use strict";function rO(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(rO(e.key)||rO(e.value))return!0}return!1;default:return!0}}gB.containsNewline=rO});var nO=v(yB=>{"use strict";var she=y_();function ahe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&she.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}yB.flowIndentCheck=ahe});var iO=v(bB=>{"use strict";var _B=De();function che(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||_B.isScalar(o)&&_B.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}bB.mapIncludes=che});var kB=v($B=>{"use strict";var vB=Yo(),lhe=Qo(),SB=Df(),uhe=y_(),wB=nO(),dhe=iO(),xB="All mapping items must start at the same column";function fhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??lhe.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=SB.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",xB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||uhe.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",xB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&wB.flowIndentCheck(n.indent,f,i),r.atKey=!1,dhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=SB.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 phe=es(),mhe=Df(),hhe=nO();function ghe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??phe.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=mhe.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&&hhe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}EB.resolveBlockSeq=ghe});var ul=v(TB=>{"use strict";function yhe(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}}TB.resolveEnd=yhe});var PB=v(IB=>{"use strict";var _he=De(),bhe=Yo(),OB=Qo(),vhe=es(),She=ul(),RB=Df(),whe=y_(),xhe=iO(),oO="Block collections are not allowed within flow collections",sO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function $he({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?OB.YAMLMap:vhe.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=She.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}IB.resolveFlowCollection=$he});var DB=v(CB=>{"use strict";var khe=De(),Ehe=Dt(),Ahe=Qo(),The=es(),Ohe=kB(),Rhe=AB(),Ihe=PB();function aO(t,e,r,n,i,o){let s=r.type==="block-map"?Ohe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Rhe.resolveBlockSeq(t,e,r,n,o):Ihe.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 Phe(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),aO(t,e,r,i,s)}let l=aO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=khe.isNode(u)?u:new Ehe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}CB.composeCollection=Phe});var lO=v(NB=>{"use strict";var cO=Dt();function Che(t,e,r){let n=e.offset,i=Dhe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?cO.Scalar.BLOCK_FOLDED:cO.Scalar.BLOCK_LITERAL,s=e.source?Nhe(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,92 @@ ${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 $he({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 iO=Dt(),Ehe=cl();function Ahe(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=The(o,l);break;case"single-quoted-scalar":a=iO.Scalar.QUOTE_SINGLE,c=Ohe(o,l);break;case"double-quoted-scalar":a=iO.Scalar.QUOTE_DOUBLE,c=Rhe(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=Ehe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function The(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}`),OB(t)}function Ohe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),OB(t.slice(1,-1)).replace(/''/g,"'")}function OB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var uO=Dt(),jhe=ul();function Mhe(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=uO.Scalar.PLAIN,c=Fhe(o,l);break;case"single-quoted-scalar":a=uO.Scalar.QUOTE_SINGLE,c=Lhe(o,l);break;case"double-quoted-scalar":a=uO.Scalar.QUOTE_DOUBLE,c=zhe(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=jhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function Fhe(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}`),jB(t)}function Lhe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),jB(t.slice(1,-1)).replace(/''/g,"'")}function jB(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 Ihe(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 Uhe(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 Phe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Che(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}}RB.resolveFlowScalar=Ahe});var CB=v(PB=>{"use strict";var ha=De(),IB=Dt(),Dhe=nO(),Nhe=oO();function jhe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Dhe.resolveBlockScalar(t,e,n):Nhe.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=Mhe(t.schema,i,c,r,n):e.type==="scalar"?l=Fhe(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 IB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new IB.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 Mhe(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 Fhe({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}PB.composeScalar=jhe});var NB=v(DB=>{"use strict";function Lhe(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}DB.emptyScalarPosition=Lhe});var FB=v(aO=>{"use strict";var zhe=uf(),Uhe=De(),qhe=AB(),jB=CB(),Bhe=cl(),Hhe=NB(),Ghe={composeNode:MB,composeEmptyNode:sO};function MB(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=Zhe(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=jB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=qhe.composeCollection(Ghe,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&&(!Uhe.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:Hhe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=jB.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 Zhe({options:t},{offset:e,source:r,end:n},i){let o=new zhe.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=Bhe.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=MB});var UB=v(zB=>{"use strict";var Vhe=Ef(),LB=FB(),Whe=cl(),Khe=Rf();function Jhe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Vhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Khe.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?LB.composeNode(l,i,u,s):LB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Whe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}zB.composeDoc=Jhe});var lO=v(HB=>{"use strict";var Yhe=Ge("process"),Xhe=WA(),Qhe=Ef(),If=Of(),qB=De(),ege=UB(),tge=cl();function Pf(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 BB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ga=De(),FB=Dt(),Hhe=lO(),Ghe=dO();function Zhe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Hhe.resolveBlockScalar(t,e,n):Ghe.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[ga.SCALAR]:c?l=Vhe(t.schema,i,c,r,n):e.type==="scalar"?l=Whe(t,i,e,n):l=t.schema[ga.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ga.isScalar(d)?d:new FB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new FB.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 Vhe(t,e,r,n,i){if(r==="!")return t[ga.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[ga.SCALAR])}function Whe({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[ga.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ga.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}LB.composeScalar=Zhe});var qB=v(UB=>{"use strict";function Khe(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}UB.emptyScalarPosition=Khe});var GB=v(pO=>{"use strict";var Jhe=mf(),Yhe=De(),Xhe=DB(),BB=zB(),Qhe=ul(),ege=qB(),tge={composeNode:HB,composeEmptyNode:fO};function HB(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=rge(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=BB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Xhe.composeCollection(tge,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=fO(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&&(!Yhe.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 fO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:ege.emptyScalarPosition(e,r,n),indent:-1,source:""},d=BB.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 rge({options:t},{offset:e,source:r,end:n},i){let o=new Jhe.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=Qhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}pO.composeEmptyNode=fO;pO.composeNode=HB});var WB=v(VB=>{"use strict";var nge=Rf(),ZB=GB(),ige=ul(),oge=Df();function sge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new nge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=oge.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?ZB.composeNode(l,i,u,s):ZB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=ige.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}VB.composeDoc=sge});var hO=v(YB=>{"use strict";var age=Ge("process"),cge=eT(),lge=Rf(),Nf=Cf(),KB=De(),uge=WB(),dge=ul();function jf(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{let s=Pf(r);o?this.warnings.push(new If.YAMLWarning(s,n,i)):this.errors.push(new If.YAMLParseError(s,n,i))},this.directives=new Xhe.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=BB(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(qB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];qB.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 mO=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=jf(r);o?this.warnings.push(new Nf.YAMLWarning(s,n,i)):this.errors.push(new Nf.YAMLParseError(s,n,i))},this.directives=new cge.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(KB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];KB.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=Pf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=ege.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 If.YAMLParseError(Pf(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 If.YAMLParseError(Pf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=tge.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 If.YAMLParseError(Pf(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}}};HB.Composer=cO});var VB=v(f_=>{"use strict";var rge=nO(),nge=oO(),ige=Of(),GB=hf();function oge(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 ige.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return nge.resolveFlowScalar(t,e,n);case"block-scalar":return rge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function sge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=GB.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=jf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=uge.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 Nf.YAMLParseError(jf(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 Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=dge.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 Nf.YAMLParseError(jf(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 lge.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}}};YB.Composer=mO});var eH=v(__=>{"use strict";var fge=lO(),pge=dO(),mge=Cf(),XB=bf();function hge(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 mge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return pge.resolveFlowScalar(t,e,n);case"block-scalar":return fge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function gge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=XB.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 ZB(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 age(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=GB.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">":cge(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 cge(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return QB(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 yge(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=XB.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">":_ge(t,c);break;case'"':gO(t,c,"double-quoted-scalar");break;case"'":gO(t,c,"single-quoted-scalar");break;default:gO(t,c,"scalar")}}function _ge(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}];ZB(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 ZB(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=sge;f_.resolveAsScalar=oge;f_.setScalarValue=age});var KB=v(WB=>{"use strict";var lge=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}WB.stringify=lge});var QB=v(XB=>{"use strict";var dO=Symbol("break visit"),uge=Symbol("skip children"),JB=Symbol("remove item");function ga(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),YB(Object.freeze([]),t,e)}ga.BREAK=dO;ga.SKIP=uge;ga.REMOVE=JB;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 YB(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=VB(),dge=KB(),fge=QB(),pO="\uFEFF",mO="",hO="",gO="",pge=t=>!!t&&"items"in t,mge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function hge(t){switch(t){case pO:return"";case mO:return"";case hO:return"";case gO:return"";default:return JSON.stringify(t)}}function gge(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` +`;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}];QB(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 QB(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 gO(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})}}}__.createScalarToken=gge;__.resolveAsScalar=hge;__.setScalarValue=yge});var rH=v(tH=>{"use strict";var bge=t=>"type"in t?v_(t):b_(t);function v_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=v_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=b_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=b_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=b_(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 b_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=v_(e)),r)for(let o of r)i+=o.source;return n&&(i+=v_(n)),i}tH.stringify=bge});var sH=v(oH=>{"use strict";var yO=Symbol("break visit"),vge=Symbol("skip children"),nH=Symbol("remove item");function ya(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),iH(Object.freeze([]),t,e)}ya.BREAK=yO;ya.SKIP=vge;ya.REMOVE=nH;ya.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};ya.parentCollection=(t,e)=>{let r=ya.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 iH(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 _O=eH(),Sge=rH(),wge=sH(),bO="\uFEFF",vO="",SO="",wO="",xge=t=>!!t&&"items"in t,$ge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function kge(t){switch(t){case bO:return"";case vO:return"";case SO:return"";case wO:return"";default:return JSON.stringify(t)}}function Ege(t){switch(t){case bO:return"byte-order-mark";case vO:return"doc-mode";case SO:return"flow-error-end";case wO: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}Nr.createScalarToken=fO.createScalarToken;Nr.resolveAsScalar=fO.resolveAsScalar;Nr.setScalarValue=fO.setScalarValue;Nr.stringify=dge.stringify;Nr.visit=fge.visit;Nr.BOM=pO;Nr.DOCUMENT=mO;Nr.FLOW_END=hO;Nr.SCALAR=gO;Nr.isCollection=pge;Nr.isScalar=mge;Nr.prettyToken=hge;Nr.tokenType=gge});var bO=v(tH=>{"use strict";var Cf=h_();function Yn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var eH=new Set("0123456789ABCDEFabcdef"),yge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),g_=new Set(",[]{}"),_ge=new Set(` ,[]{} -\r `),yO=t=>!t||_ge.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===` +`: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}jr.createScalarToken=_O.createScalarToken;jr.resolveAsScalar=_O.resolveAsScalar;jr.setScalarValue=_O.setScalarValue;jr.stringify=Sge.stringify;jr.visit=wge.visit;jr.BOM=bO;jr.DOCUMENT=vO;jr.FLOW_END=SO;jr.SCALAR=wO;jr.isCollection=xge;jr.isScalar=$ge;jr.prettyToken=kge;jr.tokenType=Ege});var kO=v(cH=>{"use strict";var Mf=S_();function Xn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var aH=new Set("0123456789ABCDEFabcdef"),Age=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),w_=new Set(",[]{}"),Tge=new Set(` ,[]{} +\r `),xO=t=>!t||Tge.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==="...")&&Yn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Yn(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===":")&&Yn(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=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Xn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Xn(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===":")&&Xn(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(xO),"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=>Yn(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=>Xn(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 Cf.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(Yn(o)||e&&g_.has(o))break;r=n}else if(Yn(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 Mf.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(Xn(o)||e&&w_.has(o))break;r=n}else if(Xn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,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 Cf.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(Yn(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(;!Yn(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(yge.has(r))r=this.buffer[++e];else if(r==="%"&&eH.has(this.buffer[e+1])&&eH.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&&w_.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&w_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Mf.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(xO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Xn(n)||r&&w_.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(;!Xn(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(Age.has(r))r=this.buffer[++e];else if(r==="%"&&aH.has(this.buffer[e+1])&&aH.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)}};tH.Lexer=_O});var SO=v(rH=>{"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 bge=Ge("process"),nH=h_(),vge=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"&&oH(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&&iH(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)}};cH.Lexer=$O});var AO=v(lH=>{"use strict";var EO=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 Oge=Ge("process"),uH=S_(),Rge=kO();function ts(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"&&fH(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&&dH(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(sH(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);oH(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(ts(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(pH(r.key)&&!ts(r.sep,"newline")){let s=dl(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(ts(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=dl(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]}):ts(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&&!ts(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||ts(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=x_(n),o=dl(i);fH(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=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())}}};aH.Parser=wO});var fH=v(Nf=>{"use strict";var cH=lO(),Sge=Ef(),Df=Of(),wge=aT(),xge=De(),$ge=SO(),lH=xO();function uH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new $ge.LineCounter||null,prettyErrors:e}}function kge(t,e={}){let{lineCounter:r,prettyErrors:n}=uH(e),i=new lH.Parser(r?.addNewLine),o=new cH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Df.prettifyError(t,r)),a.warnings.forEach(Df.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function dH(t,e={}){let{lineCounter:r,prettyErrors:n}=uH(e),i=new lH.Parser(r?.addNewLine),o=new cH.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 Df.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Df.prettifyError(t,r)),s.warnings.forEach(Df.prettifyError(t,r))),s}function Ege(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=dH(t,r);if(!i)return null;if(i.warnings.forEach(o=>wge.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 Age(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 xge.isDocument(t)&&!n?t.toString(r):new Sge.Document(t,n,r).toString(r)}Nf.parse=Ege;Nf.parseAllDocuments=kge;Nf.parseDocument=dH;Nf.stringify=Age});var er=v(Ze=>{"use strict";var Tge=lO(),Oge=Ef(),Rge=BT(),$O=Of(),Ige=uf(),ts=De(),Pge=Jo(),Cge=Dt(),Dge=Xo(),Nge=Qo(),jge=h_(),Mge=bO(),Fge=SO(),Lge=xO(),b_=fH(),pH=sf();Ze.Composer=Tge.Composer;Ze.Document=Oge.Document;Ze.Schema=Rge.Schema;Ze.YAMLError=$O.YAMLError;Ze.YAMLParseError=$O.YAMLParseError;Ze.YAMLWarning=$O.YAMLWarning;Ze.Alias=Ige.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=Pge.Pair;Ze.Scalar=Cge.Scalar;Ze.YAMLMap=Dge.YAMLMap;Ze.YAMLSeq=Nge.YAMLSeq;Ze.CST=jge;Ze.Lexer=Mge.Lexer;Ze.LineCounter=Fge.LineCounter;Ze.Parser=Lge.Parser;Ze.parse=b_.parse;Ze.parseAllDocuments=b_.parseAllDocuments;Ze.parseDocument=b_.parseDocument;Ze.stringify=b_.stringify;Ze.visit=pH.visit;Ze.visitAsync=pH.visitAsync});import{execFileSync as mH}from"node:child_process";import{existsSync as v_}from"node:fs";import{join as S_,resolve as zge}from"node:path";function Uge(t){try{let e=mH("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?zge(t,e):null}catch{return null}}function kO(t){let e=Uge(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=mH("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 qge}from"node:child_process";import{existsSync as Bge,readFileSync as Hge}from"node:fs";import{join as yH}from"node:path";function jf(t,e){return qge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function rs(t){try{let e=jf(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){Gge(t,e);let r=jf(t,["rev-parse","HEAD"]).trim(),n=Zge(t,e);return{groups:Vge(t,n),head:r,inventory:{after:gH($_(t,"spec.yaml")),before:gH(AO(t,e,"spec.yaml"))},since:e,unsharded_commits:Yge(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 Gge(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 Zge(t,e){let r=jf(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(!(!hH(c)&&!hH(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 hH(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=yH(t,e);if(!Bge(r))return null;try{return Hge(r,"utf8")}catch{return null}}function AO(t,e,r){try{return jf(t,["show",`${e}:${r}`])}catch{return null}}function Vge(t,e){let r=Wge(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 Wge(t){let e=$_(t,yH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,k_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function gH(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 Yge(t,e){let r=jf(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);Kge.test(a)&&(Jge.test(a)||n.push({hash:s,subject:a}))}return n}var k_,Kge,Jge,dl=y(()=>{"use strict";k_=St(er(),1);_a();Kge=/^(feat|fix)(\([^)]*\))?!?:/,Jge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as _H}from"node:child_process";import{appendFileSync as Xge,existsSync as OO,mkdirSync as Qge,readFileSync as eye,renameSync as tye,statSync as rye}from"node:fs";import{userInfo as nye}from"node:os";import{dirname as iye,join as IO}from"node:path";function PO(t){return IO(t,bH,oye)}function en(t,e){let r=PO(t),n=iye(r);OO(n)||Qge(n,{recursive:!0});try{OO(r)&&rye(r).size>sye&&tye(r,IO(n,vH))}catch{}Xge(r,`${JSON.stringify(e)} -`,"utf8")}function RO(t){if(!OO(t))return[];let e=eye(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,bH,vH)),...RO(PO(t))]}function tn(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 aye(t){let e;try{e=_H("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=nye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function cye(t){try{return _H("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Mf(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=cye(t),i=aye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Mf(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}en(t,tn(e,o))}catch{}}var bH,oye,vH,sye,jr=y(()=>{"use strict";bH=".cladding",oye="events.log.jsonl",vH="events.log.1.jsonl",sye=5*1024*1024});import{execFileSync as lye}from"node:child_process";import{existsSync as SH,readdirSync as uye,readFileSync as dye,statSync as wH}from"node:fs";import{createHash as fye}from"node:crypto";import{join as CO}from"node:path";function va(t){try{return lye("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");SH(r)&&wH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=CO(t,"spec",i);if(!(!SH(o)||!wH(o).isDirectory()))for(let s of uye(o))s.endsWith(".yaml")&&e.push(CO(o,s))}e.sort();let n=fye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(dye(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 en(t,tn("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=tn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return en(t,i),i}var Ff=y(()=>{"use strict";jr()});import{readFileSync as pye,statSync as mye}from"node:fs";import{extname as hye,resolve as NO,sep as gye}from"node:path";function rn(t){return Math.ceil(t.length/4)}function bye(t,e){let r=NO(e),n=NO(r,t);return n===r||n.startsWith(r+gye)}function $H(t,e,r,n){if(!bye(t,e))return{path:t,omitted:"unsafe-path"};if(!yye.has(hye(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>xH)return{path:t,omitted:"too-large",bytes:o}}else{let l=NO(e,t);try{o=mye(l).size}catch{return{path:t,omitted:"missing"}}if(o>xH)return{path:t,omitted:"too-large",bytes:o};try{i=pye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(_ye))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=x_(e),n=dl(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=x_(e),n=dl(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())}}};mH.Parser=TO});var bH=v(Lf=>{"use strict";var hH=hO(),Ige=Rf(),Ff=Cf(),Pge=pT(),Cge=De(),Dge=AO(),gH=OO();function yH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Dge.LineCounter||null,prettyErrors:e}}function Nge(t,e={}){let{lineCounter:r,prettyErrors:n}=yH(e),i=new gH.Parser(r?.addNewLine),o=new hH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Ff.prettifyError(t,r)),a.warnings.forEach(Ff.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function _H(t,e={}){let{lineCounter:r,prettyErrors:n}=yH(e),i=new gH.Parser(r?.addNewLine),o=new hH.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 Ff.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Ff.prettifyError(t,r)),s.warnings.forEach(Ff.prettifyError(t,r))),s}function jge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=_H(t,r);if(!i)return null;if(i.warnings.forEach(o=>Pge.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 Mge(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 Cge.isDocument(t)&&!n?t.toString(r):new Ige.Document(t,n,r).toString(r)}Lf.parse=jge;Lf.parseAllDocuments=Nge;Lf.parseDocument=_H;Lf.stringify=Mge});var er=v(Ze=>{"use strict";var Fge=hO(),Lge=Rf(),zge=KT(),RO=Cf(),Uge=mf(),rs=De(),qge=Yo(),Bge=Dt(),Hge=Qo(),Gge=es(),Zge=S_(),Vge=kO(),Wge=AO(),Kge=OO(),k_=bH(),vH=uf();Ze.Composer=Fge.Composer;Ze.Document=Lge.Document;Ze.Schema=zge.Schema;Ze.YAMLError=RO.YAMLError;Ze.YAMLParseError=RO.YAMLParseError;Ze.YAMLWarning=RO.YAMLWarning;Ze.Alias=Uge.Alias;Ze.isAlias=rs.isAlias;Ze.isCollection=rs.isCollection;Ze.isDocument=rs.isDocument;Ze.isMap=rs.isMap;Ze.isNode=rs.isNode;Ze.isPair=rs.isPair;Ze.isScalar=rs.isScalar;Ze.isSeq=rs.isSeq;Ze.Pair=qge.Pair;Ze.Scalar=Bge.Scalar;Ze.YAMLMap=Hge.YAMLMap;Ze.YAMLSeq=Gge.YAMLSeq;Ze.CST=Zge;Ze.Lexer=Vge.Lexer;Ze.LineCounter=Wge.LineCounter;Ze.Parser=Kge.Parser;Ze.parse=k_.parse;Ze.parseAllDocuments=k_.parseAllDocuments;Ze.parseDocument=k_.parseDocument;Ze.stringify=k_.stringify;Ze.visit=vH.visit;Ze.visitAsync=vH.visitAsync});import{execFileSync as IO}from"node:child_process";import{existsSync as E_}from"node:fs";import{join as A_,resolve as Jge}from"node:path";function Yge(t){try{let e=IO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Jge(t,e):null}catch{return null}}function PO(t){let e=Yge(t);if(!e)return null;try{if(E_(A_(e,"MERGE_HEAD")))return"merge";if(E_(A_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(E_(A_(e,"rebase-merge"))||E_(A_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function _a(t){return PO(t)!==null}function zf(t,e){try{let r=IO("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 T_(t,e){return zf(t,e)!==null}function SH(t,e){try{let r=IO("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var ba=y(()=>{"use strict"});import{execFileSync as Xge}from"node:child_process";import{existsSync as Qge,readFileSync as eye}from"node:fs";import{join as xH}from"node:path";function ml(t,e){return Xge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ns(t){try{let e=ml(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 is(t,e){$H(t,e);let r=ml(t,["rev-parse","HEAD"]).trim(),n=tye(t,e);return{groups:rye(t,n),head:r,inventory:{after:wH(R_(t,"spec.yaml")),before:wH(Uf(t,e,"spec.yaml"))},since:e,unsharded_commits:sye(t,e)}}function CO(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 $H(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!T_(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 tye(t,e){let r=ml(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(!(!O_(c)&&!O_(a)))if(s.startsWith("A")){let l=pl(R_(t,c));if(!l)continue;l.status==="done"?n.push(fl(l,"added-as-done")):l.status==="archived"&&n.push(fl(l,"archived"))}else if(s.startsWith("D")){let l=pl(Uf(t,e,a));l&&n.push(fl(l,"archived"))}else{let l=pl(R_(t,c));if(!l)continue;let d=pl(Uf(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(fl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(fl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(fl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function O_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function kH(t,e){$H(t,e);let r=ml(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(!O_(c)&&!O_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?pl(Uf(t,"HEAD",c)):null,f=l?null:pl(Uf(t,e,a)),p=d??f;p&&n.push({path:u?a:c,id:p.id,...p.slug?{slug:p.slug}:{},title:p.title,statusBefore:f?f.status:null,statusAfter:d?d.status:null,baseAcs:f?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function fl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>CO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function pl(t){if(t===null)return null;let e;try{e=(0,I_.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 R_(t,e){let r=xH(t,e);if(!Qge(r))return null;try{return eye(r,"utf8")}catch{return null}}function Uf(t,e,r){try{return ml(t,["show",`${e}:${r}`])}catch{return null}}function rye(t,e){let r=nye(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 nye(t){let e=R_(t,xH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,I_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function wH(t){let e={};if(t!==null)try{let n=(0,I_.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 sye(t,e){let r=ml(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);iye.test(a)&&(oye.test(a)||n.push({hash:s,subject:a}))}return n}var I_,iye,oye,hl=y(()=>{"use strict";I_=St(er(),1);ba();iye=/^(feat|fix)(\([^)]*\))?!?:/,oye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as EH}from"node:child_process";import{appendFileSync as aye,existsSync as DO,mkdirSync as cye,readFileSync as lye,renameSync as uye,statSync as dye}from"node:fs";import{userInfo as fye}from"node:os";import{dirname as pye,join as jO}from"node:path";function MO(t){return jO(t,AH,mye)}function tn(t,e){let r=MO(t),n=pye(r);DO(n)||cye(n,{recursive:!0});try{DO(r)&&dye(r).size>hye&&uye(r,jO(n,TH))}catch{}aye(r,`${JSON.stringify(e)} +`,"utf8")}function NO(t){if(!DO(t))return[];let e=lye(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function va(t){return NO(MO(t))}function P_(t){return[...NO(jO(t,AH,TH)),...NO(MO(t))]}function rn(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 gye(t){let e;try{e=EH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=fye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function yye(t){try{return EH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function qf(t,e){try{let r=va(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=yye(t),i=gye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=qf(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}tn(t,rn(e,o))}catch{}}var AH,mye,TH,hye,Mr=y(()=>{"use strict";AH=".cladding",mye="events.log.jsonl",TH="events.log.1.jsonl",hye=5*1024*1024});import{execFileSync as _ye}from"node:child_process";import{existsSync as OH,readdirSync as bye,readFileSync as vye,statSync as RH}from"node:fs";import{createHash as Sye}from"node:crypto";import{join as FO}from"node:path";function Sa(t){try{return _ye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function LO(t){let e=[],r=FO(t,"spec.yaml");OH(r)&&RH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=FO(t,"spec",i);if(!(!OH(o)||!RH(o).isDirectory()))for(let s of bye(o))s.endsWith(".yaml")&&e.push(FO(o,s))}e.sort();let n=Sye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(vye(i)),n.update("\0")}return n.digest("hex")}function C_(t,e){let r={featureId:e,gitHead:Sa(t),specDigest:LO(t),timestamp:new Date().toISOString()};return tn(t,rn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function D_(t,e){let r=va(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 N_(t,e,r,n){let i=rn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return tn(t,i),i}var Bf=y(()=>{"use strict";Mr()});import{readFileSync as wye,statSync as xye}from"node:fs";import{extname as $ye,resolve as zO,sep as kye}from"node:path";function nn(t){return Math.ceil(t.length/4)}function Tye(t,e){let r=zO(e),n=zO(r,t);return n===r||n.startsWith(r+kye)}function PH(t,e,r,n){if(!Tye(t,e))return{path:t,omitted:"unsafe-path"};if(!Eye.has($ye(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>IH)return{path:t,omitted:"too-large",bytes:o}}else{let l=zO(e,t);try{o=xye(l).size}catch{return{path:t,omitted:"missing"}}if(o>IH)return{path:t,omitted:"too-large",bytes:o};try{i=wye(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=` /* ... 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 yye,xH,_ye,R_=y(()=>{"use strict";yye=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"]),xH=2e6,_ye="\0"});function Sye(t){for(let i of vye)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 wye(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=Sye(a);c&&jO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function On(t){let e=kH.get(t);return e||(e=wye(t),kH.set(t,e)),e}var vye,kH,Sa=y(()=>{"use strict";vye=["derived:","fixture:","script:","self-dogfood:"];kH=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 Sr(t,e,r={}){let n=r.depth??1/0,i=On(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=xye(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 EH(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=On(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=Sr(t,e,{depth:1});return"not_found"in b,b}let d=MO(l,a.dependents,1/0).size;if(d===0){let b=Sr(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 _=Sr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=EH(_),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 $ye(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 AH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=$ye(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 TH=y(()=>{"use strict"});function kye(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=kye(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=AH(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";TH()});import{existsSync as RH,readdirSync as Eye,readFileSync as Aye}from"node:fs";import{join as UO}from"node:path";function qO(t,e=Oye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Rye(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 OH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Iye(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 Pye(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)=>OH(m)-OH(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(-Tye).map(Rye),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?Iye(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 Cye(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 Dye(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=Cye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Nye(t,e){let r=UO(t,".cladding","post-mortems");if(!RH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Eye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(Dye(Aye(UO(r,o),"utf8"),e,o))}catch{}return i}function IH(t,e){try{let r=E_(t),n=Nye(t,e),i=RH(UO(t,".cladding","events.log.1.jsonl"));return Pye(r,n,e,{truncated:i})}catch{return}}var Tye,Oye,PH=y(()=>{"use strict";jr();Tye=5,Oye=120});function D_(t,e,r){return rn(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:jye,o=e,s,a=On(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=IH(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>Mye&&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 rn(JSON.stringify(lo))>i},re=m,K=h;if($(re,K,0,0)){let se=Sr(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],Qr=0;for(;$(Xt,$i,lo,Qr);){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),Qr++}re=Xt,K=$i,lo+Qr>0&&x.push(`breaks: omitted ${lo} feature(s) / ${Qr} 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};rn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Pr=rn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Pr,truncated:x}}}var jye,Mye,N_=y(()=>{"use strict";R_();C_();LO();PH();wa();Sa();jye=3e3,Mye=3});function Xn(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 Fye(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 CH(t,e,r="."){let n=On(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=rn(JSON.stringify(p)),_="not_found"in m?b:rn(JSON.stringify(m)),S=rn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=rn(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(Xn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Xn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Xn(a(c))*10)/10,medianShrinkTruncated:Math.round(Xn(a(l))*10)/10,medianStructuralRatio:Math.round(Xn(u)*100)/100,medianSliceTokens:Math.round(Xn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Xn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Xn(o.map(f=>f.searchDepth)),p95Depth:Fye(o.map(f=>f.searchDepth),95),medianEdges:Xn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Xn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Xn(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 Lye,existsSync as BO,mkdirSync as zye,readFileSync as DH}from"node:fs";import{dirname as Uye,join as qye}from"node:path";function HO(t){return qye(t,Bye,Hye)}function Gye(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 NH(t,e){try{let r=Gye(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=Uye(o);return BO(s)||zye(s,{recursive:!0}),Lye(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function jH(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=DH(r,"utf8")}catch{return[]}let i=jH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function MH(t){let e=HO(t);if(!BO(e))return{snapshots:[],unreadable:!1};let r;try{r=DH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=jH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Lf(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 FH(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?` (${Lf(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 Bye,Hye,zf=y(()=>{"use strict";Ff();j_();Bye=".cladding",Hye="measure.jsonl"});import{existsSync as Zye}from"node:fs";import{join as Vye}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}** (${Wye[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 zH(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 ${Lf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Lf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Lf(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"} | ${Jye(l,r)} |`)}return n.join(` -`)}function Jye(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 Kye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Zye(Vye(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),LH(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)LH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function LH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=TO(r);n&&t.push(`- ${n}`)}t.push("")}var Wye,Kye,M_=y(()=>{"use strict";zf();j_();dl();Wye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Kye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Yye}from"node:fs";function Oi(t="./spec.yaml"){let e=Yye(t,"utf8");return(0,UH.parse)(e)}var UH,F_=y(()=>{"use strict";UH=St(er(),1)});var is=v((Mr,KO)=>{"use strict";var ZO=Mr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+BH(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_=Mr.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 Xye(t,e){return e+": "+t.toString()+` -`}L_.prototype.toString=function(e){return this.errors.map(Xye).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 qH=Mr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};qH.prototype=Object.create(Error.prototype,{constructor:{value:qH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var VO=Mr.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+BH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};VO.prototype.resolve=function(e){return HH(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=HH(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 Qn=Mr.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]+$/};Qn.regexp=Qn.regex;Qn.pattern=Qn.regex;Qn.ipv4=Qn["ip-address"];Mr.isFormat=function(e,r,n){if(typeof e=="string"&&Qn[r]!==void 0){if(Qn[r]instanceof RegExp)return Qn[r].test(e);if(typeof Qn[r]=="function")return Qn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var BH=Mr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Mr.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]=WO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function e_e(t,e,r){e[r]=t[r]}function t_e(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(Qye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(e_e.bind(null,t,n)),Object.keys(e).forEach(t_e.bind(null,t,e,n))),n}KO.exports.deepMerge=WO;Mr.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 r_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Mr.encodePath=function(e){return e.map(r_e).join("")};Mr.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};Mr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var HH=Mr.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 WH=v((y7e,VH)=>{"use strict";var nn=is(),Le=nn.ValidatorResult,os=nn.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(!nn.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(!nn.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(!nn.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(!nn.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 GH(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&&GH.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)GH.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(!nn.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 n_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var QO=is();eR.exports.SchemaScanResult=KH;function KH(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 JH=WH(),ss=is(),YH=z_().scan,XH=ss.ValidatorResult,i_e=ss.ValidatorResultError,Uf=ss.SchemaError,QH=ss.SchemaContext,o_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ri),this.attributes=Object.create(JH.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=YH(r||o_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 Uf("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 Uf('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)};tG.exports=Jt});var nG=v((v7e,ho)=>{"use strict";var s_e=ho.exports.Validator=rG();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 s_e;return n.validate(t,e,r)}});import{readFileSync as a_e}from"node:fs";import{dirname as c_e,join as l_e}from"node:path";import{fileURLToPath as u_e}from"node:url";function h_e(t){let e=m_e.validate(t,p_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function oG(t){let e=h_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 Eye,IH,Aye,j_=y(()=>{"use strict";Eye=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"]),IH=2e6,Aye="\0"});function Hf(t){for(let i of Oye)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 UO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Rye(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??[])UO(e,s,o);for(let s of i.modules??[])UO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Hf(a);c&&UO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function Rn(t){let e=CH.get(t);return e||(e=Rye(t),CH.set(t,e)),e}var Oye,CH,os=y(()=>{"use strict";Oye=["derived:","fixture:","script:","self-dogfood:"];CH=new WeakMap});function qO(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 Sr(t,e,r={}){let n=r.depth??1/0,i=Rn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Iye(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=qO(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:BO(i)}}var wa=y(()=>{"use strict";os()});function DH(t){return t.impacted.length}function F_(t,e,r={}){let n=r.initialDepth??M_.initialDepth,i=r.maxDepth??M_.maxDepth,o=r.coverageThreshold??M_.coverageThreshold,s=r.marginYieldThreshold??M_.marginYieldThreshold,a=Rn(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=Sr(t,e,{depth:1});return"not_found"in b,b}let d=qO(l,a.dependents,1/0).size;if(d===0){let b=Sr(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 _=Sr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=DH(_),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 M_,HO=y(()=>{"use strict";wa();os();M_={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 NH(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 jH=y(()=>{"use strict"});function Cye(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 gl(t,e){let r=Cye(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=NH(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 L_=y(()=>{"use strict";jH()});import{existsSync as FH,readdirSync as Dye,readFileSync as Nye}from"node:fs";import{join as ZO}from"node:path";function VO(t,e=Mye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Fye(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:VO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:VO(`done reverted \u2014 pre-push strict gate red${r}`)}}function MH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Lye(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 VO(n)}function zye(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)=>MH(m)-MH(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(-jye).map(Fye),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?Lye(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 GO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Uye(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 qye(t,e,r){let n=GO(t,/_Rolled back at_\s*`([^`]+)`/),i=GO(t,/Last failed gate:\s*`([^`]+)`/),o=GO(t,/Retry attempts:\s*(\d+)/),s=Uye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Bye(t,e){let r=ZO(t,".cladding","post-mortems");if(!FH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Dye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(qye(Nye(ZO(r,o),"utf8"),e,o))}catch{}return i}function LH(t,e){try{let r=P_(t),n=Bye(t,e),i=FH(ZO(t,".cladding","events.log.1.jsonl"));return zye(r,n,e,{truncated:i})}catch{return}}var jye,Mye,zH=y(()=>{"use strict";Mr();jye=5,Mye=120});function z_(t,e,r){return nn(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:Hye,o=e,s,a=Rn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=gl(t,o);if("not_found"in c)return c;let l=c.focus,u=LH(n,l.id),d=a&&a.size>0?e:l.id,f=F_(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>Gye&&z_(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)`]:[],uo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Xt]}};return nn(JSON.stringify(uo))>i},re=m,K=h;if($(re,K,0,0)){let se=Sr(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))],uo=0;for(;Xt.length>Ce.size&&$(Xt,K,uo,0);)Xt=Xt.slice(0,-1),uo++;let ki=[...h],en=0;for(;$(Xt,ki,uo,en);){let de=-1;for(let fo=ki.length-1;fo>=0;fo--)if(!Kt.has(ki[fo])){de=fo;break}if(de<0)break;ki.splice(de,1),en++}re=Xt,K=ki,uo+en>0&&x.push(`breaks: omitted ${uo} feature(s) / ${en} 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};nn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Cr=nn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Cr,truncated:x}}}var Hye,Gye,U_=y(()=>{"use strict";j_();L_();HO();zH();wa();os();Hye=3e3,Gye=3});function Qn(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 Zye(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 UH(t,e,r="."){let n=Rn(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=F_(t,f.id),g=!("not_found"in h),b=nn(JSON.stringify(p)),_="not_found"in m?b:nn(JSON.stringify(m)),S=nn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=nn(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(Qn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Qn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Qn(a(c))*10)/10,medianShrinkTruncated:Math.round(Qn(a(l))*10)/10,medianStructuralRatio:Math.round(Qn(u)*100)/100,medianSliceTokens:Math.round(Qn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Qn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Qn(o.map(f=>f.searchDepth)),p95Depth:Zye(o.map(f=>f.searchDepth),95),medianEdges:Qn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Qn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Qn(o.map(f=>f.regressionTests))},features:o}}var yl,q_=y(()=>{"use strict";j_();HO();U_();os();yl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Vye,existsSync as WO,mkdirSync as Wye,readFileSync as qH}from"node:fs";import{dirname as Kye,join as Jye}from"node:path";function KO(t){return Jye(t,Yye,Xye)}function Qye(t,e){return{timestamp:new Date().toISOString(),head:Sa(t),spec_digest:LO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function BH(t,e){try{let r=Qye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=JO(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=KO(t),s=Kye(o);return WO(s)||Wye(s,{recursive:!0}),Vye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function HH(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 JO(t,e){let r=KO(t);if(!WO(r))return[];let n;try{n=qH(r,"utf8")}catch{return[]}let i=HH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function GH(t){let e=KO(t);if(!WO(e))return{snapshots:[],unreadable:!1};let r;try{r=qH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=HH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Gf(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 ZH(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?` (${Gf(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(` ${yl}`),i.join(` +`)}var Yye,Xye,Zf=y(()=>{"use strict";Bf();q_();Yye=".cladding",Xye="measure.jsonl"});import{existsSync as e_e}from"node:fs";import{join as t_e}from"node:path";function _l(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}** (${r_e[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 WH(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 ${Gf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Gf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Gf(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`,"",yl),r.join(` +`)}function bl(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"} | ${i_e(l,r)} |`)}return n.join(` +`)}function i_e(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 n_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${e_e(t_e(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function vl(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),VH(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)VH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function VH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=CO(r);n&&t.push(`- ${n}`)}t.push("")}var r_e,n_e,B_=y(()=>{"use strict";Zf();q_();hl();r_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};n_e=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as o_e}from"node:fs";function Ri(t="./spec.yaml"){let e=o_e(t,"utf8");return(0,KH.parse)(e)}var KH,H_=y(()=>{"use strict";KH=St(er(),1)});var ss=v((Fr,eR)=>{"use strict";var YO=Fr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+YH(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()};YO.prototype.toString=function(){return this.property+" "+this.message};var G_=Fr.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};G_.prototype.addError=function(e){var r;if(typeof e=="string")r=new YO(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 YO(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};G_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function s_e(t,e){return e+": "+t.toString()+` +`}G_.prototype.toString=function(e){return this.errors.map(s_e).join("")};Object.defineProperty(G_.prototype,"valid",{get:function(){return!this.errors.length}});eR.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 JH=Fr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};JH.prototype=Object.create(Error.prototype,{constructor:{value:JH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var XO=Fr.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+YH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};XO.prototype.resolve=function(e){return XH(this.base,e)};XO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=XH(this.base,i||"");var s=new XO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var ei=Fr.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]+$/};ei.regexp=ei.regex;ei.pattern=ei.regex;ei.ipv4=ei["ip-address"];Fr.isFormat=function(e,r,n){if(typeof e=="string"&&ei[r]!==void 0){if(ei[r]instanceof RegExp)return ei[r].test(e);if(typeof ei[r]=="function")return ei[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var YH=Fr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Fr.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 a_e(t,e,r,n){typeof r=="object"?e[n]=QO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function c_e(t,e,r){e[r]=t[r]}function l_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=QO(t[n],e[n]):r[n]=e[n]}function QO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(a_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(c_e.bind(null,t,n)),Object.keys(e).forEach(l_e.bind(null,t,e,n))),n}eR.exports.deepMerge=QO;Fr.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 u_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Fr.encodePath=function(e){return e.map(u_e).join("")};Fr.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};Fr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var XH=Fr.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 rG=v((G7e,tG)=>{"use strict";var on=ss(),Le=on.ValidatorResult,as=on.SchemaError,tR={};tR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=tR.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 rR(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 as("anyOf must be an array");if(!r.anyOf.some(rR.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 as("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 as("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(rR.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(!on.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=rR.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(!on.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(!on.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 nR(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(!on.isSchema(s))throw new as('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(nR(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 as('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=nR(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 QH(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 as('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&&QH.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)QH.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(!on.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 d_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var iR=ss();oR.exports.SchemaScanResult=nG;function nG(t,e){this.id=t,this.ref=e}oR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=iR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=iR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!iR.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 iG=rG(),cs=ss(),oG=Z_().scan,sG=cs.ValidatorResult,f_e=cs.ValidatorResultError,Vf=cs.SchemaError,aG=cs.SchemaContext,p_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(iG.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=oG(r||p_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=cs.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Vf("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 Vf('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 Ii=Jt.prototype.types={};Ii.string=function(e){return typeof e=="string"};Ii.number=function(e){return typeof e=="number"&&isFinite(e)};Ii.integer=function(e){return typeof e=="number"&&e%1===0};Ii.boolean=function(e){return typeof e=="boolean"};Ii.array=function(e){return Array.isArray(e)};Ii.null=function(e){return e===null};Ii.date=function(e){return e instanceof Date};Ii.any=function(e){return!0};Ii.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};lG.exports=Jt});var dG=v((W7e,go)=>{"use strict";var m_e=go.exports.Validator=uG();go.exports.ValidatorResult=ss().ValidatorResult;go.exports.ValidatorResultError=ss().ValidatorResultError;go.exports.ValidationError=ss().ValidationError;go.exports.SchemaError=ss().SchemaError;go.exports.SchemaScanResult=Z_().SchemaScanResult;go.exports.scan=Z_().scan;go.exports.validate=function(t,e,r){var n=new m_e;return n.validate(t,e,r)}});import{readFileSync as h_e}from"node:fs";import{dirname as g_e,join as y_e}from"node:path";import{fileURLToPath as __e}from"node:url";function x_e(t){let e=w_e.validate(t,S_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function pG(t){let e=x_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var iG,d_e,f_e,p_e,m_e,sG=y(()=>{"use strict";iG=St(nG(),1),d_e=c_e(u_e(import.meta.url)),f_e=l_e(d_e,"schema.json"),p_e=JSON.parse(a_e(f_e,"utf8")),m_e=new iG.Validator});import{existsSync as tR,readdirSync as g_e}from"node:fs";import{dirname as y_e,join as ka,resolve as cG}from"node:path";function aG(t){return tR(t)?g_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Oi(ka(t,r))):[]}function Ea(t,e){U_=e?{cwd:cG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return U_&&e==="spec.yaml"&&cG(t)===U_.cwd?U_.spec:__e(t,e)}function __e(t,e){let r=ka(t,e),n=Oi(r),i=ka(t,y_e(e),"spec");if(!n.features||n.features.length===0){let o=aG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=aG(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 oG(n),n}var U_,Ue=y(()=>{"use strict";F_();sG();U_=null});import yl from"node:process";function iR(){return!!yl.stdout.isTTY}function L(t,e,r=""){let n=lG[t],i=r?` ${r}`:"";iR()?yl.stdout.write(`${rR[t]}${n}${nR} ${e}${i} -`):yl.stdout.write(`${n} ${e}${i} -`)}function qf(t,e,r=""){if(!iR())return;let n=r?` ${r}`:"";yl.stdout.write(`${uG}${rR.start}\xB7${nR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=lG[t],i=r?` ${r}`:"";iR()?yl.stdout.write(`${uG}${rR[t]}${n}${nR} ${e}${i} -`):yl.stdout.write(`${n} ${e}${i} -`)}var lG,rR,nR,uG,Ii=y(()=>{"use strict";lG={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",uG="\r\x1B[K"});import{createHash as PG}from"node:crypto";import{existsSync as J_e,readFileSync as aR,writeFileSync as Y_e}from"node:fs";import{join as q_}from"node:path";function X_e(t,e){let r=PG("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 DG(t,e){let r=PG("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,...CG);if(!J_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)!==DG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===X_e(e,n)?{state:"fresh"}:{state:"stale"}}function NG(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}: ${DG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=Q_e+`attested_modules: + `)}`)}var fG,b_e,v_e,S_e,w_e,mG=y(()=>{"use strict";fG=St(dG(),1),b_e=g_e(__e(import.meta.url)),v_e=y_e(b_e,"schema.json"),S_e=JSON.parse(h_e(v_e,"utf8")),w_e=new fG.Validator});import{existsSync as sR,readdirSync as $_e}from"node:fs";import{dirname as k_e,join as ka,resolve as gG}from"node:path";function hG(t){return sR(t)?$_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(ka(t,r))):[]}function Ea(t,e){V_=e?{cwd:gG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return V_&&e==="spec.yaml"&&gG(t)===V_.cwd?V_.spec:E_e(t,e)}function E_e(t,e){let r=ka(t,e),n=Ri(r),i=ka(t,k_e(e),"spec");if(!n.features||n.features.length===0){let o=hG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=hG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");sR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(sR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return pG(n),n}var V_,Ue=y(()=>{"use strict";H_();mG();V_=null});import Sl from"node:process";function lR(){return!!Sl.stdout.isTTY}function L(t,e,r=""){let n=yG[t],i=r?` ${r}`:"";lR()?Sl.stdout.write(`${aR[t]}${n}${cR} ${e}${i} +`):Sl.stdout.write(`${n} ${e}${i} +`)}function Wf(t,e,r=""){if(!lR())return;let n=r?` ${r}`:"";Sl.stdout.write(`${_G}${aR.start}\xB7${cR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=yG[t],i=r?` ${r}`:"";lR()?Sl.stdout.write(`${_G}${aR[t]}${n}${cR} ${e}${i} +`):Sl.stdout.write(`${n} ${e}${i} +`)}var yG,aR,cR,_G,Pi=y(()=>{"use strict";yG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},aR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},cR="\x1B[0m",_G="\r\x1B[K"});import{createHash as BG}from"node:crypto";import{existsSync as ube,readFileSync as fR,writeFileSync as dbe}from"node:fs";import{join as W_}from"node:path";function fbe(t,e){let r=BG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(fR(W_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function GG(t,e){let r=BG("sha256");try{r.update(fR(W_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ls(t){let e=W_(t,...HG);if(!ube(e))return null;let r;try{r=fR(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 K_(t){return t.features?.size??t.v1?.size??0}function J_(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)!==GG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===fbe(e,n)?{state:"fresh"}:{state:"stale"}}function ZG(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}: ${GG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=pbe+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return Y_e(q_(t,...CG),s,"utf8"),!0}var CG,Q_e,vl=y(()=>{"use strict";CG=["spec","attestation.yaml"];Q_e=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return dbe(W_(t,...HG),s,"utf8"),!0}var HG,pbe,xl=y(()=>{"use strict";HG=["spec","attestation.yaml"];pbe=`# 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 +212,55 @@ 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 cR}from"node:path";function G_(t){cs={cwd:cR(t),results:new Map}}function jG(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 ebe}from"node:url";var wl,tbe,lR,uR,xl=y(()=>{wl=(t,e)=>{let r=uR(tbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},tbe=t=>lR(t)?t.toString():t,lR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,uR=t=>t instanceof URL?ebe(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 rbe}from"node:string_decoder";var MG,FG,qt,_o,nbe,LG,ibe,K_,zG,obe,Hf,sbe,fR,abe,on=y(()=>{({toString:MG}=Object.prototype),FG=t=>MG.call(t)==="[object ArrayBuffer]",qt=t=>MG.call(t)==="[object Uint8Array]",_o=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),nbe=new TextEncoder,LG=t=>nbe.encode(t),ibe=new TextDecoder,K_=t=>ibe.decode(t),zG=(t,e)=>obe(t,e).join(""),obe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new rbe(e),n=t.map(o=>typeof o=="string"?LG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Hf=t=>t.length===1&&qt(t[0])?t[0]:fR(sbe(t)),sbe=t=>t.map(e=>typeof e=="string"?LG(e):e),fR=t=>{let e=new Uint8Array(abe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},abe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as cbe}from"node:child_process";var HG,GG,lbe,ube,UG,dbe,qG,BG,fbe,ZG=y(()=>{yo();on();HG=t=>Array.isArray(t)&&Array.isArray(t.raw),GG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=lbe({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,{}]},lbe=({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}=ube(i,t.raw[n]),c=qG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>BG(d)):[BG(l)];return qG(c,u,a)},ube=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=UG.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)],BG=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 fbe(t);throw t instanceof cbe||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`)},fbe=({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 ei,J_,Rn,Y_,bo=y(()=>{ei=t=>J_.includes(t),J_=[pR.stdin,pR.stdout,pR.stderr],Rn=["stdin","stdout","stderr"],Y_=t=>Rn[t]??`stdio[${t}]`});import{debuglog as pbe}from"node:util";var WG,mR,mbe,hbe,gbe,ybe,VG,_be,hR,bbe,vbe,Sbe,wbe,gR,vo,So=y(()=>{yo();bo();WG=t=>{let e={...t};for(let r of gR)e[r]=mR(t,r);return e},mR=(t,e)=>{let r=Array.from({length:mbe(t)+1}),n=hbe(t[e],r,e);return vbe(n,e)},mbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Rn.length):Rn.length,hbe=(t,e,r)=>Ot(t)?gbe(t,e,r):e.fill(t),gbe=(t,e,r)=>{for(let n of Object.keys(t).sort(ybe))for(let i of _be(n,r,e))e[i]=t[n];return e},ybe=(t,e)=>VG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,_be=(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. +`});import{resolve as pR}from"node:path";function Y_(t){us={cwd:pR(t),results:new Map}}function VG(t,e,r){!us||us.cwd!==pR(e)||us.results.set(t,r)}function X_(t,e){return!us||us.cwd!==pR(e)?null:us.results.get(t)??null}function Q_(){us=null}var us,$l=y(()=>{"use strict";us=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 _o=y(()=>{});import{fileURLToPath as mbe}from"node:url";var kl,hbe,mR,hR,El=y(()=>{kl=(t,e)=>{let r=hR(hbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},hbe=t=>mR(t)?t.toString():t,mR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,hR=t=>t instanceof URL?mbe(t):t});var eb,gR=y(()=>{_o();El();eb=(t,e=[],r={})=>{let n=kl(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 gbe}from"node:string_decoder";var WG,KG,qt,bo,ybe,JG,_be,tb,YG,bbe,Jf,vbe,yR,Sbe,sn=y(()=>{({toString:WG}=Object.prototype),KG=t=>WG.call(t)==="[object ArrayBuffer]",qt=t=>WG.call(t)==="[object Uint8Array]",bo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ybe=new TextEncoder,JG=t=>ybe.encode(t),_be=new TextDecoder,tb=t=>_be.decode(t),YG=(t,e)=>bbe(t,e).join(""),bbe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new gbe(e),n=t.map(o=>typeof o=="string"?JG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Jf=t=>t.length===1&&qt(t[0])?t[0]:yR(vbe(t)),vbe=t=>t.map(e=>typeof e=="string"?JG(e):e),yR=t=>{let e=new Uint8Array(Sbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Sbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as wbe}from"node:child_process";var tZ,rZ,xbe,$be,XG,kbe,QG,eZ,Ebe,nZ=y(()=>{_o();sn();tZ=t=>Array.isArray(t)&&Array.isArray(t.raw),rZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=xbe({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,{}]},xbe=({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}=$be(i,t.raw[n]),c=QG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>eZ(d)):[eZ(l)];return QG(c,u,a)},$be=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=XG.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)],eZ=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 Ebe(t);throw t instanceof wbe||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`)},Ebe=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return tb(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 _R from"node:process";var ti,rb,In,nb,vo=y(()=>{ti=t=>rb.includes(t),rb=[_R.stdin,_R.stdout,_R.stderr],In=["stdin","stdout","stderr"],nb=t=>In[t]??`stdio[${t}]`});import{debuglog as Abe}from"node:util";var oZ,bR,Tbe,Obe,Rbe,Ibe,iZ,Pbe,vR,Cbe,Dbe,Nbe,jbe,SR,So,wo=y(()=>{_o();vo();oZ=t=>{let e={...t};for(let r of SR)e[r]=bR(t,r);return e},bR=(t,e)=>{let r=Array.from({length:Tbe(t)+1}),n=Obe(t[e],r,e);return Dbe(n,e)},Tbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,In.length):In.length,Obe=(t,e,r)=>Ot(t)?Rbe(t,e,r):e.fill(t),Rbe=(t,e,r)=>{for(let n of Object.keys(t).sort(Ibe))for(let i of Pbe(n,r,e))e[i]=t[n];return e},Ibe=(t,e)=>iZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,Pbe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=vR(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]},hR=t=>{if(t==="all")return t;if(Rn.includes(t))return Rn.indexOf(t);let e=bbe.exec(t);if(e!==null)return Number(e[1])},bbe=/^fd(\d+)$/,vbe=(t,e)=>t.map(r=>r===void 0?wbe[e]:r),Sbe=pbe("execa").enabled?"full":"none",wbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Sbe,stripFinalNewline:!0},gR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],vo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var $l,kl,KG,yR,xbe,X_,Q_,ls=y(()=>{So();$l=({verbose:t},e)=>yR(t,e)!=="none",kl=({verbose:t},e)=>!["none","short"].includes(yR(t,e)),KG=({verbose:t},e)=>{let r=yR(t,e);return X_(r)?r:void 0},yR=(t,e)=>e===void 0?xbe(t):vo(t,e),xbe=t=>t.find(e=>X_(e))??Q_.findLast(e=>t.includes(e)),X_=t=>typeof t=="function",Q_=["none","short","full"]});import{platform as $be}from"node:process";import{stripVTControlCharacters as kbe}from"node:util";var JG,Gf,YG,Ebe,Abe,Tbe,Obe,Rbe,Ibe,Pbe,eb=y(()=>{JG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Ibe(YG(o))).join(" ");return{command:n,escapedCommand:i}},Gf=t=>kbe(t).split(` -`).map(e=>YG(e)).join(` -`),YG=t=>t.replaceAll(Tbe,e=>Ebe(e)),Ebe=t=>{let e=Obe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Rbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Abe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Tbe=Abe(),Obe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Rbe=65535,Ibe=t=>Pbe.test(t)?t:$be==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Pbe=/^[\w./-]+$/});import XG from"node:process";function _R(){let{env:t}=XG,{TERM:e,TERM_PROGRAM:r}=t;return XG.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 QG=y(()=>{});var eZ,tZ,Cbe,Dbe,Nbe,jbe,Mbe,tb,$Qe,rZ=y(()=>{QG();eZ={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"},tZ={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"},Cbe={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"},Dbe={...eZ,...tZ},Nbe={...eZ,...Cbe},jbe=_R(),Mbe=jbe?Dbe:Nbe,tb=Mbe,$Qe=Object.entries(tZ)});import Fbe from"node:tty";var Lbe,be,AQe,nZ,TQe,OQe,RQe,IQe,PQe,CQe,DQe,NQe,jQe,MQe,FQe,LQe,zQe,UQe,qQe,rb,BQe,HQe,GQe,ZQe,VQe,WQe,KQe,JQe,YQe,iZ,XQe,oZ,QQe,eet,tet,ret,net,iet,oet,set,aet,cet,uet,bR=y(()=>{Lbe=Fbe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Lbe)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}},AQe=be(0,0),nZ=be(1,22),TQe=be(2,22),OQe=be(3,23),RQe=be(4,24),IQe=be(53,55),PQe=be(7,27),CQe=be(8,28),DQe=be(9,29),NQe=be(30,39),jQe=be(31,39),MQe=be(32,39),FQe=be(33,39),LQe=be(34,39),zQe=be(35,39),UQe=be(36,39),qQe=be(37,39),rb=be(90,39),BQe=be(40,49),HQe=be(41,49),GQe=be(42,49),ZQe=be(43,49),VQe=be(44,49),WQe=be(45,49),KQe=be(46,49),JQe=be(47,49),YQe=be(100,49),iZ=be(91,39),XQe=be(92,39),oZ=be(93,39),QQe=be(94,39),eet=be(95,39),tet=be(96,39),ret=be(97,39),net=be(101,49),iet=be(102,49),oet=be(103,49),set=be(104,49),aet=be(105,49),cet=be(106,49),uet=be(107,49)});var sZ=y(()=>{bR();bR()});var lZ,Ube,nb,aZ,qbe,cZ,Bbe,uZ=y(()=>{rZ();sZ();lZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Ube(r),c=qbe[t]({failed:o,reject:s,piped:n}),l=Bbe[t]({reject:s});return`${rb(`[${a}]`)} ${rb(`[${i}]`)} ${l(c)} ${l(e)}`},Ube=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"),aZ=({failed:t,reject:e})=>t?e?tb.cross:tb.warning:tb.tick,qbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:aZ,duration:aZ},cZ=t=>t,Bbe={command:()=>nZ,output:()=>cZ,ipc:()=>cZ,error:({reject:t})=>t?iZ:oZ,duration:()=>rb}});var dZ,Hbe,Gbe,fZ=y(()=>{ls();dZ=(t,e,r)=>{let n=KG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Hbe(i,o,n)).filter(i=>i!==void 0).map(i=>Gbe(i)).join("")},Hbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Gbe=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},vR=t=>{if(t==="all")return t;if(In.includes(t))return In.indexOf(t);let e=Cbe.exec(t);if(e!==null)return Number(e[1])},Cbe=/^fd(\d+)$/,Dbe=(t,e)=>t.map(r=>r===void 0?jbe[e]:r),Nbe=Abe("execa").enabled?"full":"none",jbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Nbe,stripFinalNewline:!0},SR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],So=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Al,Tl,sZ,wR,Mbe,ib,ob,ds=y(()=>{wo();Al=({verbose:t},e)=>wR(t,e)!=="none",Tl=({verbose:t},e)=>!["none","short"].includes(wR(t,e)),sZ=({verbose:t},e)=>{let r=wR(t,e);return ib(r)?r:void 0},wR=(t,e)=>e===void 0?Mbe(t):So(t,e),Mbe=t=>t.find(e=>ib(e))??ob.findLast(e=>t.includes(e)),ib=t=>typeof t=="function",ob=["none","short","full"]});import{platform as Fbe}from"node:process";import{stripVTControlCharacters as Lbe}from"node:util";var aZ,Yf,cZ,zbe,Ube,qbe,Bbe,Hbe,Gbe,Zbe,sb=y(()=>{aZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Gbe(cZ(o))).join(" ");return{command:n,escapedCommand:i}},Yf=t=>Lbe(t).split(` +`).map(e=>cZ(e)).join(` +`),cZ=t=>t.replaceAll(qbe,e=>zbe(e)),zbe=t=>{let e=Bbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Hbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Ube=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},qbe=Ube(),Bbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Hbe=65535,Gbe=t=>Zbe.test(t)?t:Fbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Zbe=/^[\w./-]+$/});import lZ from"node:process";function xR(){let{env:t}=lZ,{TERM:e,TERM_PROGRAM:r}=t;return lZ.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 uZ=y(()=>{});var dZ,fZ,Vbe,Wbe,Kbe,Jbe,Ybe,ab,tet,pZ=y(()=>{uZ();dZ={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"},fZ={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"},Vbe={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"},Wbe={...dZ,...fZ},Kbe={...dZ,...Vbe},Jbe=xR(),Ybe=Jbe?Wbe:Kbe,ab=Ybe,tet=Object.entries(fZ)});import Xbe from"node:tty";var Qbe,be,iet,mZ,oet,set,aet,cet,uet,det,fet,pet,met,het,get,yet,_et,bet,vet,cb,wet,xet,$et,ket,Eet,Aet,Tet,Oet,Ret,hZ,Iet,gZ,Pet,Cet,Det,Net,jet,Met,Fet,Let,zet,Uet,qet,$R=y(()=>{Qbe=Xbe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Qbe)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}},iet=be(0,0),mZ=be(1,22),oet=be(2,22),set=be(3,23),aet=be(4,24),cet=be(53,55),uet=be(7,27),det=be(8,28),fet=be(9,29),pet=be(30,39),met=be(31,39),het=be(32,39),get=be(33,39),yet=be(34,39),_et=be(35,39),bet=be(36,39),vet=be(37,39),cb=be(90,39),wet=be(40,49),xet=be(41,49),$et=be(42,49),ket=be(43,49),Eet=be(44,49),Aet=be(45,49),Tet=be(46,49),Oet=be(47,49),Ret=be(100,49),hZ=be(91,39),Iet=be(92,39),gZ=be(93,39),Pet=be(94,39),Cet=be(95,39),Det=be(96,39),Net=be(97,39),jet=be(101,49),Met=be(102,49),Fet=be(103,49),Let=be(104,49),zet=be(105,49),Uet=be(106,49),qet=be(107,49)});var yZ=y(()=>{$R();$R()});var vZ,tve,lb,_Z,rve,bZ,nve,SZ=y(()=>{pZ();yZ();vZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=tve(r),c=rve[t]({failed:o,reject:s,piped:n}),l=nve[t]({reject:s});return`${cb(`[${a}]`)} ${cb(`[${i}]`)} ${l(c)} ${l(e)}`},tve=t=>`${lb(t.getHours(),2)}:${lb(t.getMinutes(),2)}:${lb(t.getSeconds(),2)}.${lb(t.getMilliseconds(),3)}`,lb=(t,e)=>String(t).padStart(e,"0"),_Z=({failed:t,reject:e})=>t?e?ab.cross:ab.warning:ab.tick,rve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:_Z,duration:_Z},bZ=t=>t,nve={command:()=>mZ,output:()=>bZ,ipc:()=>bZ,error:({reject:t})=>t?hZ:gZ,duration:()=>cb}});var wZ,ive,ove,xZ=y(()=>{ds();wZ=(t,e,r)=>{let n=sZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>ive(i,o,n)).filter(i=>i!==void 0).map(i=>ove(i)).join("")},ive=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ove=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as Zbe}from"node:util";var Pi,Vbe,Wbe,Kbe,ib,Jbe,El=y(()=>{eb();uZ();fZ();Pi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Vbe({type:t,result:i,verboseInfo:n}),s=Wbe(e,o),a=dZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Vbe=({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}),Wbe=(t,e)=>t.split(` -`).map(r=>Kbe({...e,message:r})),Kbe=t=>({verboseLine:lZ(t),verboseObject:t}),ib=t=>{let e=typeof t=="string"?t:Zbe(t);return Gf(e).replaceAll(" "," ".repeat(Jbe))},Jbe=2});var pZ,mZ=y(()=>{ls();El();pZ=(t,e)=>{$l(e)&&Pi({type:"command",verboseMessage:t,verboseInfo:e})}});var hZ,Ybe,Xbe,Qbe,gZ=y(()=>{ls();hZ=(t,e,r)=>{Qbe(t);let n=Ybe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Ybe=t=>$l({verbose:t})?Xbe++:void 0,Xbe=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(!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 yZ}from"node:process";var ob,vR,sb=y(()=>{ob=()=>yZ.bigint(),vR=t=>Number(yZ.bigint()-t)/1e6});var ab,SR=y(()=>{mZ();gZ();sb();eb();So();ab=(t,e,r)=>{let n=ob(),{command:i,escapedCommand:o}=JG(t,e),s=mR(r,"verbose"),a=hZ(s,o,{...r});return pZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var wZ=v((Met,SZ)=>{SZ.exports=vZ;vZ.sync=tve;var _Z=Ge("fs");function eve(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{EZ.exports=$Z;$Z.sync=rve;var xZ=Ge("fs");function $Z(t,e,r){xZ.stat(t,function(n,i){r(n,n?!1:kZ(i,e))})}function rve(t,e){return kZ(xZ.statSync(t),e)}function kZ(t,e){return t.isFile()&&nve(t,e)}function nve(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 OZ=v((zet,TZ)=>{var Let=Ge("fs"),cb;process.platform==="win32"||global.TESTING_WINDOWS?cb=wZ():cb=AZ();TZ.exports=wR;wR.sync=ive;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 ive(t,e){try{return cb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var jZ=v((Uet,NZ)=>{var Al=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",RZ=Ge("path"),ove=Al?";":":",IZ=OZ(),PZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),CZ=(t,e)=>{let r=e.colon||ove,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}},DZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=CZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(PZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=RZ.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];IZ(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)},sve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=CZ(t,e),o=[];for(let s=0;s{"use strict";var MZ=(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=MZ;xR.exports.default=MZ});var qZ=v((Bet,UZ)=>{"use strict";var LZ=Ge("path"),ave=jZ(),cve=FZ();function zZ(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=ave.sync(t.command,{path:r[cve({env:r})],pathExt:e?LZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=LZ.resolve(i?t.options.cwd:"",s)),s}function lve(t){return zZ(t)||zZ(t,!0)}UZ.exports=lve});var BZ=v((Het,kR)=>{"use strict";var $R=/([()\][%!^"`<>&|;, *?])/g;function uve(t){return t=t.replace($R,"^$1"),t}function dve(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=uve;kR.exports.argument=dve});var GZ=v((Get,HZ)=>{"use strict";HZ.exports=/^#!(.*)/});var VZ=v((Zet,ZZ)=>{"use strict";var fve=GZ();ZZ.exports=(t="")=>{let e=t.match(fve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var KZ=v((Vet,WZ)=>{"use strict";var ER=Ge("fs"),pve=VZ();function mve(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 pve(r.toString())}WZ.exports=mve});var QZ=v((Wet,XZ)=>{"use strict";var hve=Ge("path"),JZ=qZ(),YZ=BZ(),gve=KZ(),yve=process.platform==="win32",_ve=/\.(?:com|exe)$/i,bve=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function vve(t){t.file=JZ(t);let e=t.file&&gve(t.file);return e?(t.args.unshift(t.file),t.command=e,JZ(t)):t.file}function Sve(t){if(!yve)return t;let e=vve(t),r=!_ve.test(e);if(t.options.forceShell||r){let n=bve.test(e);t.command=hve.normalize(t.command),t.command=YZ.command(t.command),t.args=t.args.map(o=>YZ.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 wve(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:Sve(n)}XZ.exports=wve});var r9=v((Ket,t9)=>{"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 xve(t,e){if(!AR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=e9(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function e9(t,e){return AR&&t===1&&!e.file?TR(e.original,"spawn"):null}function $ve(t,e){return AR&&t===1&&!e.file?TR(e.original,"spawnSync"):null}t9.exports={hookChildProcess:xve,verifyENOENT:e9,verifyENOENTSync:$ve,notFoundError:TR}});var o9=v((Jet,Tl)=>{"use strict";var n9=Ge("child_process"),OR=QZ(),RR=r9();function i9(t,e,r){let n=OR(t,e,r),i=n9.spawn(n.command,n.args,n.options);return RR.hookChildProcess(i,n),i}function kve(t,e,r){let n=OR(t,e,r),i=n9.spawnSync(n.command,n.args,n.options);return i.error=i.error||RR.verifyENOENTSync(i.status,n),i}Tl.exports=i9;Tl.exports.spawn=i9;Tl.exports.sync=kve;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 s9=y(()=>{});var a9=y(()=>{});import{promisify as Eve}from"node:util";import{execFile as Ave,execFileSync as ttt}from"node:child_process";import c9 from"node:path";import{fileURLToPath as Tve}from"node:url";function ub(t){return t instanceof URL?Tve(t):t}function l9(t){return{*[Symbol.iterator](){let e=c9.resolve(ub(t)),r;for(;r!==e;)yield e,r=e,e=c9.resolve(e,"..")}}}var itt,ott,u9=y(()=>{a9();itt=Eve(Ave);ott=10*1024*1024});import db from"node:process";import Oa from"node:path";var Ove,Rve,Ive,d9,f9=y(()=>{s9();u9();Ove=({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&&Rve(s,a,o),i&&Ive(s,a,n,o),e===""||e===Oa.delimiter?`${s.join(Oa.delimiter)}${e}`:[...s,e].join(Oa.delimiter)},Rve=(t,e,r)=>{for(let n of l9(r)){let i=Oa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Ive=(t,e,r,n)=>{let i=Oa.resolve(n,ub(r),"..");e.includes(i)||t.push(i)},d9=({env:t=db.env,...e}={})=>{t={...t};let r=lb({env:t});return e.path=t[r],t[r]=Ove(e),t}});var p9,ti,m9,h9,g9,fb,Zf,Vf,Ra=y(()=>{p9=(t,e,r)=>{let n=r?Vf:Zf,i=t instanceof ti?{}:{cause:t};return new n(e,i)},ti=class extends Error{},m9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,g9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},h9=t=>fb(t)&&g9 in t,g9=Symbol("isExecaError"),fb=t=>Object.prototype.toString.call(t)==="[object Error]",Zf=class extends Error{};m9(Zf,Zf.name);Vf=class extends Error{};m9(Vf,Vf.name)});var y9,Pve,_9,b9,v9=y(()=>{y9=()=>{let t=b9-_9+1;return Array.from({length:t},Pve)},Pve=(t,e)=>({name:`SIGRT${e+1}`,number:_9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),_9=34,b9=64});var S9,w9=y(()=>{S9=[{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 Cve}from"node:os";var IR,Dve,x9=y(()=>{w9();v9();IR=()=>{let t=y9();return[...S9,...t].map(Dve)},Dve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Cve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Nve}from"node:os";var jve,Mve,$9,Fve,Lve,zve,wtt,k9=y(()=>{x9();jve=()=>{let t=IR();return Object.fromEntries(t.map(Mve))},Mve=({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}],$9=jve(),Fve=()=>{let t=IR(),e=65,r=Array.from({length:e},(n,i)=>Lve(i,t));return Object.assign({},...r)},Lve=(t,e)=>{let r=zve(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}}},zve=(t,e)=>{let r=e.find(({name:n})=>Nve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},wtt=Fve()});import{constants as Wf}from"node:os";var A9,T9,O9,Uve,qve,E9,Bve,PR,Hve,Gve,pb,Kf=y(()=>{k9();A9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return O9(t,e)},T9=t=>t===0?t:O9(t,"`subprocess.kill()`'s argument"),O9=(t,e)=>{if(Number.isInteger(t))return Uve(t,e);if(typeof t=="string")return Bve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${PR()}`)},Uve=(t,e)=>{if(E9.has(t))return E9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${PR()}`)},qve=()=>new Map(Object.entries(Wf.signals).reverse().map(([t,e])=>[e,t])),E9=qve(),Bve=(t,e)=>{if(t in Wf.signals)return t;throw t.toUpperCase()in Wf.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: ${Hve()}. -Available signal numbers: ${Gve()}.`,Hve=()=>Object.keys(Wf.signals).sort().map(t=>`'${t}'`).join(", "),Gve=()=>[...new Set(Object.values(Wf.signals).sort((t,e)=>t-e))].join(", "),pb=t=>$9[t].description});import{setTimeout as Zve}from"node:timers/promises";var R9,Vve,I9,Wve,Kve,Jve,CR,mb=y(()=>{Ra();Kf();R9=t=>{if(t===!1)return t;if(t===!0)return Vve;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},Vve=1e3*5,I9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Wve(s,a,r);Kve(l,n);let u=t(c);return Jve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Wve=(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:T9(n),error:i}},Kve=(t,e)=>{t!==void 0&&e.reject(t)},Jve=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 Zve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Yve}from"node:events";var hb,DR=y(()=>{hb=async(t,e)=>{t.aborted||await Yve(t,"abort",{signal:e})}});var P9,C9,Xve,NR=y(()=>{DR();P9=({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)}`)},C9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Xve(t,e,n,i)],Xve=async(t,e,r,{signal:n})=>{throw await hb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Ol,Qve,jR,D9,N9,gb,j9,M9,F9,L9,z9,U9,eSe,tSe,rSe,ri,nSe,us,Rl,Il=y(()=>{Ol=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Qve(t,e,r),jR(t,e,n)},Qve=(t,e,r)=>{if(!r)throw new Error(`${ri(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},jR=(t,e,r)=>{if(!r)throw new Error(`${ri(t,e)} cannot be used: the ${us(e)} has already exited or disconnected.`)},D9=t=>{throw new Error(`${ri("getOneMessage",t)} could not complete: the ${us(t)} exited or disconnected.`)},N9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${us(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as sve}from"node:util";var Ci,ave,cve,lve,ub,uve,Ol=y(()=>{sb();SZ();xZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=ave({type:t,result:i,verboseInfo:n}),s=cve(e,o),a=wZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},ave=({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}),cve=(t,e)=>t.split(` +`).map(r=>lve({...e,message:r})),lve=t=>({verboseLine:vZ(t),verboseObject:t}),ub=t=>{let e=typeof t=="string"?t:sve(t);return Yf(e).replaceAll(" "," ".repeat(uve))},uve=2});var $Z,kZ=y(()=>{ds();Ol();$Z=(t,e)=>{Al(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var EZ,dve,fve,pve,AZ=y(()=>{ds();EZ=(t,e,r)=>{pve(t);let n=dve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},dve=t=>Al({verbose:t})?fve++:void 0,fve=0n,pve=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(!ob.includes(e)&&!ib(e)){let r=ob.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as TZ}from"node:process";var db,kR,fb=y(()=>{db=()=>TZ.bigint(),kR=t=>Number(TZ.bigint()-t)/1e6});var pb,ER=y(()=>{kZ();AZ();fb();sb();wo();pb=(t,e,r)=>{let n=db(),{command:i,escapedCommand:o}=aZ(t,e),s=bR(r,"verbose"),a=EZ(s,o,{...r});return $Z(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var CZ=v((mtt,PZ)=>{PZ.exports=IZ;IZ.sync=hve;var OZ=Ge("fs");function mve(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{MZ.exports=NZ;NZ.sync=gve;var DZ=Ge("fs");function NZ(t,e,r){DZ.stat(t,function(n,i){r(n,n?!1:jZ(i,e))})}function gve(t,e){return jZ(DZ.statSync(t),e)}function jZ(t,e){return t.isFile()&&yve(t,e)}function yve(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 zZ=v((ytt,LZ)=>{var gtt=Ge("fs"),mb;process.platform==="win32"||global.TESTING_WINDOWS?mb=CZ():mb=FZ();LZ.exports=AR;AR.sync=_ve;function AR(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){AR(t,e||{},function(o,s){o?i(o):n(s)})})}mb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function _ve(t,e){try{return mb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var VZ=v((_tt,ZZ)=>{var Rl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",UZ=Ge("path"),bve=Rl?";":":",qZ=zZ(),BZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),HZ=(t,e)=>{let r=e.colon||bve,n=t.match(/\//)||Rl&&t.match(/\\/)?[""]:[...Rl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Rl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Rl?i.split(r):[""];return Rl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},GZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=HZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(BZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=UZ.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];qZ(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)},vve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=HZ(t,e),o=[];for(let s=0;s{"use strict";var WZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};TR.exports=WZ;TR.exports.default=WZ});var QZ=v((vtt,XZ)=>{"use strict";var JZ=Ge("path"),Sve=VZ(),wve=KZ();function YZ(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=Sve.sync(t.command,{path:r[wve({env:r})],pathExt:e?JZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=JZ.resolve(i?t.options.cwd:"",s)),s}function xve(t){return YZ(t)||YZ(t,!0)}XZ.exports=xve});var e9=v((Stt,RR)=>{"use strict";var OR=/([()\][%!^"`<>&|;, *?])/g;function $ve(t){return t=t.replace(OR,"^$1"),t}function kve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(OR,"^$1"),e&&(t=t.replace(OR,"^$1")),t}RR.exports.command=$ve;RR.exports.argument=kve});var r9=v((wtt,t9)=>{"use strict";t9.exports=/^#!(.*)/});var i9=v((xtt,n9)=>{"use strict";var Eve=r9();n9.exports=(t="")=>{let e=t.match(Eve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var s9=v(($tt,o9)=>{"use strict";var IR=Ge("fs"),Ave=i9();function Tve(t){let r=Buffer.alloc(150),n;try{n=IR.openSync(t,"r"),IR.readSync(n,r,0,150,0),IR.closeSync(n)}catch{}return Ave(r.toString())}o9.exports=Tve});var u9=v((ktt,l9)=>{"use strict";var Ove=Ge("path"),a9=QZ(),c9=e9(),Rve=s9(),Ive=process.platform==="win32",Pve=/\.(?:com|exe)$/i,Cve=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Dve(t){t.file=a9(t);let e=t.file&&Rve(t.file);return e?(t.args.unshift(t.file),t.command=e,a9(t)):t.file}function Nve(t){if(!Ive)return t;let e=Dve(t),r=!Pve.test(e);if(t.options.forceShell||r){let n=Cve.test(e);t.command=Ove.normalize(t.command),t.command=c9.command(t.command),t.args=t.args.map(o=>c9.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 jve(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:Nve(n)}l9.exports=jve});var p9=v((Ett,f9)=>{"use strict";var PR=process.platform==="win32";function CR(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 Mve(t,e){if(!PR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=d9(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function d9(t,e){return PR&&t===1&&!e.file?CR(e.original,"spawn"):null}function Fve(t,e){return PR&&t===1&&!e.file?CR(e.original,"spawnSync"):null}f9.exports={hookChildProcess:Mve,verifyENOENT:d9,verifyENOENTSync:Fve,notFoundError:CR}});var g9=v((Att,Il)=>{"use strict";var m9=Ge("child_process"),DR=u9(),NR=p9();function h9(t,e,r){let n=DR(t,e,r),i=m9.spawn(n.command,n.args,n.options);return NR.hookChildProcess(i,n),i}function Lve(t,e,r){let n=DR(t,e,r),i=m9.spawnSync(n.command,n.args,n.options);return i.error=i.error||NR.verifyENOENTSync(i.status,n),i}Il.exports=h9;Il.exports.spawn=h9;Il.exports.sync=Lve;Il.exports._parse=DR;Il.exports._enoent=NR});function hb(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 y9=y(()=>{});var _9=y(()=>{});import{promisify as zve}from"node:util";import{execFile as Uve,execFileSync as Ptt}from"node:child_process";import b9 from"node:path";import{fileURLToPath as qve}from"node:url";function gb(t){return t instanceof URL?qve(t):t}function v9(t){return{*[Symbol.iterator](){let e=b9.resolve(gb(t)),r;for(;r!==e;)yield e,r=e,e=b9.resolve(e,"..")}}}var Ntt,jtt,S9=y(()=>{_9();Ntt=zve(Uve);jtt=10*1024*1024});import yb from"node:process";import Ia from"node:path";var Bve,Hve,Gve,w9,x9=y(()=>{y9();S9();Bve=({cwd:t=yb.cwd(),path:e=yb.env[hb()],preferLocal:r=!0,execPath:n=yb.execPath,addExecPath:i=!0}={})=>{let o=Ia.resolve(gb(t)),s=[],a=e.split(Ia.delimiter);return r&&Hve(s,a,o),i&&Gve(s,a,n,o),e===""||e===Ia.delimiter?`${s.join(Ia.delimiter)}${e}`:[...s,e].join(Ia.delimiter)},Hve=(t,e,r)=>{for(let n of v9(r)){let i=Ia.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Gve=(t,e,r,n)=>{let i=Ia.resolve(n,gb(r),"..");e.includes(i)||t.push(i)},w9=({env:t=yb.env,...e}={})=>{t={...t};let r=hb({env:t});return e.path=t[r],t[r]=Bve(e),t}});var $9,ri,k9,E9,A9,_b,Xf,Qf,Pa=y(()=>{$9=(t,e,r)=>{let n=r?Qf:Xf,i=t instanceof ri?{}:{cause:t};return new n(e,i)},ri=class extends Error{},k9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,A9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},E9=t=>_b(t)&&A9 in t,A9=Symbol("isExecaError"),_b=t=>Object.prototype.toString.call(t)==="[object Error]",Xf=class extends Error{};k9(Xf,Xf.name);Qf=class extends Error{};k9(Qf,Qf.name)});var T9,Zve,O9,R9,I9=y(()=>{T9=()=>{let t=R9-O9+1;return Array.from({length:t},Zve)},Zve=(t,e)=>({name:`SIGRT${e+1}`,number:O9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),O9=34,R9=64});var P9,C9=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 Vve}from"node:os";var jR,Wve,D9=y(()=>{C9();I9();jR=()=>{let t=T9();return[...P9,...t].map(Wve)},Wve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Vve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Kve}from"node:os";var Jve,Yve,N9,Xve,Qve,eSe,Qtt,j9=y(()=>{D9();Jve=()=>{let t=jR();return Object.fromEntries(t.map(Yve))},Yve=({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}],N9=Jve(),Xve=()=>{let t=jR(),e=65,r=Array.from({length:e},(n,i)=>Qve(i,t));return Object.assign({},...r)},Qve=(t,e)=>{let r=eSe(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}}},eSe=(t,e)=>{let r=e.find(({name:n})=>Kve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Qtt=Xve()});import{constants as ep}from"node:os";var F9,L9,z9,tSe,rSe,M9,nSe,MR,iSe,oSe,bb,tp=y(()=>{j9();F9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return z9(t,e)},L9=t=>t===0?t:z9(t,"`subprocess.kill()`'s argument"),z9=(t,e)=>{if(Number.isInteger(t))return tSe(t,e);if(typeof t=="string")return nSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${MR()}`)},tSe=(t,e)=>{if(M9.has(t))return M9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${MR()}`)},rSe=()=>new Map(Object.entries(ep.signals).reverse().map(([t,e])=>[e,t])),M9=rSe(),nSe=(t,e)=>{if(t in ep.signals)return t;throw t.toUpperCase()in ep.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${MR()}`)},MR=()=>`Available signal names: ${iSe()}. +Available signal numbers: ${oSe()}.`,iSe=()=>Object.keys(ep.signals).sort().map(t=>`'${t}'`).join(", "),oSe=()=>[...new Set(Object.values(ep.signals).sort((t,e)=>t-e))].join(", "),bb=t=>N9[t].description});import{setTimeout as sSe}from"node:timers/promises";var U9,aSe,q9,cSe,lSe,uSe,FR,vb=y(()=>{Pa();tp();U9=t=>{if(t===!1)return t;if(t===!0)return aSe;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},aSe=1e3*5,q9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=cSe(s,a,r);lSe(l,n);let u=t(c);return uSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},cSe=(t,e,r)=>{let[n=r,i]=_b(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&&!_b(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:L9(n),error:i}},lSe=(t,e)=>{t!==void 0&&e.reject(t)},uSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&FR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},FR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await sSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as dSe}from"node:events";var Sb,LR=y(()=>{Sb=async(t,e)=>{t.aborted||await dSe(t,"abort",{signal:e})}});var B9,H9,fSe,zR=y(()=>{LR();B9=({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)}`)},H9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[fSe(t,e,n,i)],fSe=async(t,e,r,{signal:n})=>{throw await Sb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Pl,pSe,UR,G9,Z9,wb,V9,W9,K9,J9,Y9,X9,mSe,hSe,gSe,ni,ySe,fs,Cl,Dl=y(()=>{Pl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{pSe(t,e,r),UR(t,e,n)},pSe=(t,e,r)=>{if(!r)throw new Error(`${ni(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},UR=(t,e,r)=>{if(!r)throw new Error(`${ni(t,e)} cannot be used: the ${fs(e)} has already exited or disconnected.`)},G9=t=>{throw new Error(`${ni("getOneMessage",t)} could not complete: the ${fs(t)} exited or disconnected.`)},Z9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(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([ - ${ri("getOneMessage",t)}, - ${ri("sendMessage",t,"message, {strict: true}")}, -]);`)},gb=(t,e)=>new Error(`${ri("sendMessage",e)} failed when sending an acknowledgment response to the ${us(e)}.`,{cause:t}),j9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${us(t)} is not listening to incoming messages.`)},M9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${us(t)} exited without listening to incoming messages.`)},F9=()=>new Error(`\`cancelSignal\` aborted: the ${us(!0)} disconnected.`),L9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},z9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ri(e,r)} cannot be used: the ${us(r)} is disconnecting.`,{cause:t})},U9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(eSe(t))throw new Error(`${ri(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},eSe=({code:t,message:e})=>tSe.has(t)||rSe.some(r=>e.includes(r)),tSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),rSe=["could not be cloned","circular structure","call stack size exceeded"],ri=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${nSe(e)}${t}(${r})`,nSe=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,q9,iSe,oSe,B9,sSe,H9,Jf,yb,ds=y(()=>{So();_b=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=q9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(B9(o,e,n,!0));return s},Cl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=q9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(B9(o,e,n,!1));return s},Di=new WeakMap,q9=(t,e,r)=>{let n=iSe(e,r);return oSe(n,e,r,t),n},iSe=(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(`"${Jf(e)}" must not be "${t}". + ${ni("getOneMessage",t)}, + ${ni("sendMessage",t,"message, {strict: true}")}, +]);`)},wb=(t,e)=>new Error(`${ni("sendMessage",e)} failed when sending an acknowledgment response to the ${fs(e)}.`,{cause:t}),V9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} is not listening to incoming messages.`)},W9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} exited without listening to incoming messages.`)},K9=()=>new Error(`\`cancelSignal\` aborted: the ${fs(!0)} disconnected.`),J9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},Y9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ni(e,r)} cannot be used: the ${fs(r)} is disconnecting.`,{cause:t})},X9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(mSe(t))throw new Error(`${ni(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},mSe=({code:t,message:e})=>hSe.has(t)||gSe.some(r=>e.includes(r)),hSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),gSe=["could not be cloned","circular structure","call stack size exceeded"],ni=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${ySe(e)}${t}(${r})`,ySe=t=>t?"":"subprocess.",fs=t=>t?"parent process":"subprocess",Cl=t=>{t.connected&&t.disconnect()}});var Di,Nl=y(()=>{Di=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var $b,jl,Ni,Q9,_Se,bSe,eV,vSe,tV,rp,xb,ps=y(()=>{wo();$b=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=Q9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(eV(o,e,n,!0));return s},jl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=Q9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(eV(o,e,n,!1));return s},Ni=new WeakMap,Q9=(t,e,r)=>{let n=_Se(e,r);return bSe(n,e,r,t),n},_Se=(t,e)=>{let r=vR(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(`"${rp(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},oSe=(t,e,r,n)=>{let i=n[H9(t)];if(i===void 0)throw new TypeError(`"${Jf(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(`"${Jf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Jf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},B9=(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}=sSe(t,r);return`The "${i}: ${yb(o)}" option is incompatible with using "${Jf(n)}: ${yb(e)}". -Please set this option with "pipe" instead.`},sSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=H9(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]}},H9=t=>t==="all"?1:t,Jf=t=>t?"to":"from",yb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as aSe}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),aSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var vb,MR,Sb,FR,G9,Z9,Yf=y(()=>{vb=(t,e)=>{e&&MR(t)},MR=t=>{t.refCounted()},Sb=(t,e)=>{e&&FR(t)},FR=t=>{t.unrefCounted()},G9=(t,e)=>{e&&(FR(t),FR(t))},Z9=(t,e)=>{e&&(MR(t),MR(t))}});import{once as cSe}from"node:events";import{scheduler as lSe}from"node:timers/promises";var V9,W9,wb,K9=y(()=>{$b();Yf();xb();kb();V9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(Y9(i)||Q9(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 X9(t,n,i),await lSe.yield();let s=await J9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},W9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{LR();let o=wb.get(t);for(;o?.length>0;)await cSe(n,"message:done");t.removeListener("message",i),Z9(e,r),n.connected=!1,n.emit("disconnect")},wb=new WeakMap});import{EventEmitter as uSe}from"node:events";var fs,Eb,dSe,Ab,Xf=y(()=>{K9();Yf();fs=(t,e,r)=>{if(Eb.has(t))return Eb.get(t);let n=new uSe;return n.connected=!0,Eb.set(t,n),dSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Eb=new WeakMap,dSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=V9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",W9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),G9(r,n)},Ab=t=>{let e=Eb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as fSe}from"node:events";var eV,pSe,tV,J9,Y9,rV,Tb,mSe,Ob,nV,xb=y(()=>{Pl();bb();Pb();Il();Xf();$b();eV=({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:pSe++,type:Ob,message:n,hasListeners:s}},pSe=0n,tV=(t,e)=>{if(!(e?.type!==Ob||e.hasListeners))for(let{id:r}of t)r!==void 0&&Tb[r].resolve({isDeadlock:!0,hasListeners:!1})},J9=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:nV,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},Y9=t=>{if(t?.type!==nV)return!1;let{id:e,message:r}=t;return Tb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},rV=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,mSe(e,r,i)]);o&&N9(r),s||j9(r)}finally{i.abort(),delete Tb[t.id]}},Tb={},mSe=async(t,e,{signal:r})=>{Ia(t,1,r),await fSe(t,"disconnect",{signal:r}),M9(e)},Ob="execa:ipc:request",nV="execa:ipc:response"});var iV,oV,X9,Qf,Rb,hSe,$b=y(()=>{Pl();So();ds();xb();iV=(t,e,r)=>{Qf.has(t)||Qf.set(t,new Set);let n=Qf.get(t),i=Ci(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},oV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},X9=async(t,e,r)=>{for(;!Rb(t,e)&&Qf.get(t)?.size>0;){let n=[...Qf.get(t)];tV(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Qf=new WeakMap,Rb=(t,e)=>e.listenerCount("message")>hSe(t),hSe=t=>Di.has(t)&&!vo(Di.get(t).options.buffer,"ipc")?1:0});import{promisify as gSe}from"node:util";var Ib,ySe,UR,_Se,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}),ySe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},ySe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=eV({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=iV(t,s,o);try{await UR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Rl(t),c}finally{oV(a)}},UR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=_Se(t);try{await Promise.all([rV(n,t,r),o(n)])}catch(s){throw z9({error:s,methodName:e,isSubprocess:r}),U9({error:s,methodName:e,isSubprocess:r,message:i}),s}},_Se=t=>{if(zR.has(t))return zR.get(t);let e=gSe(t.send.bind(t));return zR.set(t,e),e},zR=new WeakMap});import{scheduler as bSe}from"node:timers/promises";var aV,cV,vSe,sV,Q9,lV,LR,qR,kb=y(()=>{Pb();Xf();Il();aV=(t,e)=>{let r="cancelSignal";return jR(r,!1,t.connected),UR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:lV,message:e},message:e})},cV=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await vSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),qR.signal),vSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!sV){if(sV=!0,!n){L9();return}if(e===null){LR();return}fs(t,e,r),await bSe.yield()}},sV=!1,Q9=t=>t?.type!==lV?!1:(qR.abort(t.message),!0),lV="execa:ipc:cancel",LR=()=>{qR.abort(F9())},qR=new AbortController});var uV,dV,SSe,wSe,BR=y(()=>{DR();kb();mb();uV=({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.")}},dV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[SSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],SSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await hb(e,i);let o=wSe(e);throw await aV(t,o),CR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},wSe=({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 xSe}from"node:timers/promises";var fV,pV,$Se,HR=y(()=>{Ra();fV=({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})`)},pV=(t,e,r,n)=>e===0||e===void 0?[]:[$Se(t,e,r,n)],$Se=async(t,e,r,{signal:n})=>{throw await xSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ti}});import{execPath as kSe,execArgv as ESe}from"node:process";import mV from"node:path";var hV,gV,GR=y(()=>{xl();hV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},gV=(t,e,{node:r=!1,nodePath:n=kSe,nodeOptions:i=ESe.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=mV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(mV.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 ASe}from"node:v8";var yV,TSe,OSe,RSe,_V,ZR=y(()=>{yV=({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`.");RSe[r](t)}},TSe=t=>{try{ASe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},OSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},RSe={advanced:TSe,json:OSe},_V=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var vV,ISe,sn,VR,PSe,bV,Cb,Pa=y(()=>{vV=({encoding:t})=>{if(VR.has(t))return;let e=PSe(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}.`)},ISe=new Set(["utf8","utf16le"]),sn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),VR=new Set([...ISe,...sn]),PSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in bV)return bV[e];if(VR.has(e))return e},bV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Cb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as CSe}from"node:fs";import DSe from"node:path";import NSe from"node:process";var SV,wV,xV,WR=y(()=>{xl();SV=(t=wV())=>{let e=wl(t,'The "cwd" option');return DSe.resolve(e)},wV=()=>{try{return NSe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},xV=(t,e)=>{if(e===wV())return t;let r;try{r=CSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},bSe=(t,e,r,n)=>{let i=n[tV(t)];if(i===void 0)throw new TypeError(`"${rp(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(`"${rp(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${rp(r)}" must not be ${e}. It must be a writable stream, not readable.`)},eV=(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}=vSe(t,r);return`The "${i}: ${xb(o)}" option is incompatible with using "${rp(n)}: ${xb(e)}". +Please set this option with "pipe" instead.`},vSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=tV(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]}},tV=t=>t==="all"?1:t,rp=t=>t?"to":"from",xb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as SSe}from"node:events";var Ca,kb=y(()=>{Ca=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),SSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Eb,qR,Ab,BR,rV,nV,np=y(()=>{Eb=(t,e)=>{e&&qR(t)},qR=t=>{t.refCounted()},Ab=(t,e)=>{e&&BR(t)},BR=t=>{t.unrefCounted()},rV=(t,e)=>{e&&(BR(t),BR(t))},nV=(t,e)=>{e&&(qR(t),qR(t))}});import{once as wSe}from"node:events";import{scheduler as xSe}from"node:timers/promises";var iV,oV,Tb,sV=y(()=>{Rb();np();Ob();Ib();iV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(cV(i)||uV(i))return;Tb.has(t)||Tb.set(t,[]);let o=Tb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await lV(t,n,i),await xSe.yield();let s=await aV({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},oV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{HR();let o=Tb.get(t);for(;o?.length>0;)await wSe(n,"message:done");t.removeListener("message",i),nV(e,r),n.connected=!1,n.emit("disconnect")},Tb=new WeakMap});import{EventEmitter as $Se}from"node:events";var ms,Pb,kSe,Cb,ip=y(()=>{sV();np();ms=(t,e,r)=>{if(Pb.has(t))return Pb.get(t);let n=new $Se;return n.connected=!0,Pb.set(t,n),kSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Pb=new WeakMap,kSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=iV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",oV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),rV(r,n)},Cb=t=>{let e=Pb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as ESe}from"node:events";var dV,ASe,fV,aV,cV,pV,Db,TSe,Nb,mV,Ob=y(()=>{Nl();kb();Fb();Dl();ip();Rb();dV=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ms(t,e,r),s=jb(t,o);return{id:ASe++,type:Nb,message:n,hasListeners:s}},ASe=0n,fV=(t,e)=>{if(!(e?.type!==Nb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Db[r].resolve({isDeadlock:!0,hasListeners:!1})},aV=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Nb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:mV,message:jb(e,i)};try{await Mb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},cV=t=>{if(t?.type!==mV)return!1;let{id:e,message:r}=t;return Db[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},pV=async(t,e,r)=>{if(t?.type!==Nb)return;let n=Di();Db[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,TSe(e,r,i)]);o&&Z9(r),s||V9(r)}finally{i.abort(),delete Db[t.id]}},Db={},TSe=async(t,e,{signal:r})=>{Ca(t,1,r),await ESe(t,"disconnect",{signal:r}),W9(e)},Nb="execa:ipc:request",mV="execa:ipc:response"});var hV,gV,lV,op,jb,OSe,Rb=y(()=>{Nl();wo();ps();Ob();hV=(t,e,r)=>{op.has(t)||op.set(t,new Set);let n=op.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},gV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},lV=async(t,e,r)=>{for(;!jb(t,e)&&op.get(t)?.size>0;){let n=[...op.get(t)];fV(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},op=new WeakMap,jb=(t,e)=>e.listenerCount("message")>OSe(t),OSe=t=>Ni.has(t)&&!So(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as RSe}from"node:util";var Mb,ISe,ZR,PSe,GR,Fb=y(()=>{Dl();Rb();Ob();Mb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Pl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),ISe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},ISe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=dV({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=hV(t,s,o);try{await ZR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Cl(t),c}finally{gV(a)}},ZR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=PSe(t);try{await Promise.all([pV(n,t,r),o(n)])}catch(s){throw Y9({error:s,methodName:e,isSubprocess:r}),X9({error:s,methodName:e,isSubprocess:r,message:i}),s}},PSe=t=>{if(GR.has(t))return GR.get(t);let e=RSe(t.send.bind(t));return GR.set(t,e),e},GR=new WeakMap});import{scheduler as CSe}from"node:timers/promises";var _V,bV,DSe,yV,uV,vV,HR,VR,Ib=y(()=>{Fb();ip();Dl();_V=(t,e)=>{let r="cancelSignal";return UR(r,!1,t.connected),ZR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:vV,message:e},message:e})},bV=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await DSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),VR.signal),DSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!yV){if(yV=!0,!n){J9();return}if(e===null){HR();return}ms(t,e,r),await CSe.yield()}},yV=!1,uV=t=>t?.type!==vV?!1:(VR.abort(t.message),!0),vV="execa:ipc:cancel",HR=()=>{VR.abort(K9())},VR=new AbortController});var SV,wV,NSe,jSe,WR=y(()=>{LR();Ib();vb();SV=({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.")}},wV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[NSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],NSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await Sb(e,i);let o=jSe(e);throw await _V(t,o),FR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},jSe=({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 MSe}from"node:timers/promises";var xV,$V,FSe,KR=y(()=>{Pa();xV=({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})`)},$V=(t,e,r,n)=>e===0||e===void 0?[]:[FSe(t,e,r,n)],FSe=async(t,e,r,{signal:n})=>{throw await MSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ri}});import{execPath as LSe,execArgv as zSe}from"node:process";import kV from"node:path";var EV,AV,JR=y(()=>{El();EV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},AV=(t,e,{node:r=!1,nodePath:n=LSe,nodeOptions:i=zSe.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=kl(n,'The "nodePath" option'),l=kV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(kV.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 USe}from"node:v8";var TV,qSe,BSe,HSe,OV,YR=y(()=>{TV=({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`.");HSe[r](t)}},qSe=t=>{try{USe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},BSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},HSe={advanced:qSe,json:BSe},OV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var IV,GSe,an,XR,ZSe,RV,Lb,Da=y(()=>{IV=({encoding:t})=>{if(XR.has(t))return;let e=ZSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Lb(t)}\`. +Please rename it to ${Lb(e)}.`);let r=[...XR].map(n=>Lb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Lb(t)}\`. +Please rename it to one of: ${r}.`)},GSe=new Set(["utf8","utf16le"]),an=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),XR=new Set([...GSe,...an]),ZSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in RV)return RV[e];if(XR.has(e))return e},RV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Lb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as VSe}from"node:fs";import WSe from"node:path";import KSe from"node:process";var PV,CV,DV,QR=y(()=>{El();PV=(t=CV())=>{let e=kl(t,'The "cwd" option');return WSe.resolve(e)},CV=()=>{try{return KSe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},DV=(t,e)=>{if(e===CV())return t;let r;try{r=VSe(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 jSe from"node:path";import $V from"node:process";var kV,Db,MSe,FSe,KR=y(()=>{kV=St(o9(),1);f9();mb();Kf();NR();BR();HR();GR();ZR();Pa();WR();xl();So();Db=(t,e,r)=>{r.cwd=SV(r.cwd);let[n,i,o]=gV(t,e,r),{command:s,args:a,options:c}=kV.default._parse(n,i,o),l=WG(c),u=MSe(l);return fV(u),vV(u),yV(u),P9(u),uV(u),u.shell=uR(u.shell),u.env=FSe(u),u.killSignal=A9(u.killSignal),u.forceKillAfterDelay=R9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!sn.has(u.encoding)&&u.buffer[f]),$V.platform==="win32"&&jSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},MSe=({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}),FSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...$V.env,...t}:t;return r||n?d9({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 LSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return zSe(t)}var LSe,zSe,EV,USe,AV,qSe,YR=y(()=>{LSe=t=>t.at(-1)===EV?t.slice(0,t.at(-2)===AV?-2:-1):t,zSe=t=>t.at(-1)===USe?t.subarray(0,t.at(-2)===qSe?-2:-1):t,EV=` -`,USe=EV.codePointAt(0),AV="\r",qSe=AV.codePointAt(0)});function ni(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 ni(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 ni(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 TV(){return this[tI].next()}function OV(t){return this[tI].return(t)}function rI({preventCancel:t=!1}={}){let e=this.getReader(),r=new eI(e,t),n=Object.create(HSe);return n[tI]=r,n}var BSe,eI,tI,HSe,RV=y(()=>{BSe=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(TV,"name",{value:"next"});Object.defineProperty(OV,"name",{value:"return"});HSe=Object.create(BSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:TV},return:{enumerable:!0,configurable:!0,writable:!0,value:OV}})});var IV=y(()=>{});var PV=y(()=>{RV();IV()});var CV,GSe,ZSe,VSe,ep,nI=y(()=>{Da();PV();CV=t=>{if(Ca(t,{checkOpen:!1})&&ep.on!==void 0)return ZSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(GSe.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:GSe}=Object.prototype,ZSe=async function*(t){let e=new AbortController,r={};VSe(t,e,r);try{for await(let[n]of ep.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()}},VSe=async(t,e,r)=>{try{await ep.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},ep={}});var Nl,WSe,jV,DV,KSe,NV,Ni,tp=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=CV(t),u=e();u.length=0;try{for await(let d of l){let f=KSe(d),p=r[f](d,u);jV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return WSe({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}},WSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&jV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},jV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){DV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&DV(c,e,i,o),new Ni},DV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},KSe=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=NV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&NV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:NV}=Object.prototype,Ni=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var wo,rp,jb,Mb,Fb,Lb=y(()=>{wo=t=>t,rp=()=>{},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,QSe,e)}var JSe,YSe,XSe,QSe,MV=y(()=>{tp();Lb();JSe=()=>({contents:[]}),YSe=()=>1,XSe=(t,{contents:e})=>(e.push(t),e),QSe={init:JSe,convertChunk:{string:wo,buffer:wo,arrayBuffer:wo,dataView:wo,typedArray:wo,others:wo},getSize:YSe,truncateChunk:rp,addChunk:XSe,getFinalChunk:rp,finalize:jb}});async function Ub(t,e){return Nl(t,cwe,e)}var ewe,twe,rwe,FV,LV,nwe,iwe,owe,swe,UV,zV,awe,qV,cwe,BV=y(()=>{tp();Lb();ewe=()=>({contents:new ArrayBuffer(0)}),twe=t=>rwe.encode(t),rwe=new TextEncoder,FV=t=>new Uint8Array(t),LV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),nwe=(t,e)=>t.slice(0,e),iwe=(t,{contents:e,length:r},n)=>{let i=qV()?swe(e,n):owe(e,n);return new Uint8Array(i).set(t,r),i},owe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(UV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},swe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:UV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},UV=t=>zV**Math.ceil(Math.log(t)/Math.log(zV)),zV=2,awe=({contents:t,length:e})=>qV()?t:t.slice(0,e),qV=()=>"resize"in ArrayBuffer.prototype,cwe={init:ewe,convertChunk:{string:twe,buffer:FV,arrayBuffer:FV,dataView:LV,typedArray:LV,others:Mb},getSize:Fb,truncateChunk:nwe,addChunk:iwe,getFinalChunk:rp,finalize:awe}});async function Bb(t,e){return Nl(t,pwe,e)}var lwe,qb,uwe,dwe,fwe,pwe,HV=y(()=>{tp();Lb();lwe=()=>({contents:"",textDecoder:new TextDecoder}),qb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),uwe=(t,{contents:e})=>e+t,dwe=(t,e)=>t.slice(0,e),fwe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},pwe={init:lwe,convertChunk:{string:wo,buffer:qb,arrayBuffer:qb,dataView:qb,typedArray:qb,others:Mb},getSize:Fb,truncateChunk:dwe,addChunk:uwe,getFinalChunk:fwe,finalize:jb}});var GV=y(()=>{MV();BV();HV();tp()});import{on as mwe}from"node:events";import{finished as hwe}from"node:stream/promises";var Hb=y(()=>{nI();GV();Object.assign(ep,{on:mwe,finished:hwe})});var ZV,gwe,VV,WV,ywe,KV,JV,Gb,Na=y(()=>{Hb();bo();So();ZV=({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=gwe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},gwe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",VV=(t,e,r)=>{if(e.length!==r)return;let n=new Ni;throw n.maxBufferInfo={fdNumber:"ipc"},n},WV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=ywe(t,e);return`Command's ${r} was larger than ${n} ${i}`},ywe=(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}},KV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Gb(r)),JV=(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 _we}from"node:util";var XV,bwe,vwe,Swe,wwe,xwe,YV,QV=y(()=>{YR();on();WR();eb();Na();Kf();Ra();XV=({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=bwe({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=Swe(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=>wwe(D)).join(` -`)].map(D=>Gf(Dl(xwe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:A}},bwe=({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=vwe(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?`${WV(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"},vwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Swe=(t,e)=>{if(t instanceof ti)return;let r=h9(t)?t.originalMessage:String(t?.message??t),n=Gf(xV(r,e));return n===""?void 0:n},wwe=t=>typeof t=="string"?t:_we(t),xwe=t=>Array.isArray(t)?t.map(e=>Dl(YV(e))).filter(Boolean).join(` -`):YV(t),YV=t=>typeof t=="string"?t:qt(t)?K_(t):""});var Zb,jl,np,$we,eW,kwe,ip=y(()=>{Kf();sb();Ra();QV();Zb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>eW({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})=>np({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}),np=({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}=kwe(l,u),{originalMessage:A,shortMessage:D,message:$}=XV({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=p9(t,$,x);return Object.assign(re,$we({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},$we=({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})=>eW({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:[]}),eW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),kwe=(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 Ewe(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(tW(t*1e3)%1e3),nanoseconds:Math.trunc(tW(t*1e6)%1e3)}}function Awe(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 Ewe(t);break}case"bigint":return Awe(t)}throw new TypeError("Expected a finite number or bigint")}var tW,rW=y(()=>{tW=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+Rwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&Twe(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?" "+Owe(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%Iwe):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 Twe,Owe,Rwe,Iwe,nW=y(()=>{rW();Twe=t=>t===0||t===0n,Owe=(t,e)=>e===1||e===1n?t:`${t}s`,Rwe=1e-7,Iwe=24n*60n*60n*1000n});var iW,oW=y(()=>{El();iW=(t,e)=>{t.failed&&Pi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var sW,Pwe,aW=y(()=>{nW();ls();El();oW();sW=(t,e)=>{$l(e)&&(iW(t,e),Pwe(t,e))},Pwe=(t,e)=>{let r=`(done in ${oI(t.durationMs)})`;Pi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ml,Vb=y(()=>{aW();Ml=(t,e,{reject:r})=>{if(sW(t,e),t.failed&&r)throw t;return t}});var uW,Cwe,Dwe,dW,fW,cW,Nwe,sI,lW,ja,pW,jwe,Wb,mW,Mwe,Fwe,aI,hW,Lwe,gW,Kb,zwe,cI,Uwe,qwe,yW,In,Jb,lI,_W,bW,ps,wr=y(()=>{Da();yo();on();uW=(t,e)=>ja(t)?"asyncGenerator":pW(t)?"generator":Wb(t)?"fileUrl":Mwe(t)?"filePath":zwe(t)?"webStream":ni(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Uwe(t)?"asyncIterable":qwe(t)?"iterable":cI(t)?dW({transform:t},e):jwe(t)?Cwe(t,e):"native",Cwe=(t,e)=>QR(t.transform,{checkOpen:!1})?Dwe(t,e):cI(t.transform)?dW(t,e):Nwe(t,e),Dwe=(t,e)=>(fW(t,e,"Duplex stream"),"duplex"),dW=(t,e)=>(fW(t,e,"web TransformStream"),"webTransform"),fW=({final:t,binary:e,objectMode:r},n,i)=>{cW(t,`${n}.final`,i),cW(e,`${n}.binary`,i),sI(r,`${n}.objectMode`)},cW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Nwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!lW(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&&!lW(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.`)},lW=t=>ja(t)||pW(t),ja=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",pW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",jwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Wb=t=>Object.prototype.toString.call(t)==="[object URL]",mW=t=>Wb(t)&&t.protocol!=="file:",Mwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Fwe.has(e))&&aI(t.file),Fwe=new Set(["file","append"]),aI=t=>typeof t=="string",hW=(t,e)=>t==="native"&&typeof e=="string"&&!Lwe.has(e),Lwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),gW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Kb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",zwe=t=>gW(t)||Kb(t),cI=t=>gW(t?.readable)&&Kb(t?.writable),Uwe=t=>yW(t)&&typeof t[Symbol.asyncIterator]=="function",qwe=t=>yW(t)&&typeof t[Symbol.iterator]=="function",yW=t=>typeof t=="object"&&t!==null,In=new Set(["generator","asyncGenerator","duplex","webTransform"]),Jb=new Set(["fileUrl","filePath","fileNumber"]),lI=new Set(["fileUrl","filePath"]),_W=new Set([...lI,"webStream","nodeStream"]),bW=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,Bwe,Hwe,vW,dI=y(()=>{wr();uI=(t,e,r,n)=>n==="output"?Bwe(t,e,r):Hwe(t,e,r),Bwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Hwe=(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}},vW=(t,e)=>{let r=t.findLast(({type:n})=>In.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var SW,Gwe,Zwe,Vwe,Wwe,Kwe,Jwe,wW=y(()=>{yo();Pa();wr();dI();SW=(t,e,r,n)=>[...t.filter(({type:i})=>!In.has(i)),...Gwe(t,e,r,n)],Gwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>In.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Zwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Jwe(o,r)},Zwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Vwe({stdioItem:t,optionName:i}):e==="webTransform"?Wwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Kwe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Vwe=({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}}},Wwe=({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}}},Kwe=({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||sn.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}}},Jwe=(t,e)=>e==="input"?t.reverse():t});import fI from"node:process";var xW,Ywe,Xwe,Fl,pI,$W,Qwe,exe,kW=y(()=>{Da();wr();xW=(t,e,r)=>{let n=t.map(i=>Ywe(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)??exe},Ywe=({type:t,value:e},r)=>Xwe[r]??$W[t](e),Xwe=["input","output","output"],Fl=()=>{},pI=()=>"input",$W={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=Qwe(t);if(e!==void 0)return e;if(ni(t,{checkOpen:!1}))return $W.nodeStream(t)}},Qwe=t=>{if([0,fI.stdin].includes(t))return"input";if([1,2,fI.stdout,fI.stderr].includes(t))return"output"},exe="output"});var EW,AW=y(()=>{EW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var TW,txe,rxe,OW,nxe,ixe,RW=y(()=>{bo();AW();ls();TW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=txe(t,n).map((a,c)=>OW(a,c));return o?nxe(s,r,i):EW(s,e)},txe=(t,e)=>{if(t===void 0)return Rn.map(n=>e[n]);if(rxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Rn.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,Rn.length);return Array.from({length:r},(n,i)=>t[i])},rxe=t=>Rn.some(e=>t[e]!==void 0),OW=(t,e)=>Array.isArray(t)?t.map(r=>OW(r,e)):t??(e>=Rn.length?"ignore":"pipe"),nxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!kl(r,i)&&ixe(n)?"ignore":n),ixe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as oxe}from"node:fs";import sxe from"node:tty";var PW,axe,cxe,lxe,uxe,IW,CW=y(()=>{Da();bo();on();ds();PW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?axe({stdioItem:t,fdNumber:n,direction:i}):uxe({stdioItem:t,fdNumber:n}),axe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=cxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ni(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},cxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=lxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(sxe.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(oxe(i)),optionName:e}}},lxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=J_.indexOf(t);if(r!==-1)return r},uxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:IW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:IW(e,e,r),optionName:r}:ni(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,IW=(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 DW,dxe,fxe,pxe,mxe,NW=y(()=>{Da();on();wr();DW=({input:t,inputFile:e},r)=>r===0?[...dxe(t),...pxe(e)]:[],dxe=t=>t===void 0?[]:[{type:fxe(t),value:t,optionName:"input"}],fxe=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.")},pxe=t=>t===void 0?[]:[{...mxe(t),optionName:"inputFile"}],mxe=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 jW,MW,hxe,gxe,FW,yxe,_xe,LW,zW=y(()=>{wr();jW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),MW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=hxe(i,t);if(s.length!==0){if(o){gxe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(_W.has(t))return FW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});bW.has(t)&&_xe({otherStdioItems:s,type:t,value:e,optionName:r})}},hxe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),gxe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{lI.has(e)&&FW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},FW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>yxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return LW(s,n,e),i==="output"?o[0].stream:void 0},yxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,_xe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);LW(i,n,e)},LW=(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,bxe,vxe,Sxe,wxe,xxe,$xe,kxe,Exe,Axe,Txe,Oxe,mI,Rxe,Xb=y(()=>{bo();wW();dI();wr();kW();RW();CW();NW();zW();Yb=(t,e,r,n)=>{let o=TW(e,r,n).map((a,c)=>bxe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Axe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Rxe(a)),s},bxe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=Y_(e),{stdioItems:o,isStdioArray:s}=vxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=xW(o,e,i),c=o.map(d=>PW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=SW(c,i,a,r),u=vW(l,a);return Exe(l,u),{direction:a,objectMode:u,stdioItems:l}},vxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Sxe(c,n)),...DW(r,e)],s=jW(o),a=s.length>1;return wxe(s,a,n),$xe(s),{stdioItems:s,isStdioArray:a}},Sxe=(t,e)=>({type:uW(t,e),value:t,optionName:e}),wxe=(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(xxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},xxe=new Set(["ignore","ipc"]),$xe=t=>{for(let e of t)kxe(e)},kxe=({type:t,value:e,optionName:r})=>{if(mW(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(hW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Exe=(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.`)},Axe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(Txe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw mI(i),o}},Txe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Oxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Oxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=MW({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&&!ei(r)&&r.destroy()},Rxe=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 UW}from"node:fs";var BW,ji,Ixe,HW,qW,Pxe,GW=y(()=>{on();Xb();wr();BW=(t,e)=>Yb(Pxe,t,e,!0),ji=({type:t,optionName:e})=>{HW(e,ps[t])},Ixe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&HW(t,`"${e}"`),{}),HW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},qW={generator(){},asyncGenerator:ji,webStream:ji,nodeStream:ji,webTransform:ji,duplex:ji,asyncIterable:ji,native:Ixe},Pxe={input:{...qW,fileUrl:({value:t})=>({contents:[_o(UW(t))]}),filePath:({value:{file:t}})=>({contents:[_o(UW(t))]}),fileNumber:ji,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...qW,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,op=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,ZW,VW,Cxe,Dxe,Nxe,WW,jxe,gI,Mxe,Fxe,Lxe,ev=y(()=>{Qb=(t,e,r,n)=>t||r?void 0:VW(e,n),yI=(t,e,r)=>r?t.flatMap(n=>ZW(n,e)):ZW(t,e),ZW=(t,e)=>{let{transform:r,final:n}=VW(e,{});return[...r(t),...n()]},VW=(t,e)=>(e.previousChunks="",{transform:Cxe.bind(void 0,e,t),final:Nxe.bind(void 0,e)}),Cxe=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},Dxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Nxe=function*({previousChunks:t}){t.length>0&&(yield t)},WW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:jxe.bind(void 0,n)},jxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Mxe:Lxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},gI=(t,e)=>`${t}${e}`,Mxe={windowsNewline:`\r +${t}`}});import JSe from"node:path";import NV from"node:process";var jV,zb,YSe,XSe,eI=y(()=>{jV=St(g9(),1);x9();vb();tp();zR();WR();KR();JR();YR();Da();QR();El();wo();zb=(t,e,r)=>{r.cwd=PV(r.cwd);let[n,i,o]=AV(t,e,r),{command:s,args:a,options:c}=jV.default._parse(n,i,o),l=oZ(c),u=YSe(l);return xV(u),IV(u),TV(u),B9(u),SV(u),u.shell=hR(u.shell),u.env=XSe(u),u.killSignal=F9(u.killSignal),u.forceKillAfterDelay=U9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!an.has(u.encoding)&&u.buffer[f]),NV.platform==="win32"&&JSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},YSe=({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}),XSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...NV.env,...t}:t;return r||n?w9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Ub,tI=y(()=>{Ub=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Ml(t){if(typeof t=="string")return QSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return ewe(t)}var QSe,ewe,MV,twe,FV,rwe,rI=y(()=>{QSe=t=>t.at(-1)===MV?t.slice(0,t.at(-2)===FV?-2:-1):t,ewe=t=>t.at(-1)===twe?t.subarray(0,t.at(-2)===rwe?-2:-1):t,MV=` +`,twe=MV.codePointAt(0),FV="\r",rwe=FV.codePointAt(0)});function ii(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 nI(t,{checkOpen:e=!0}={}){return ii(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 Na(t,{checkOpen:e=!0}={}){return ii(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 iI(t,e){return nI(t,e)&&Na(t,e)}var ja=y(()=>{});function LV(){return this[sI].next()}function zV(t){return this[sI].return(t)}function aI({preventCancel:t=!1}={}){let e=this.getReader(),r=new oI(e,t),n=Object.create(iwe);return n[sI]=r,n}var nwe,oI,sI,iwe,UV=y(()=>{nwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),oI=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}}},sI=Symbol();Object.defineProperty(LV,"name",{value:"next"});Object.defineProperty(zV,"name",{value:"return"});iwe=Object.create(nwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:LV},return:{enumerable:!0,configurable:!0,writable:!0,value:zV}})});var qV=y(()=>{});var BV=y(()=>{UV();qV()});var HV,owe,swe,awe,sp,cI=y(()=>{ja();BV();HV=t=>{if(Na(t,{checkOpen:!1})&&sp.on!==void 0)return swe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(owe.call(t)==="[object ReadableStream]")return aI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:owe}=Object.prototype,swe=async function*(t){let e=new AbortController,r={};awe(t,e,r);try{for await(let[n]of sp.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()}},awe=async(t,e,r)=>{try{await sp.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},sp={}});var Fl,cwe,VV,GV,lwe,ZV,ji,ap=y(()=>{cI();Fl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=HV(t),u=e();u.length=0;try{for await(let d of l){let f=lwe(d),p=r[f](d,u);VV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return cwe({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}},cwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&VV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},VV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){GV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&GV(c,e,i,o),new ji},GV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},lwe=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=ZV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&ZV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:ZV}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var xo,cp,qb,Bb,Hb,Gb=y(()=>{xo=t=>t,cp=()=>{},qb=({contents:t})=>t,Bb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Hb=t=>t.length});async function Zb(t,e){return Fl(t,pwe,e)}var uwe,dwe,fwe,pwe,WV=y(()=>{ap();Gb();uwe=()=>({contents:[]}),dwe=()=>1,fwe=(t,{contents:e})=>(e.push(t),e),pwe={init:uwe,convertChunk:{string:xo,buffer:xo,arrayBuffer:xo,dataView:xo,typedArray:xo,others:xo},getSize:dwe,truncateChunk:cp,addChunk:fwe,getFinalChunk:cp,finalize:qb}});async function Vb(t,e){return Fl(t,wwe,e)}var mwe,hwe,gwe,KV,JV,ywe,_we,bwe,vwe,XV,YV,Swe,QV,wwe,eW=y(()=>{ap();Gb();mwe=()=>({contents:new ArrayBuffer(0)}),hwe=t=>gwe.encode(t),gwe=new TextEncoder,KV=t=>new Uint8Array(t),JV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ywe=(t,e)=>t.slice(0,e),_we=(t,{contents:e,length:r},n)=>{let i=QV()?vwe(e,n):bwe(e,n);return new Uint8Array(i).set(t,r),i},bwe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(XV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},vwe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:XV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},XV=t=>YV**Math.ceil(Math.log(t)/Math.log(YV)),YV=2,Swe=({contents:t,length:e})=>QV()?t:t.slice(0,e),QV=()=>"resize"in ArrayBuffer.prototype,wwe={init:mwe,convertChunk:{string:hwe,buffer:KV,arrayBuffer:KV,dataView:JV,typedArray:JV,others:Bb},getSize:Hb,truncateChunk:ywe,addChunk:_we,getFinalChunk:cp,finalize:Swe}});async function Kb(t,e){return Fl(t,Awe,e)}var xwe,Wb,$we,kwe,Ewe,Awe,tW=y(()=>{ap();Gb();xwe=()=>({contents:"",textDecoder:new TextDecoder}),Wb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),$we=(t,{contents:e})=>e+t,kwe=(t,e)=>t.slice(0,e),Ewe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Awe={init:xwe,convertChunk:{string:xo,buffer:Wb,arrayBuffer:Wb,dataView:Wb,typedArray:Wb,others:Bb},getSize:Hb,truncateChunk:kwe,addChunk:$we,getFinalChunk:Ewe,finalize:qb}});var rW=y(()=>{WV();eW();tW();ap()});import{on as Twe}from"node:events";import{finished as Owe}from"node:stream/promises";var Jb=y(()=>{cI();rW();Object.assign(sp,{on:Twe,finished:Owe})});var nW,Rwe,iW,oW,Iwe,sW,aW,Yb,Ma=y(()=>{Jb();vo();wo();nW=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof ji))throw t;if(o==="all")return t;let s=Rwe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Rwe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",iW=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},oW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=Iwe(t,e);return`Command's ${r} was larger than ${n} ${i}`},Iwe=(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=So(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:nb(r),threshold:i,unit:n}},sW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Yb(r)),aW=(t,e,r)=>{if(!e)return t;let n=Yb(r);return t.length>n?t.slice(0,n):t},Yb=([,t])=>t});import{inspect as Pwe}from"node:util";var lW,Cwe,Dwe,Nwe,jwe,Mwe,cW,uW=y(()=>{rI();sn();QR();sb();Ma();tp();Pa();lW=({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=Nwe(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=>jwe(D)).join(` +`)].map(D=>Yf(Ml(Mwe(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=Dwe(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?`${oW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${bb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Dwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Nwe=(t,e)=>{if(t instanceof ri)return;let r=E9(t)?t.originalMessage:String(t?.message??t),n=Yf(DV(r,e));return n===""?void 0:n},jwe=t=>typeof t=="string"?t:Pwe(t),Mwe=t=>Array.isArray(t)?t.map(e=>Ml(cW(e))).filter(Boolean).join(` +`):cW(t),cW=t=>typeof t=="string"?t:qt(t)?tb(t):""});var Xb,Ll,lp,Fwe,dW,Lwe,up=y(()=>{tp();fb();Pa();uW();Xb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>dW({command:t,escapedCommand:e,cwd:o,durationMs:kR(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:[]}),Ll=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>lp({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}),lp=({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}=Lwe(l,u),{originalMessage:A,shortMessage:D,message:$}=lW({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=$9(t,$,x);return Object.assign(re,Fwe({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},Fwe=({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})=>dW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:kR(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:[]}),dW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Lwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:bb(e);return{exitCode:r,signal:n,signalDescription:i}}});function zwe(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(fW(t*1e3)%1e3),nanoseconds:Math.trunc(fW(t*1e6)%1e3)}}function Uwe(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 lI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return zwe(t);break}case"bigint":return Uwe(t)}throw new TypeError("Expected a finite number or bigint")}var fW,pW=y(()=>{fW=t=>Number.isFinite(t)?t:0});function uI(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+Hwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&qwe(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?" "+Bwe(d,u):f;i.push(p)}},a=lI(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%Gwe):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 qwe,Bwe,Hwe,Gwe,mW=y(()=>{pW();qwe=t=>t===0||t===0n,Bwe=(t,e)=>e===1||e===1n?t:`${t}s`,Hwe=1e-7,Gwe=24n*60n*60n*1000n});var hW,gW=y(()=>{Ol();hW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var yW,Zwe,_W=y(()=>{mW();ds();Ol();gW();yW=(t,e)=>{Al(e)&&(hW(t,e),Zwe(t,e))},Zwe=(t,e)=>{let r=`(done in ${uI(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var zl,Qb=y(()=>{_W();zl=(t,e,{reject:r})=>{if(yW(t,e),t.failed&&r)throw t;return t}});var SW,Vwe,Wwe,wW,xW,bW,Kwe,dI,vW,Fa,$W,Jwe,ev,kW,Ywe,Xwe,fI,EW,Qwe,AW,tv,exe,pI,txe,rxe,TW,Pn,rv,mI,OW,RW,hs,wr=y(()=>{ja();_o();sn();SW=(t,e)=>Fa(t)?"asyncGenerator":$W(t)?"generator":ev(t)?"fileUrl":Ywe(t)?"filePath":exe(t)?"webStream":ii(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":txe(t)?"asyncIterable":rxe(t)?"iterable":pI(t)?wW({transform:t},e):Jwe(t)?Vwe(t,e):"native",Vwe=(t,e)=>iI(t.transform,{checkOpen:!1})?Wwe(t,e):pI(t.transform)?wW(t,e):Kwe(t,e),Wwe=(t,e)=>(xW(t,e,"Duplex stream"),"duplex"),wW=(t,e)=>(xW(t,e,"web TransformStream"),"webTransform"),xW=({final:t,binary:e,objectMode:r},n,i)=>{bW(t,`${n}.final`,i),bW(e,`${n}.binary`,i),dI(r,`${n}.objectMode`)},bW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Kwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!vW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(iI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(pI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!vW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return dI(r,`${i}.binary`),dI(n,`${i}.objectMode`),Fa(t)||Fa(e)?"asyncGenerator":"generator"},dI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},vW=t=>Fa(t)||$W(t),Fa=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",$W=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Jwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),ev=t=>Object.prototype.toString.call(t)==="[object URL]",kW=t=>ev(t)&&t.protocol!=="file:",Ywe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Xwe.has(e))&&fI(t.file),Xwe=new Set(["file","append"]),fI=t=>typeof t=="string",EW=(t,e)=>t==="native"&&typeof e=="string"&&!Qwe.has(e),Qwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),AW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",tv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",exe=t=>AW(t)||tv(t),pI=t=>AW(t?.readable)&&tv(t?.writable),txe=t=>TW(t)&&typeof t[Symbol.asyncIterator]=="function",rxe=t=>TW(t)&&typeof t[Symbol.iterator]=="function",TW=t=>typeof t=="object"&&t!==null,Pn=new Set(["generator","asyncGenerator","duplex","webTransform"]),rv=new Set(["fileUrl","filePath","fileNumber"]),mI=new Set(["fileUrl","filePath"]),OW=new Set([...mI,"webStream","nodeStream"]),RW=new Set(["webTransform","duplex"]),hs={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 hI,nxe,ixe,IW,gI=y(()=>{wr();hI=(t,e,r,n)=>n==="output"?nxe(t,e,r):ixe(t,e,r),nxe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},ixe=(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}},IW=(t,e)=>{let r=t.findLast(({type:n})=>Pn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var PW,oxe,sxe,axe,cxe,lxe,uxe,CW=y(()=>{_o();Da();wr();gI();PW=(t,e,r,n)=>[...t.filter(({type:i})=>!Pn.has(i)),...oxe(t,e,r,n)],oxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Pn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=sxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return uxe(o,r)},sxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?axe({stdioItem:t,optionName:i}):e==="webTransform"?cxe({stdioItem:t,index:r,newTransforms:n,direction:o}):lxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),axe=({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}}},cxe=({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}=hI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},lxe=({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||an.has(o),{writableObjectMode:f,readableObjectMode:p}=hI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},uxe=(t,e)=>e==="input"?t.reverse():t});import yI from"node:process";var DW,dxe,fxe,Ul,_I,NW,pxe,mxe,jW=y(()=>{ja();wr();DW=(t,e,r)=>{let n=t.map(i=>dxe(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)??mxe},dxe=({type:t,value:e},r)=>fxe[r]??NW[t](e),fxe=["input","output","output"],Ul=()=>{},_I=()=>"input",NW={generator:Ul,asyncGenerator:Ul,fileUrl:Ul,filePath:Ul,iterable:_I,asyncIterable:_I,uint8Array:_I,webStream:t=>tv(t)?"output":"input",nodeStream(t){return Na(t,{checkOpen:!1})?nI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Ul,duplex:Ul,native(t){let e=pxe(t);if(e!==void 0)return e;if(ii(t,{checkOpen:!1}))return NW.nodeStream(t)}},pxe=t=>{if([0,yI.stdin].includes(t))return"input";if([1,2,yI.stdout,yI.stderr].includes(t))return"output"},mxe="output"});var MW,FW=y(()=>{MW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var LW,hxe,gxe,zW,yxe,_xe,UW=y(()=>{vo();FW();ds();LW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=hxe(t,n).map((a,c)=>zW(a,c));return o?yxe(s,r,i):MW(s,e)},hxe=(t,e)=>{if(t===void 0)return In.map(n=>e[n]);if(gxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${In.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,In.length);return Array.from({length:r},(n,i)=>t[i])},gxe=t=>In.some(e=>t[e]!==void 0),zW=(t,e)=>Array.isArray(t)?t.map(r=>zW(r,e)):t??(e>=In.length?"ignore":"pipe"),yxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Tl(r,i)&&_xe(n)?"ignore":n),_xe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as bxe}from"node:fs";import vxe from"node:tty";var BW,Sxe,wxe,xxe,$xe,qW,HW=y(()=>{ja();vo();sn();ps();BW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Sxe({stdioItem:t,fdNumber:n,direction:i}):$xe({stdioItem:t,fdNumber:n}),Sxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=wxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ii(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},wxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=xxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(vxe.isatty(i))throw new TypeError(`The \`${e}: ${xb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:bo(bxe(i)),optionName:e}}},xxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=rb.indexOf(t);if(r!==-1)return r},$xe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:qW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:qW(e,e,r),optionName:r}:ii(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,qW=(t,e,r)=>{let n=rb[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var GW,kxe,Exe,Axe,Txe,ZW=y(()=>{ja();sn();wr();GW=({input:t,inputFile:e},r)=>r===0?[...kxe(t),...Axe(e)]:[],kxe=t=>t===void 0?[]:[{type:Exe(t),value:t,optionName:"input"}],Exe=t=>{if(Na(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.")},Axe=t=>t===void 0?[]:[{...Txe(t),optionName:"inputFile"}],Txe=t=>{if(ev(t))return{type:"fileUrl",value:t};if(fI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var VW,WW,Oxe,Rxe,KW,Ixe,Pxe,JW,YW=y(()=>{wr();VW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),WW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Oxe(i,t);if(s.length!==0){if(o){Rxe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(OW.has(t))return KW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});RW.has(t)&&Pxe({otherStdioItems:s,type:t,value:e,optionName:r})}},Oxe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Rxe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{mI.has(e)&&KW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},KW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Ixe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return JW(s,n,e),i==="output"?o[0].stream:void 0},Ixe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Pxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);JW(i,n,e)},JW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${hs[r]} that is the same.`)}});var nv,Cxe,Dxe,Nxe,jxe,Mxe,Fxe,Lxe,zxe,Uxe,qxe,Bxe,bI,Hxe,iv=y(()=>{vo();CW();gI();wr();jW();UW();HW();ZW();YW();nv=(t,e,r,n)=>{let o=LW(e,r,n).map((a,c)=>Cxe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Uxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Hxe(a)),s},Cxe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=nb(e),{stdioItems:o,isStdioArray:s}=Dxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=DW(o,e,i),c=o.map(d=>BW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=PW(c,i,a,r),u=IW(l,a);return zxe(l,u),{direction:a,objectMode:u,stdioItems:l}},Dxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Nxe(c,n)),...GW(r,e)],s=VW(o),a=s.length>1;return jxe(s,a,n),Fxe(s),{stdioItems:s,isStdioArray:a}},Nxe=(t,e)=>({type:SW(t,e),value:t,optionName:e}),jxe=(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(Mxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Mxe=new Set(["ignore","ipc"]),Fxe=t=>{for(let e of t)Lxe(e)},Lxe=({type:t,value:e,optionName:r})=>{if(kW(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(EW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},zxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>rv.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Uxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(qxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw bI(i),o}},qxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Bxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Bxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=WW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},bI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ti(r)&&r.destroy()},Hxe=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 XW}from"node:fs";var e3,Mi,Gxe,t3,QW,Zxe,r3=y(()=>{sn();iv();wr();e3=(t,e)=>nv(Zxe,t,e,!0),Mi=({type:t,optionName:e})=>{t3(e,hs[t])},Gxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&t3(t,`"${e}"`),{}),t3=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},QW={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:Gxe},Zxe={input:{...QW,fileUrl:({value:t})=>({contents:[bo(XW(t))]}),filePath:({value:{file:t}})=>({contents:[bo(XW(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...QW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Mi,string:Mi,uint8Array:Mi}}});var $o,vI,dp=y(()=>{rI();$o=(t,{stripFinalNewline:e},r)=>vI(e,r)&&t!==void 0&&!Array.isArray(t)?Ml(t):t,vI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var ov,wI,n3,i3,Vxe,Wxe,Kxe,o3,Jxe,SI,Yxe,Xxe,Qxe,sv=y(()=>{ov=(t,e,r,n)=>t||r?void 0:i3(e,n),wI=(t,e,r)=>r?t.flatMap(n=>n3(n,e)):n3(t,e),n3=(t,e)=>{let{transform:r,final:n}=i3(e,{});return[...r(t),...n()]},i3=(t,e)=>(e.previousChunks="",{transform:Vxe.bind(void 0,e,t),final:Kxe.bind(void 0,e)}),Vxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=SI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=SI(n,r.slice(i+1))),t.previousChunks=n},Wxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Kxe=function*({previousChunks:t}){t.length>0&&(yield t)},o3=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:Jxe.bind(void 0,n)},Jxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Yxe:Qxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},SI=(t,e)=>`${t}${e}`,Yxe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:gI},Fxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Lxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Fxe}});import{Buffer as zxe}from"node:buffer";var KW,Uxe,JW,qxe,Bxe,YW,XW=y(()=>{on();KW=(t,e)=>t?void 0:Uxe.bind(void 0,e),Uxe=function*(t,e){if(typeof e!="string"&&!qt(e)&&!zxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},JW=(t,e)=>t?qxe.bind(void 0,e):Bxe.bind(void 0,e),qxe=function*(t,e){YW(t,e),yield e},Bxe=function*(t,e){if(YW(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},YW=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:SI},Xxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Qxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Xxe}});import{Buffer as e0e}from"node:buffer";var s3,t0e,a3,r0e,n0e,c3,l3=y(()=>{sn();s3=(t,e)=>t?void 0:t0e.bind(void 0,e),t0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!e0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},a3=(t,e)=>t?r0e.bind(void 0,e):n0e.bind(void 0,e),r0e=function*(t,e){c3(t,e),yield e},n0e=function*(t,e){if(c3(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},c3=(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 Hxe}from"node:buffer";import{StringDecoder as Gxe}from"node:string_decoder";var tv,Zxe,Vxe,Wxe,_I=y(()=>{on();tv=(t,e,r)=>{if(r)return;if(t)return{transform:Zxe.bind(void 0,new TextEncoder)};let n=new Gxe(e);return{transform:Vxe.bind(void 0,n),final:Wxe.bind(void 0,n)}},Zxe=function*(t,e){Hxe.isBuffer(e)?yield _o(e):typeof e=="string"?yield t.encode(e):yield e},Vxe=function*(t,e){yield qt(e)?t.write(e):e},Wxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as QW}from"node:util";var bI,rv,e3,Kxe,t3,Jxe,r3=y(()=>{bI=QW(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=Jxe}=e[r];for await(let i of n(t))yield*rv(i,e,r+1)},e3=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Kxe(r,Number(e),t)},Kxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*rv(n,r,e+1)},t3=QW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Jxe=function*(t){yield t}});var vI,n3,Ma,sp,Yxe,Xxe,SI=y(()=>{vI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},n3=(t,e)=>[...e.flatMap(r=>[...Ma(r,t,0)]),...sp(t)],Ma=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Xxe}=e[r];for(let i of n(t))yield*Ma(i,e,r+1)},sp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Yxe(r,Number(e),t)},Yxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ma(n,r,e+1)},Xxe=function*(t){yield t}});import{Transform as Qxe,getDefaultHighWaterMark as i3}from"node:stream";var wI,nv,o3,iv=y(()=>{wr();ev();XW();_I();r3();SI();wI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=o3(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,e3,a):vI.bind(void 0,sp),p=l||u?t3.bind(void 0,a):void 0;return{stream:new Qxe({writableObjectMode:n,writableHighWaterMark:i3(n),readableObjectMode:i,readableHighWaterMark:i3(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=o3(s,r,a);t=n3(c,t)}return t},o3=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:KW(n,a)},tv(r,s,n),Qb(r,o,n,c),{transform:t,final:e},{transform:JW(i,a)},WW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var s3,e0e,t0e,r0e,n0e,a3=y(()=>{iv();on();wr();s3=(t,e)=>{for(let r of e0e(t))t0e(t,r,e)},e0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),t0e=(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=>r0e(a,n));r.input=Hf(s)},r0e=(t,e)=>{let r=nv(t,e,"utf8",!0);return n0e(r),Hf(r)},n0e=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,i0e,o0e,c3,l3,s0e,u3,xI=y(()=>{Pa();wr();El();ls();ov=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&kl(r,n)&&!sn.has(e)&&i0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&o0e.has(o))||t.every(({type:i})=>In.has(i))),i0e=t=>t===1||t===2,o0e=new Set(["pipe","overlapped"]),c3=async(t,e,r,n)=>{for await(let i of t)s0e(e)||u3(i,r,n)},l3=(t,e,r)=>{for(let n of t)u3(n,e,r)},s0e=t=>t._readableState.pipes.length>0,u3=(t,e,r)=>{let n=ib(t);Pi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as a0e,appendFileSync as c0e}from"node:fs";var d3,l0e,u0e,d0e,f0e,p0e,f3=y(()=>{xI();iv();ev();on();wr();Na();d3=({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)=>l0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},l0e=({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=JV(t,o,d),p=_o(f),{stdioItems:m,objectMode:h}=e[r],g=u0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=d0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});f0e({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&&p0e(b,m,i),S}catch(x){return n.error=x,S}},u0e=(t,e,r,n)=>{try{return nv(t,e,r,!1)}catch(i){return n.error=i,t}},d0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Hf(t)};let s=zG(t,r);return n[o]?{serializedResult:s,finalResult:yI(s,!i[o],e)}:{serializedResult:s}},f0e=({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{l3(a,e,n)}catch(c){r.error??=c}},p0e=(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)?c0e(n,t):(r.add(o),a0e(n,t))}}});var p3,m3=y(()=>{on();op();p3=([,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 h3,m0e,g3,y3,h0e,kI,EI=y(()=>{Ra();h3=async(t,e)=>{let[r,n]=await m0e(t);return e.isForcefullyTerminated??=!1,[r,n]},m0e=async t=>{let[e,r]=await Promise.allSettled([$I(t,"spawn"),$I(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?g3(t):r.value},g3=async t=>{try{return await $I(t,"exit")}catch{return g3(t)}},y3=async t=>{let[e,r]=await t;if(!h0e(e,r)&&kI(e,r))throw new ti;return[e,r]},h0e=(t,e)=>t===void 0&&e===void 0,kI=(t,e)=>t!==0||e!==null});var _3,g0e,b3=y(()=>{Ra();Na();EI();_3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=g0e(t,e,r),s=o?.code==="ETIMEDOUT",a=KV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},g0e=(t,e,r)=>t!==void 0?t:kI(e,r)?new ti:void 0});import{spawnSync as y0e}from"node:child_process";var v3,_0e,b0e,v0e,sv,S0e,w0e,x0e,$0e,S3=y(()=>{SR();KR();JR();ip();Vb();GW();op();a3();f3();Na();m3();b3();v3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=_0e(t,e,r),d=S0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ml(d,c,l)},_0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ab(t,e,r),a=b0e(r),{file:c,commandArguments:l,options:u}=Db(t,e,a);v0e(u);let d=BW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},b0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,v0e=({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.`)},S0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=w0e({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}=_3(c,r),{output:m,error:h=l}=d3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>xo(_,r,S)),b=xo(p3(m,r),r,"all");return $0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},w0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{s3(o,r);let a=x0e(r);return y0e(...Nb(t,e,a))}catch(a){return jl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},x0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Gb(e)}),$0e=({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}):np({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 k0e}from"node:events";var w3,E0e,A0e,T0e,O0e,x3=y(()=>{Il();Xf();Yf();w3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Ol({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Ab(t)}),E0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),E0e=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([A0e(o,n,s),T0e(o,r,s),O0e(o,r,s)])}catch(a){throw Rl(t),a}finally{s.abort(),Sb(e,i)}},A0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await AI(t,"message",{signal:r});return n}for await(let[n]of k0e(t,"message",{signal:r}))if(e(n))return n},T0e=async(t,e,{signal:r})=>{await AI(t,"disconnect",{signal:r}),D9(e)},O0e=async(t,e,{signal:r})=>{let[n]=await AI(t,"strict:error",{signal:r});throw gb(n,e)}});import{once as k3,on as R0e}from"node:events";var E3,TI,I0e,P0e,C0e,$3,OI=y(()=>{Il();Xf();Yf();E3=({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 I0e(t,s,a),P0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),C0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},I0e=async(t,e,r)=>{try{await k3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},P0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await k3(t,"strict:error",{signal:r.signal});n.error=gb(i,e),r.abort()}catch{}},C0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of R0e(r,"message",{signal:o.signal}))$3(s),yield c}catch{$3(s)}finally{o.abort(),Sb(e,a),n||Rl(t),i&&await t}},$3=({error:t})=>{if(t)throw t}});import A3 from"node:process";var T3,O3,R3,RI=y(()=>{Pb();x3();OI();kb();T3=(t,{ipc:e})=>{Object.assign(t,R3(t,!1,e))},O3=()=>{let t=A3,e=!0,r=A3.channel!==void 0;return{...R3(t,e,r),getCancelSignal:cV.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},R3=(t,e,r)=>({sendMessage:Ib.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:w3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:E3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as D0e}from"node:child_process";import{PassThrough as N0e,Readable as j0e,Writable as M0e,Duplex as F0e}from"node:stream";var I3,L0e,ap,z0e,U0e,q0e,B0e,P3=y(()=>{Xb();ip();Vb();I3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{mI(n);let a=new D0e;L0e(a,n),Object.assign(a,{readable:z0e,writable:U0e,duplex:q0e});let c=jl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=B0e(c,s,i);return{subprocess:a,promise:l}},L0e=(t,e)=>{let r=ap(),n=ap(),i=ap(),o=Array.from({length:e.length-3},ap),s=ap(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},ap=()=>{let t=new N0e;return t.end(),t},z0e=()=>new j0e({read(){}}),U0e=()=>new M0e({write(){}}),q0e=()=>new F0e({read(){},write(){}}),B0e=async(t,e,r)=>Ml(t,e,r)});import{createReadStream as C3,createWriteStream as D3}from"node:fs";import{Buffer as H0e}from"node:buffer";import{Readable as cp,Writable as G0e,Duplex as Z0e}from"node:stream";var j3,lp,N3,V0e,M3=y(()=>{iv();Xb();wr();j3=(t,e)=>Yb(V0e,t,e,!1),lp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ps[t]}.`)},N3={fileNumber:lp,generator:wI,asyncGenerator:wI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Z0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},V0e={input:{...N3,fileUrl:({value:t})=>({stream:C3(t)}),filePath:({value:{file:t}})=>({stream:C3(t)}),webStream:({value:t})=>({stream:cp.fromWeb(t)}),iterable:({value:t})=>({stream:cp.from(t)}),asyncIterable:({value:t})=>({stream:cp.from(t)}),string:({value:t})=>({stream:cp.from(t)}),uint8Array:({value:t})=>({stream:cp.from(H0e.from(t))})},output:{...N3,fileUrl:({value:t})=>({stream:D3(t)}),filePath:({value:{file:t,append:e}})=>({stream:D3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:G0e.fromWeb(t)}),iterable:lp,asyncIterable:lp,string:lp,uint8Array:lp}}});import{on as W0e,once as F3}from"node:events";import{PassThrough as K0e,getDefaultHighWaterMark as J0e}from"node:stream";import{finished as U3}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=Y0e(t,e),n=new II({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Y0e,II,X0e,Q0e,e$e,PI,t$e,r$e,n$e,i$e,o$e,q3,B3,CI,H3,s$e,av,L3,z3,cv=y(()=>{Y0e=(t,e)=>{if(t.length===0)return J0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},II=class extends K0e{#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??=X0e(this,this.#t,this.#o);let r=t$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(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)}},X0e=async(t,e,r)=>{av(t,L3);let n=new AbortController;try{await Promise.race([Q0e(t,n),e$e(t,e,r,n)])}finally{n.abort(),av(t,-L3)}},Q0e=async(t,{signal:e})=>{try{await U3(t,{signal:e,cleanup:!0})}catch(r){throw q3(t,r),r}},e$e=async(t,e,r,{signal:n})=>{for await(let[i]of W0e(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}\`.`)},t$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{av(t,z3);let a=new AbortController;try{await Promise.race([r$e(o,e,a),n$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),i$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),av(t,-z3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?CI(t):o$e(t))},r$e=async(t,e,{signal:r})=>{try{await t,r.aborted||CI(e)}catch(n){r.aborted||q3(e,n)}},n$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await U3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;B3(s)?i.add(e):H3(t,s)}},i$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await F3(t,i,{signal:o}),!t.readable)return F3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},o$e=t=>{t.writable&&t.end()},q3=(t,e)=>{B3(e)?CI(t):H3(t,e)},B3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",CI=t=>{(t.readable||t.writable)&&t.destroy()},H3=(t,e)=>{t.destroyed||(t.once("error",s$e),t.destroy(e))},s$e=()=>{},av=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},L3=2,z3=1});import{finished as G3}from"node:stream/promises";var Ll,a$e,DI,c$e,NI,lv=y(()=>{bo();Ll=(t,e)=>{t.pipe(e),a$e(t,e),c$e(t,e)},a$e=async(t,e)=>{if(!(ei(t)||ei(e))){try{await G3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}DI(e)}},DI=t=>{t.writable&&t.end()},c$e=async(t,e)=>{if(!(ei(t)||ei(e))){try{await G3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}NI(t)}},NI=t=>{t.readable&&t.destroy()}});var Z3,l$e,u$e,d$e,f$e,p$e,V3=y(()=>{cv();bo();bb();wr();lv();Z3=(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})=>In.has(c)))l$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!In.has(c)))d$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)}},l$e=(t,e,r,n)=>{r==="output"?Ll(t.stdio[n],e):Ll(e,t.stdio[n]);let i=u$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},u$e=["stdin","stdout","stderr"],d$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;f$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])},f$e=(t,{signal:e})=>{ei(t)&&Ia(t,p$e,e)},p$e=2});var La,W3=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,m$e,FI,dv,h$e,LI,zI,UI,K3,oat,sat,J3=y(()=>{W3();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,m$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];m$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{},h$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:K3,load:oat,unload:sat}=h$e(uv(UI)?new zI(UI):new LI)});import{addAbortListener as g$e}from"node:events";var Y3,X3=y(()=>{J3();Y3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=K3(()=>{t.kill()});g$e(n,()=>{i()})}});var eK,y$e,_$e,Q3,b$e,tK=y(()=>{dR();sb();ds();xl();eK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=ob(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=y$e(r,n,i),{sourceStream:d,sourceError:f}=b$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}},y$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=_$e(t,e,...r),a=_b(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},_$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Q3,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(Q3)(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}`)},Q3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),b$e=(t,e)=>{try{return{sourceStream:Cl(t,e)}}catch(r){return{sourceError:r}}}});var nK,v$e,qI,rK,BI=y(()=>{ip();lv();nK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=v$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw qI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},v$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:rK,escapedCommand:rK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),rK="source.pipe(destination)"});var iK,oK=y(()=>{iK=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 S$e}from"node:stream/promises";var sK,w$e,x$e,$$e,fv,k$e,E$e,aK=y(()=>{cv();bb();lv();sK=(t,e,r)=>{let n=fv.has(e)?x$e(t,e):w$e(t,e);return Ia(t,k$e,r.signal),Ia(e,E$e,r.signal),$$e(e),n},w$e=(t,e)=>{let r=Fa([t]);return Ll(r,e),fv.set(e,r),r},x$e=(t,e)=>{let r=fv.get(e);return r.add(t),r},$$e=async t=>{try{await S$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}fv.delete(t)},fv=new WeakMap,k$e=2,E$e=1});import{aborted as A$e}from"node:util";var cK,T$e,lK=y(()=>{BI();cK=(t,e)=>t===void 0?[]:[T$e(t,e)],T$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await A$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,O$e,R$e,uK=y(()=>{yo();tK();BI();oK();aK();lK();pv=(t,...e)=>{if(Ot(e[0]))return pv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=eK(t,...e),i=O$e({...n,destination:r});return i.pipe=pv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},O$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=R$e(t,i);nK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=sK(e,o,d);return await Promise.race([iK(u),...cK(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},R$e=(t,e)=>Promise.allSettled([t,e])});import{on as I$e}from"node:events";import{getDefaultHighWaterMark as P$e}from"node:stream";var mv,C$e,HI,D$e,fK,GI,dK,N$e,j$e,hv=y(()=>{_I();ev();SI();mv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return C$e(e,s),fK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},C$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;D$e(e,s,t);let a=t.readableObjectMode&&!o;return fK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},D$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},fK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=I$e(t,"data",{signal:e.signal,highWaterMark:dK,highWatermark:dK});return N$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},GI=P$e(!0),dK=GI,N$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=j$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*sp(a)}},j$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[tv(t,r,!e),Qb(t,i,!n,{})].filter(Boolean)});import{setImmediate as M$e}from"node:timers/promises";var pK,F$e,L$e,z$e,ZI,mK,VI=y(()=>{Hb();on();xI();hv();Na();op();pK=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=F$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([L$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([z$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},F$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 c3(a,t,r,o)},L$e=async t=>{await M$e(),t.readableFlowing===null&&t.resume()},z$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 mK(ZV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},ZI=async t=>{try{return await t}catch(e){return mK(e)}},mK=({bufferedData:t})=>FG(t)?new Uint8Array(t):t});import{finished as U$e}from"node:stream/promises";var up,q$e,B$e,H$e,G$e,Z$e,WI,gv,hK,yv=y(()=>{up=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=q$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],U$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||G$e(a,e,r,n)}finally{s.abort()}},q$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&B$e(t,r,n),n},B$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{H$e(e,r),n.call(t,...i)}},H$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},G$e=(t,e,r,n)=>{if(!Z$e(t,e,r,n))throw t},Z$e=(t,e,r,n=!0)=>r.propagating?hK(t)||gv(t):(r.propagating=!0,WI(r,e)===n?hK(t):gv(t)),WI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",gv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",hK=t=>t?.code==="EPIPE"});var gK,KI,JI=y(()=>{VI();yv();gK=({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=up(t,e,l);if(WI(l,e)){await u;return}let[d]=await Promise.all([pK({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 yK,_K,V$e,W$e,YI=y(()=>{cv();JI();yK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fa([t,e].filter(Boolean)):void 0,_K=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>KI({...V$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:W$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),V$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}},W$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var bK,vK,SK=y(()=>{El();ls();bK=t=>kl(t,"ipc"),vK=(t,e)=>{let r=ib(t);Pi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var wK,xK,$K=y(()=>{Na();SK();So();OI();wK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=bK(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&&(VV(t,i,c),i.push(l)),s&&vK(l,o);return i},xK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as K$e}from"node:events";var kK,J$e,Y$e,X$e,EK=y(()=>{Da();HR();NR();BR();bo();wr();VI();$K();ZR();YI();JI();EI();yv();kK=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 _=h3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=gK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=_K({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=wK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=J$e(h,t,S),D=Y$e(m,S);try{return await Promise.race([Promise.all([{},y3(_),Promise.all(x),w,T,_V(t,d),...A,...D]),g,X$e(t,b),...pV(t,o,f,b),...C9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...dV({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),xK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},J$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:up(n,i,r)),Y$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ni(o,{checkOpen:!1})&&!ei(o)).map(({type:i,value:o,stream:s=o})=>up(s,n,e,{isSameDirection:In.has(i),stopOnExit:i==="native"}))),X$e=async(t,{signal:e})=>{let[r]=await K$e(t,"error",{signal:e});throw r}});var AK,dp,zl,_v=y(()=>{Pl();AK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),dp=(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 TK}from"node:stream/promises";var XI,OK,QI,eP,bv,vv,tP=y(()=>{yv();XI=async t=>{if(t!==void 0)try{await QI(t)}catch{}},OK=async t=>{if(t!==void 0)try{await eP(t)}catch{}},QI=async t=>{await TK(t,{cleanup:!0,readable:!1,writable:!0})},eP=async t=>{await TK(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 Q$e}from"node:stream";import{callbackify as eke}from"node:util";var RK,rP,nP,iP,tke,oP,sP,IK,aP=y(()=>{Pa();ds();hv();Pl();_v();tP();RK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||sn.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 Q$e({read:f,destroy:eke(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=dp(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(){tke(this,s,o)},onStdoutDataDone:o}},tke=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),IK(r,o)}},sP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await zl(r,e)&&(IK(t,n),await bv(e,n))},IK=(t,e)=>{vv(t,t.readable,e)}});import{Writable as rke}from"node:stream";import{callbackify as PK}from"node:util";var CK,cP,lP,nke,ike,uP,dP,DK,fP=y(()=>{ds();_v();tP();CK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=cP(t,r,e),s=new rke({...lP(n,t,i),destroy:PK(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=dp(r,n,"writableFinal"),o=dp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},lP=(t,e,r)=>({write:nke.bind(void 0,t),final:PK(ike.bind(void 0,t,e,r))}),nke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},ike=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 OK(r),DK(e,n)}},dP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await zl(r,e),await zl(n,e)&&(DK(t,i),await bv(e,i))},DK=(t,e)=>{vv(t,t.writable,e)}});import{Duplex as oke}from"node:stream";import{callbackify as ske}from"node:util";var NK,ake,jK=y(()=>{Pa();aP();fP();NK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||sn.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 oke({read:g,...lP(u,t,d),destroy:ske(ake.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),_},ake=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,cke,MK=y(()=>{Pa();ds();hv();pP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||sn.has(e),s=Cl(t,r),a=mv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return cke(a,s,t)},cke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var FK,LK=y(()=>{_v();aP();fP();jK();MK();FK=(t,{encoding:e})=>{let r=AK();t.readable=RK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=CK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=NK.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 zK,lke,uke,UK=y(()=>{zK=(t,e)=>{for(let[r,n]of uke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},lke=(async()=>{})().constructor.prototype,uke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(lke,t)])});import{setMaxListeners as dke}from"node:events";import{spawn as fke}from"node:child_process";var qK,pke,mke,hke,gke,yke,BK=y(()=>{Hb();SR();KR();ds();JR();RI();ip();Vb();P3();M3();op();V3();mb();X3();uK();YI();EK();LK();Pl();UK();qK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=pke(t,e,r),{subprocess:f,promise:p}=hke({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}),zK(f,p),Di.set(f,{options:u,fileDescriptors:d}),f},pke=(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=mke(l),d=j3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},mke=({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}},hke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=fke(...Nb(t,e,r))}catch(m){return I3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;dke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];Z3(c,a,l),Y3(c,r,l);let d={},f=Ci();c.kill=I9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=yK(c,r),FK(c,r),T3(c,r);let p=gke({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}},gke=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 kK({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=yke({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)},yke=({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?np({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,_ke,bke,HK=y(()=>{yo();So();Sv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,_ke(n,t[n],i)]));return{...t,...r}},_ke=(t,e,r)=>bke.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,bke=new Set(["env",...gR])});var ms,vke,Ske,GK=y(()=>{yo();dR();ZG();S3();BK();HK();ms=(t,e,r,n)=>{let i=(s,a,c)=>ms(s,a,r,c),o=(...s)=>vke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},vke=({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}=Ske({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?v3(a,c,l):qK(a,c,l,i)},Ske=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=HG(e)?GG(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 ZK,VK,WK,wke,xke,KK=y(()=>{ZK=({file:t,commandArguments:e})=>WK(t,e),VK=({file:t,commandArguments:e})=>({...WK(t,e),isSync:!0}),WK=(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]=wke(t);return{file:r,commandArguments:n}},wke=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(xke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},xke=/ +/g});var JK,YK,$ke,XK,kke,QK,eJ=y(()=>{JK=(t,e,r)=>{t.sync=e($ke,r),t.s=t.sync},YK=({options:t})=>XK(t),$ke=({options:t})=>({...XK(t),isSync:!0}),XK=t=>({options:{...kke(t),...t}}),kke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},QK={preferLocal:!0}});var Klt,We,Jlt,Ylt,Xlt,Qlt,eut,tut,rut,nut,Fr=y(()=>{GK();KK();GR();eJ();RI();Klt=ms(()=>({})),We=ms(()=>({isSync:!0})),Jlt=ms(ZK),Ylt=ms(VK),Xlt=ms(hV),Qlt=ms(YK,{},QK,JK),{sendMessage:eut,getOneMessage:tut,getEachMessage:rut,getCancelSignal:nut}=O3()});import{existsSync as wv,statSync as Eke}from"node:fs";import{dirname as mP,extname as Ake,isAbsolute as tJ,join as hP,relative as gP,resolve as xv,sep as Tke}from"node:path";function $v(t){return t==="./gradlew"||t==="gradle"}function Oke(t){return(wv(hP(t,"build.gradle.kts"))||wv(hP(t,"build.gradle")))&&wv(hP(t,"gradle.properties"))}function Rke(t,e){let n=gP(t,e).split(Tke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function hs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Ike(t,e){let r=xv(t,e),n=r;wv(r)?Eke(r).isFile()&&(n=mP(r)):Ake(r)!==""&&(n=mP(r));let i=gP(t,n);if(i.startsWith("..")||tJ(i))return null;let o=n;for(;;){if(Oke(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("..")||tJ(a))return null;o=s}}function kv(t,e){let r=xv(t),n=new Map,i=[];for(let o of e){let s=Ike(r,o);if(!s){i.push(o);continue}let a=Rke(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 Pke}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,rJ.parse)(Pke(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 Cke){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 nJ(t="."){let e=ql(t).testReport,r=e?[e,...bP]:bP;return[...new Set(r.map(n=>Ul(t,n)))]}function iJ(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 oJ(t,e){let r=[],n=!1;for(let i of t){let o=Dke.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 rJ,Cke,yP,bP,Dke,fp=y(()=>{"use strict";rJ=St(er(),1);Ev();Cke=["type","lint","test","coverage"],yP={scope:"feature"},bP=["test-report.junit.xml",Ul("coverage","junit.xml"),Ul(".cladding","test-report.junit.xml")];Dke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as SP,readFileSync as sJ,readdirSync as Nke,statSync as jke}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(aJ.test(sJ(r,"utf8")))return!0}catch{}}return!1}function cJ(t){try{return SP(t)&&aJ.test(sJ(t,"utf8"))}catch{return!1}}function lJ(t,e=0){if(e>4||!SP(t))return!1;let r;try{r=Nke(t)}catch{return!1}for(let n of r){let i=Av(t,n),o=!1;try{o=jke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(lJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&cJ(i))return!0}return!1}function Lke(t){if($P(t))return!0;for(let e of Mke)if(cJ(Av(t,e)))return!0;for(let e of Fke)if(lJ(Av(t,e)))return!0;return!1}function uJ(t="."){let e=ql(t).coverage;return e||(Lke(t)?"kover":"jacoco")}function dJ(t="."){return wP[uJ(t)]}function fJ(t="."){return vP[uJ(t)]}var wP,vP,xP,aJ,Mke,Fke,Tv=y(()=>{"use strict";fp();wP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},vP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},xP=[vP.kover,vP.jacoco],aJ=/kover/i;Mke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Fke=["buildSrc","build-logic"]});import{existsSync as mp,readFileSync as mJ,readdirSync as hJ}from"node:fs";import{join as gs}from"node:path";function EP(t){return mp(gs(t,"gradlew"))?"./gradlew":"gradle"}function zke(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:[dJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Uke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(mJ(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 Bke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function Zke(t,e){for(let r of e)if(mp(gs(t,r)))return r}function Vke(t,e){try{return hJ(t).find(n=>n.endsWith(e))}catch{return}}function Jke(t){try{return JSON.parse(mJ(gs(t,"package.json"),"utf8"))}catch{return{}}}function pp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function pJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function Yke(t,e,r){if(pp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of Wke)if(n.configs.some(i=>mp(gs(t,i))))return n.gate;if(Kke.some(n=>mp(gs(t,n)))||r.eslintConfig!==void 0)return e}function Qke(t,e){return Xke.some(r=>mp(gs(t,r)))?!0:e.jest!==void 0}function eEe(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 tEe(t,e){let r=Jke(t),n=e.lint?Yke(t,e.lint,r):void 0,i=n?{...e,lint:n}:kP(e,"lint"),o=pp(r,"test"),s=o?eEe(o):void 0;return o&&!s?(i=kP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...pp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&Qke(t,r)?{...i,test:{cmd:"npx",args:[...Mi,"jest"]},coverage:{cmd:"npx",args:[...Mi,"jest","--coverage"]}}:(s==="vitest"&&!pp(r,"coverage")&&!pJ(r,"@vitest/coverage-v8")&&!pJ(r,"@vitest/coverage-istanbul")?i=kP(i,"coverage"):s==="vitest"&&pp(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of Hke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Vke(t,o):r=Zke(t,[o]),r)break;if(!r||e.requiresSource&&!Bke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?tEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return Gke}var Mi,qke,Hke,Gke,Wke,Kke,Xke,an=y(()=>{"use strict";Tv();Mi=["--offline","--no-install"];qke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);Hke=[{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:zke},{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:Uke}],Gke={language:"unknown",manifest:"",gates:{}};Wke=[{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"]}}],Kke=["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"];Xke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as rEe,readFileSync as nEe}from"node:fs";import{join as iEe}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 gJ.test(o)||gJ.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=iEe(t,"package.json");if(!rEe(r))return!1;try{return!!JSON.parse(nEe(r,"utf8")).scripts?.[e]}catch{return!1}}var gJ,Pn=y(()=>{"use strict";gJ=/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 oEe(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";Fr();an();Pn();Rv="ARCHITECTURE_VIOLATION";Ua={name:Rv,subprocess:!0,run:oEe}});function sEe(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";Fr();an();Pn();Pv="HARDCODED_SECRET";qa={name:Pv,subprocess:!0,run:sEe}});import{existsSync as AP,readdirSync as yJ}from"node:fs";import{join as Dv}from"node:path";function cEe(t,e){let r=Dv(t,e.path);if(!AP(r))return!0;if(e.isDirectory)try{return yJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function lEe(t){let{cwd:e="."}=t,r=[];for(let i of aEe)cEe(e,i)&&r.push({detector:hp,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=fEe(n),o=i?null:uEe(e);if(i)r.push({detector:hp,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:hp,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=dEe(e);s&&r.push({detector:hp,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 uEe(t){for(let e of["spec/features","spec/scenarios"]){let r=Dv(t,e);if(!AP(r))continue;let n;try{n=yJ(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 dEe(t){try{return q(t),null}catch(e){return e.message}}function fEe(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 hp,aEe,_J,bJ=y(()=>{"use strict";Ue();F_();hp="ABSENCE_OF_GOVERNANCE",aEe=[{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}];_J={name:hp,run:lEe}});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=mEe.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=pEe[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 hEe(t,e){let r=TP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function vJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...hEe(r,n));return e}var pEe,mEe,OP=y(()=>{"use strict";pEe={event:"when",state:"while",optional:"where",unwanted:"if"},mEe=/\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 gEe(t){let{cwd:e="."}=t;return ge(e,jv,yEe)}function yEe(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 vJ(t.features))e.push({detector:jv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var jv,SJ,wJ=y(()=>{"use strict";OP();wt();jv="AC_DRIFT";SJ={name:jv,run:gEe}});function Fi(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return $J[n]??xJ}var _Ee,bEe,vEe,xJ,SEe,wEe,$J,xEe,kJ,Ba=y(()=>{"use strict";an();_Ee=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,bEe=/^[ \t]*import\s+([\w.]+)/gm,vEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,xJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:_Ee,importStyle:"relative"},SEe={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:bEe,importStyle:"dotted"},wEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:vEe,importStyle:"dotted"},$J={typescript:xJ,kotlin:SEe,python:wEe},xEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],kJ=new Set([...Object.values($J).flatMap(t=>t?.extensions??[]),...xEe].map(t=>t.toLowerCase()))});import{existsSync as $Ee,readFileSync as kEe,readdirSync as EEe,statSync as AEe}from"node:fs";import{join as AJ,relative as EJ}from"node:path";function TEe(t,e){if(!$Ee(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=EEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=AJ(i,s),c;try{c=AEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function OEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function IEe(t){return REe.test(t)}function PEe(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=>TEe(AJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=kEe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";Ue();Ba();TJ="AI_HINTS_FORBIDDEN_PATTERN";REe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;OJ={name:TJ,run:PEe}});function CEe(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:IJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var IJ,PJ,CJ=y(()=>{"use strict";Ue();IJ="AC_DUPLICATE_WITHIN_FEATURE";PJ={name:IJ,run:CEe}});import{createRequire as DEe}from"module";import{basename as NEe,dirname as IP,normalize as jEe,relative as MEe,resolve as FEe,sep as jJ}from"path";import*as LEe from"fs";function zEe(t){let e=jEe(t);return e.length>1&&e[e.length-1]===jJ&&(e=e.substring(0,e.length-1)),e}function MJ(t,e){return t.replace(UEe,e)}function BEe(t){return t==="/"||qEe.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=FEe(t)),(n||o)&&(t=zEe(t)),t===".")return"";let s=t[t.length-1]!==i;return MJ(s?t+i:t,i)}function FJ(t,e){return e+t}function HEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:MJ(MEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function GEe(t){return t}function ZEe(t,e,r){return e+t+r}function VEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?HEe(t,e):n?FJ:GEe}function WEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function KEe(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?KEe(t):WEe(t):n&&n.length?YEe:JEe:XEe}function oAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?iAe:r&&r.length?n?eAe:tAe:n?rAe:nAe}function cAe(t){return t.group?aAe:sAe}function dAe(t){return t.group?lAe:uAe}function mAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?pAe:fAe}function LJ(t,e,r){if(r.options.useRealPaths)return hAe(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 hAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Mv(t,e,r,n){e(t&&!n?t:null,r)}function $Ae(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?gAe:vAe:n?e?yAe:xAe:i?e?bAe:wAe:e?_Ae:SAe}function AAe(t){return t?EAe:kAe}function IAe(t,e){return new Promise((r,n)=>{qJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function qJ(t,e,r){new UJ(t,e,r).start()}function PAe(t,e){return new UJ(t,e).start()}var DJ,UEe,qEe,JEe,YEe,XEe,eAe,tAe,rAe,nAe,iAe,sAe,aAe,lAe,uAe,fAe,pAe,gAe,yAe,_Ae,bAe,vAe,SAe,wAe,xAe,zJ,kAe,EAe,TAe,OAe,RAe,UJ,NJ,BJ,HJ,GJ=y(()=>{DJ=DEe(import.meta.url);UEe=/[\\/]/g;qEe=/^[a-z]:[\\/]$/i;JEe=(t,e)=>{e.push(t||".")},YEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},XEe=()=>{};eAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},tAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},rAe=(t,e,r,n)=>{r.files++},nAe=(t,e)=>{e.push(t)},iAe=()=>{};sAe=t=>t,aAe=()=>[""].slice(0,0);lAe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},uAe=()=>{};fAe=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()&&LJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},pAe=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()&&LJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};gAe=t=>t.counts,yAe=t=>t.groups,_Ae=t=>t.paths,bAe=t=>t.paths.slice(0,t.options.maxFiles),vAe=(t,e,r)=>(Mv(e,r,t.counts,t.options.suppressErrors),null),SAe=(t,e,r)=>(Mv(e,r,t.paths,t.options.suppressErrors),null),wAe=(t,e,r)=>(Mv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),xAe=(t,e,r)=>(Mv(e,r,t.groups,t.options.suppressErrors),null);zJ={withFileTypes:!0},kAe=(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||".",zJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},EAe=(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||".",zJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};TAe=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))}},OAe=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}},RAe=class{aborted=!1;abort(){this.aborted=!0}},UJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=$Ae(e,this.isSynchronous),this.root=RP(t,e),this.state={root:BEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new OAe,options:e,queue:new TAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new RAe,fs:e.fs||LEe},this.joinPath=VEe(this.root,e),this.pushDirectory=QEe(this.root,e),this.pushFile=oAe(e),this.getArray=cAe(e),this.groupFiles=dAe(e),this.resolveSymlink=mAe(e,this.isSynchronous),this.walkDirectory=AAe(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=NEe(_),x=RP(IP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};NJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return IAe(this.root,this.options)}withCallback(t){qJ(this.root,this.options,t)}sync(){return PAe(this.root,this.options)}},BJ=null;try{DJ.resolve("picomatch"),BJ=DJ("picomatch")}catch{}HJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:jJ,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 NJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new NJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||BJ;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 gp=v((sdt,JJ)=>{"use strict";var ZJ="[^\\\\/]",CAe="(?=.)",VJ="[^/]",PP="(?:\\/|$)",WJ="(?:^|\\/)",CP=`\\.{1,2}${PP}`,DAe="(?!\\.)",NAe=`(?!${WJ}${CP})`,jAe=`(?!\\.{0,1}${PP})`,MAe=`(?!${CP})`,FAe="[^.\\/]",LAe=`${VJ}*?`,zAe="/",KJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:CAe,QMARK:VJ,END_ANCHOR:PP,DOTS_SLASH:CP,NO_DOT:DAe,NO_DOTS:NAe,NO_DOT_SLASH:jAe,NO_DOTS_SLASH:MAe,QMARK_NO_DOT:FAe,STAR:LAe,START_ANCHOR:WJ,SEP:zAe},UAe={...KJ,SLASH_LITERAL:"[\\\\/]",QMARK:ZJ,STAR:`${ZJ}*?`,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:"\\"},qAe={__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"};JJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:qAe,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?UAe:KJ}}});var yp=v(Lr=>{"use strict";var{REGEX_BACKSLASH:BAe,REGEX_REMOVE_BACKSLASH:HAe,REGEX_SPECIAL_CHARS:GAe,REGEX_SPECIAL_CHARS_GLOBAL:ZAe}=gp();Lr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Lr.hasRegexChars=t=>GAe.test(t);Lr.isRegexChar=t=>t.length===1&&Lr.hasRegexChars(t);Lr.escapeRegex=t=>t.replace(ZAe,"\\$1");Lr.toPosixSlashes=t=>t.replace(BAe,"/");Lr.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};Lr.removeBackslashes=t=>t.replace(HAe,e=>e==="\\"?"":e);Lr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Lr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Lr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Lr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Lr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var i8=v((cdt,n8)=>{"use strict";var YJ=yp(),{CHAR_ASTERISK:DP,CHAR_AT:VAe,CHAR_BACKWARD_SLASH:_p,CHAR_COMMA:WAe,CHAR_DOT:NP,CHAR_EXCLAMATION_MARK:jP,CHAR_FORWARD_SLASH:r8,CHAR_LEFT_CURLY_BRACE:MP,CHAR_LEFT_PARENTHESES:FP,CHAR_LEFT_SQUARE_BRACKET:KAe,CHAR_PLUS:JAe,CHAR_QUESTION_MARK:XJ,CHAR_RIGHT_CURLY_BRACE:YAe,CHAR_RIGHT_PARENTHESES:QJ,CHAR_RIGHT_SQUARE_BRACKET:XAe}=gp(),e8=t=>t===r8||t===_p,t8=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,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&&e8(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=YJ.removeBackslashes(P)),xe&&_===!0&&(xe=YJ.removeBackslashes(xe)));let Pr={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&&(Pr.maxDepth=0,e8(A)||s.push(D),Pr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var bp=gp(),cn=yp(),{MAX_LENGTH:Fv,POSIX_REGEX_SOURCE:eTe,REGEX_NON_SPECIAL_CHARS:tTe,REGEX_SPECIAL_CHARS_BACKREF:rTe,REPLACEMENTS:o8}=bp,nTe=(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=>cn.escapeRegex(i)).join("..")}return r},Hl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,s8=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},iTe=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},a8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(iTe(e))return e.replace(/\\(.)/g,"$1")},oTe=t=>{let e=t.map(a8).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}}}}},sTe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=a8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?cn.escapeRegex(r[0]):`[${r.map(i=>cn.escapeRegex(i)).join("")}]`}*`},aTe=t=>{let e=0,r=t.trim(),n=LP(r);for(;n;)e++,r=n.body.trim(),n=LP(r);return e},cTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:bp.DEFAULT_MAX_EXTGLOB_RECURSION,n=s8(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||oTe(n)))return{risky:!0};for(let i of n){let o=sTe(i);if(o)return{risky:!0,safeOutput:o};if(aTe(i)>r)return{risky:!0}}return{risky:!1}},zP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=o8[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=bp.globChars(r.windows),l=bp.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=cn.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Pr=()=>$.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)},Qr=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)},zde=H=>{let ht=t.slice(H.startIndex,$.index+1),B=t.slice(H.startIndex+2,$.index),Oe=cTe(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||cn.escapeRegex(ht);for(let Ei=H.tokensIndex+1;Ei1&&H.inner.includes("/")&&(lt=O(r)),(lt!==D||Pr()||/^\)+$/.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}),Qr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,ht=t.replace(rTe,(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=cn.wrapOutput(ht,$,e),$)}for(;!Pr();){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=eTe[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=cn.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){zde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Qr("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}Qr("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||cn.hasRegexChars(B))continue;let Oe=cn.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=nTe(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}),Qr("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=tTe.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"&&Pr()){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&&Pr()){$.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=cn.escapeLast($.output,"["),Qr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hl("closing",")"));$.output=cn.escapeLast($.output,"("),Qr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hl("closing","}"));$.output=cn.escapeLast($.output,"{"),Qr("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=o8[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}=bp.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=cn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};c8.exports=zP});var f8=v((udt,d8)=>{"use strict";var lTe=i8(),UP=l8(),u8=yp(),uTe=gp(),dTe=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=dTe(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?u8.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(u8.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)=>lTe(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=uTe;d8.exports=Rt});var g8=v((ddt,h8)=>{"use strict";var p8=f8(),fTe=yp();function m8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:fTe.isWindows()}),p8(t,e,r)}Object.assign(m8,p8);h8.exports=m8});import{readdir as pTe,readdirSync as mTe,realpath as hTe,realpathSync as gTe,stat as yTe,statSync as _Te}from"fs";import{isAbsolute as bTe,posix as Ha,resolve as vTe}from"path";import{fileURLToPath as STe}from"url";function $Te(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]===".."&&xTe.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 ATe(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 v8(t){var e;let r=Gl.default.scan(t,TTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function DTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Gl.default.scan(t);return r.isGlob||r.negated}function vp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function S8(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=CTe(o);s=bTe(s.replace(jTe,""))?Ha.relative(a,s):Ha.normalize(s);let c=(i=NTe.exec(s))===null||i===void 0?void 0:i[0],l=v8(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 MTe(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 FTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=MTe(t,e,n);t.debug&&vp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(_8,""),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=$Te(i.match,f),g=y8(r,d,o),b=o?g:y8(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 HJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&vp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return vp(`${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&&vp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&ATe(r,d)]}function LTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function UTe(t){let e={...zTe,...t};return e.cwd=(e.cwd instanceof URL?STe(e.cwd):vTe(e.cwd)).replace(_8,"/"),e.ignore=S8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||pTe,readdirSync:e.fs.readdirSync||mTe,realpath:e.fs.realpath||hTe,realpathSync:e.fs.realpathSync||gTe,stat:e.fs.stat||yTe,statSync:e.fs.statSync||_Te}),e.debug&&vp("globbing with options:",e),e}function qTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=wTe(t)||typeof t=="string",i=S8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=UTe(n?e:t);return i.length>0?FTe(o,i):[]}function ys(t,e){let[r,n]=qTe(t,e);return r?LTe(r.sync(),n):[]}var Gl,wTe,_8,b8,xTe,kTe,ETe,TTe,OTe,RTe,ITe,PTe,CTe,NTe,jTe,zTe,Sp=y(()=>{GJ();Gl=St(g8(),1),wTe=Array.isArray,_8=/\\/g,b8=process.platform==="win32",xTe=/^(\/?\.\.)+$/;kTe=/^[A-Z]:\/$/i,ETe=b8?t=>kTe.test(t):t=>t==="/";TTe={parts:!0};OTe=/(?t.replace(OTe,"\\$&"),PTe=t=>t.replace(RTe,"\\$&"),CTe=b8?PTe:ITe;NTe=/^(\/?\.\.)+/,jTe=/\\(?=[()[\]{}!*+?@|])/g;zTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as wp,readFileSync as BTe,readdirSync as HTe,statSync as w8}from"node:fs";import{join as Ga}from"node:path";function GTe(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)&&!wp(Ga(e,i.mainRoot))?[{detector:xp,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&&(ZTe(e,i,s,o),VTe(e,i,s,o)),a.length>0&&WTe(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 ZTe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(wp(o))for(let s of HTe(o)){let a=Ga(o,s);w8(a).isDirectory()&&(r.has(s)||n.push({detector:xp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function VTe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(wp(o))for(let s of r){let a=Ga(o,s);wp(a)&&w8(a).isDirectory()||n.push({detector:xp,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 WTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ga(t,i,s.from);if(!wp(a))continue;let c=ys([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ga(a,l),d;try{d=BTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];KTe(p,s.to,e.importStyle)&&n.push({detector:xp,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 KTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var xp,x8,HP=y(()=>{"use strict";Sp();Ue();Ba();xp="ARCHITECTURE_FROM_SPEC";x8={name:xp,run:GTe}});import{existsSync as JTe,readFileSync as YTe}from"node:fs";import{join as XTe}from"node:path";function eOe(t){let{cwd:e="."}=t,r=XTe(e,"spec/capabilities.yaml");if(!JTe(r))return[];let n;try{let u=YTe(r,"utf8"),d=$8.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";$8=St(er(),1);Ue();Lv="CAPABILITIES_FEATURE_MAPPING",QTe=8;k8={name:Lv,run:eOe}});import{existsSync as tOe,readFileSync as rOe}from"node:fs";import{join as nOe}from"node:path";function iOe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function oOe(t){let{cwd:e="."}=t;return ge(e,GP,r=>sOe(r,e))}function sOe(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=nOe(e,o);if(!tOe(s))continue;let a=rOe(s,"utf8");iOe(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,A8,T8=y(()=>{"use strict";Ba();wt();GP="CONVENTION_DRIFT";A8={name:GP,run:oOe}});import{existsSync as ZP,readFileSync as O8}from"node:fs";import{join as zv}from"node:path";function aOe(t){return JSON.parse(t).total?.lines?.pct??0}function R8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function uOe(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=R8(O8(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=I8(n,i);return a0?[{detector:$o,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function dOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=uOe(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)))??fJ(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=O8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?cOe(a):n.coverageFormat==="cobertura-xml"?lOe(a):aOe(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,P8,C8=y(()=>{"use strict";Ue();Tv();Ba();Ev();an();$o="COVERAGE_DROP",Uv=70;P8={name:$o,run:dOe}});import{existsSync as fOe}from"node:fs";import{join as pOe}from"node:path";function hOe(t){let{cwd:e="."}=t;return ge(e,qv,r=>gOe(r,e))}function gOe(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",mOe=8;D8={name:qv,run:hOe}});function yOe(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 _Oe(t){let e=yOe(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 bOe(t){let{cwd:e="."}=t;return ge(e,Bv,r=>_Oe(r))}var Bv,j8,M8=y(()=>{"use strict";wt();Bv="SMOKE_PROBE_DEMAND";j8={name:Bv,run:bOe}});function vOe(t){let{cwd:e="."}=t;return ge(e,Hv,r=>SOe(r,e))}function SOe(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:vOe}});function wOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return xOe(r)}function xOe(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:F8,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 F8,Zv,WP=y(()=>{"use strict";Ue();F8="DEPENDENCY_CYCLE";Zv={name:F8,run:wOe}});import{appendFileSync as $Oe,existsSync as L8,mkdirSync as kOe,readFileSync as EOe}from"node:fs";import{dirname as AOe,join as TOe}from"node:path";function z8(t){return TOe(t,OOe,ROe)}function U8(t){return KP.add(t),()=>KP.delete(t)}function Za(t,e){let r=z8(t),n=AOe(r);L8(n)||kOe(n,{recursive:!0}),$Oe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of KP)try{i(t,e)}catch{}}function fr(t){let e=z8(t);if(!L8(e))return[];let r=EOe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var OOe,ROe,KP,ln=y(()=>{"use strict";OOe=".cladding",ROe="audit.log.jsonl";KP=new Set});import{existsSync as IOe}from"node:fs";import{join as POe}from"node:path";function COe(t){let{cwd:e="."}=t,r=fr(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&&(IOe(POe(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,q8,B8=y(()=>{"use strict";ln();JP="EVIDENCE_MISMATCH";q8={name:JP,run:COe}});import{existsSync as DOe,readFileSync as NOe}from"node:fs";import{join as jOe}from"node:path";function MOe(t){let e=jOe(t,V8);if(!DOe(e))return null;try{let n=((0,Z8.parse)(NOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*G8(t,e){for(let r of t??[])r.startsWith(H8)&&(yield{ref:r,name:r.slice(H8.length),field:e})}function FOe(t){let{cwd:e="."}=t,r=MOe(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=[...G8(s.evidence_refs,"evidence_refs"),...G8(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:V8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var Z8,YP,H8,V8,W8,K8=y(()=>{"use strict";Z8=St(er(),1);Ue();YP="FIXTURE_REFERENCE_INVALID",H8="fixture:",V8="conformance/fixtures.yaml";W8={name:YP,run:FOe}});import{existsSync as Zl,readFileSync as XP}from"node:fs";import{join as Va}from"node:path";function LOe(t){return ys(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function $p(t){if(!Zl(t))return null;try{return JSON.parse(XP(t,"utf8"))}catch{return null}}function zOe(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=LOe(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 UOe(t,e){for(let r of J8){let n=Va(t,r.path);if(!Zl(n))continue;let i=$p(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 qOe(t,e){let r=$p(Va(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of J8){let s=Va(t,o.path);if(!Zl(s))continue;let a=$p(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=$p(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 BOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function HOe(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=BOe(XP(r,"utf8"));if(i.length===0)return;let s=$p(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 GOe(t){let{cwd:e="."}=t,r=[];return zOe(e,r),HOe(e,r),UOe(e,r),qOe(e,r),r}var ko,J8,Y8,X8=y(()=>{"use strict";Sp();ko="HARNESS_INTEGRITY",J8=[{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"]}];Y8={name:ko,run:GOe}});import{existsSync as ZOe,readFileSync as VOe}from"node:fs";import{join as WOe}from"node:path";function JOe(t){let{cwd:e="."}=t;return ge(e,Vv,r=>XOe(r,e))}function YOe(t){let e=WOe(t,"spec/capabilities.yaml");if(!ZOe(e))return!1;try{let r=Q8.default.parse(VOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function XOe(t,e){let r=t.features.length;if(r{"use strict";Q8=St(er(),1);wt();Vv="HOLLOW_GOVERNANCE",KOe=8;e5={name:Vv,run:JOe}});import{existsSync as r5,readFileSync as n5}from"node:fs";import{join as i5}from"node:path";function o5(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 tRe(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 rRe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function nRe(t){let e=i5(t,"README.md"),r=i5(t,"docs","dogfood","matrix.md");if(!r5(e)||!r5(r))return[];let n=o5(n5(e,"utf8"),QOe),i=o5(n5(r,"utf8"),eRe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=rRe(a);if(c===null)continue;let l=i[s]??"not-run",u=tRe(l);u!==null&&c>u&&o.push({detector:s5,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 iRe(t){let{cwd:e="."}=t;return nRe(e)}var s5,QOe,eRe,a5,c5=y(()=>{"use strict";s5="HOST_CLAIM_DRIFT",QOe=//,eRe=//;a5={name:s5,run:iRe}});function oRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return l5(r.features.map(i=>i.id),"feature","spec/features/",n),l5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function l5(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:u5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var u5,d5,f5=y(()=>{"use strict";Ue();u5="ID_COLLISION";d5={name:u5,run:oRe}});import{existsSync as kp,readFileSync as QP,readdirSync as eC,statSync as sRe,writeFileSync as m5}from"node:fs";import{join as Eo}from"node:path";function p5(t){if(!kp(t))return 0;try{return eC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function aRe(t){if(!kp(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=sRe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function cRe(t){let e=Eo(t,"spec","capabilities.yaml");if(!kp(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=p5(Eo(t,"spec","features")),r=p5(Eo(t,"spec","scenarios")),n=cRe(t),i=aRe(Eo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Vl(t,e){let r=Eo(t,"spec.yaml");if(!kp(r))return;let n=QP(r,"utf8"),i=lRe(n,e);i!==n&&m5(r,i)}function lRe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as i0e}from"node:buffer";import{StringDecoder as o0e}from"node:string_decoder";var av,s0e,a0e,c0e,xI=y(()=>{sn();av=(t,e,r)=>{if(r)return;if(t)return{transform:s0e.bind(void 0,new TextEncoder)};let n=new o0e(e);return{transform:a0e.bind(void 0,n),final:c0e.bind(void 0,n)}},s0e=function*(t,e){i0e.isBuffer(e)?yield bo(e):typeof e=="string"?yield t.encode(e):yield e},a0e=function*(t,e){yield qt(e)?t.write(e):e},c0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as u3}from"node:util";var $I,cv,d3,l0e,f3,u0e,p3=y(()=>{$I=u3(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),cv=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=u0e}=e[r];for await(let i of n(t))yield*cv(i,e,r+1)},d3=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*l0e(r,Number(e),t)},l0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*cv(n,r,e+1)},f3=u3(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),u0e=function*(t){yield t}});var kI,m3,La,fp,d0e,f0e,EI=y(()=>{kI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},m3=(t,e)=>[...e.flatMap(r=>[...La(r,t,0)]),...fp(t)],La=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=f0e}=e[r];for(let i of n(t))yield*La(i,e,r+1)},fp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*d0e(r,Number(e),t)},d0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*La(n,r,e+1)},f0e=function*(t){yield t}});import{Transform as p0e,getDefaultHighWaterMark as h3}from"node:stream";var AI,lv,g3,uv=y(()=>{wr();sv();l3();xI();p3();EI();AI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=g3(t,s,o),l=Fa(e),u=Fa(r),d=l?$I.bind(void 0,cv,a):kI.bind(void 0,La),f=l||u?$I.bind(void 0,d3,a):kI.bind(void 0,fp),p=l||u?f3.bind(void 0,a):void 0;return{stream:new p0e({writableObjectMode:n,writableHighWaterMark:h3(n),readableObjectMode:i,readableHighWaterMark:h3(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},lv=(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=g3(s,r,a);t=m3(c,t)}return t},g3=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:s3(n,a)},av(r,s,n),ov(r,o,n,c),{transform:t,final:e},{transform:a3(i,a)},o3({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var y3,m0e,h0e,g0e,y0e,_3=y(()=>{uv();sn();wr();y3=(t,e)=>{for(let r of m0e(t))h0e(t,r,e)},m0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),h0e=(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 ${hs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>g0e(a,n));r.input=Jf(s)},g0e=(t,e)=>{let r=lv(t,e,"utf8",!0);return y0e(r),Jf(r)},y0e=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 dv,_0e,b0e,b3,v3,v0e,S3,TI=y(()=>{Da();wr();Ol();ds();dv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Tl(r,n)&&!an.has(e)&&_0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&b0e.has(o))||t.every(({type:i})=>Pn.has(i))),_0e=t=>t===1||t===2,b0e=new Set(["pipe","overlapped"]),b3=async(t,e,r,n)=>{for await(let i of t)v0e(e)||S3(i,r,n)},v3=(t,e,r)=>{for(let n of t)S3(n,e,r)},v0e=t=>t._readableState.pipes.length>0,S3=(t,e,r)=>{let n=ub(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as S0e,appendFileSync as w0e}from"node:fs";var w3,x0e,$0e,k0e,E0e,A0e,x3=y(()=>{TI();uv();sv();sn();wr();Ma();w3=({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)=>x0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},x0e=({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=aW(t,o,d),p=bo(f),{stdioItems:m,objectMode:h}=e[r],g=$0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=k0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});E0e({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&&A0e(b,m,i),S}catch(x){return n.error=x,S}},$0e=(t,e,r,n)=>{try{return lv(t,e,r,!1)}catch(i){return n.error=i,t}},k0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Jf(t)};let s=YG(t,r);return n[o]?{serializedResult:s,finalResult:wI(s,!i[o],e)}:{serializedResult:s}},E0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!dv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=wI(t,!1,s);try{v3(a,e,n)}catch(c){r.error??=c}},A0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>rv.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?w0e(n,t):(r.add(o),S0e(n,t))}}});var $3,k3=y(()=>{sn();dp();$3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,$o(e,r,"all")]:Array.isArray(e)?[$o(t,r,"all"),...e]:qt(t)&&qt(e)?yR([t,e]):`${t}${e}`}});import{once as OI}from"node:events";var E3,T0e,A3,T3,O0e,RI,II=y(()=>{Pa();E3=async(t,e)=>{let[r,n]=await T0e(t);return e.isForcefullyTerminated??=!1,[r,n]},T0e=async t=>{let[e,r]=await Promise.allSettled([OI(t,"spawn"),OI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?A3(t):r.value},A3=async t=>{try{return await OI(t,"exit")}catch{return A3(t)}},T3=async t=>{let[e,r]=await t;if(!O0e(e,r)&&RI(e,r))throw new ri;return[e,r]},O0e=(t,e)=>t===void 0&&e===void 0,RI=(t,e)=>t!==0||e!==null});var O3,R0e,R3=y(()=>{Pa();Ma();II();O3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=R0e(t,e,r),s=o?.code==="ETIMEDOUT",a=sW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},R0e=(t,e,r)=>t!==void 0?t:RI(e,r)?new ri:void 0});import{spawnSync as I0e}from"node:child_process";var I3,P0e,C0e,D0e,fv,N0e,j0e,M0e,F0e,P3=y(()=>{ER();eI();tI();up();Qb();r3();dp();_3();x3();Ma();k3();R3();I3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=P0e(t,e,r),d=N0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return zl(d,c,l)},P0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=pb(t,e,r),a=C0e(r),{file:c,commandArguments:l,options:u}=zb(t,e,a);D0e(u);let d=e3(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,D0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&fv("ipcInput"),t&&fv("ipc: true"),r&&fv("detached: true"),n&&fv("cancelSignal")},fv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},N0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=j0e({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}=O3(c,r),{output:m,error:h=l}=w3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>$o(_,r,S)),b=$o($3(m,r),r,"all");return F0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},j0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{y3(o,r);let a=M0e(r);return I0e(...Ub(t,e,a))}catch(a){return Ll({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},M0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Yb(e)}),F0e=({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?Xb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):lp({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 PI,on as L0e}from"node:events";var C3,z0e,U0e,q0e,B0e,D3=y(()=>{Dl();ip();np();C3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Pl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Cb(t)}),z0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),z0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{Eb(e,i);let o=ms(t,e,r),s=new AbortController;try{return await Promise.race([U0e(o,n,s),q0e(o,r,s),B0e(o,r,s)])}catch(a){throw Cl(t),a}finally{s.abort(),Ab(e,i)}},U0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await PI(t,"message",{signal:r});return n}for await(let[n]of L0e(t,"message",{signal:r}))if(e(n))return n},q0e=async(t,e,{signal:r})=>{await PI(t,"disconnect",{signal:r}),G9(e)},B0e=async(t,e,{signal:r})=>{let[n]=await PI(t,"strict:error",{signal:r});throw wb(n,e)}});import{once as j3,on as H0e}from"node:events";var M3,CI,G0e,Z0e,V0e,N3,DI=y(()=>{Dl();ip();np();M3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>CI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),CI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Pl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Cb(t)}),Eb(e,o);let s=ms(t,e,r),a=new AbortController,c={};return G0e(t,s,a),Z0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),V0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},G0e=async(t,e,r)=>{try{await j3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Z0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await j3(t,"strict:error",{signal:r.signal});n.error=wb(i,e),r.abort()}catch{}},V0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of H0e(r,"message",{signal:o.signal}))N3(s),yield c}catch{N3(s)}finally{o.abort(),Ab(e,a),n||Cl(t),i&&await t}},N3=({error:t})=>{if(t)throw t}});import F3 from"node:process";var L3,z3,U3,NI=y(()=>{Fb();D3();DI();Ib();L3=(t,{ipc:e})=>{Object.assign(t,U3(t,!1,e))},z3=()=>{let t=F3,e=!0,r=F3.channel!==void 0;return{...U3(t,e,r),getCancelSignal:bV.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},U3=(t,e,r)=>({sendMessage:Mb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:C3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:M3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as W0e}from"node:child_process";import{PassThrough as K0e,Readable as J0e,Writable as Y0e,Duplex as X0e}from"node:stream";var q3,Q0e,pp,e$e,t$e,r$e,n$e,B3=y(()=>{iv();up();Qb();q3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{bI(n);let a=new W0e;Q0e(a,n),Object.assign(a,{readable:e$e,writable:t$e,duplex:r$e});let c=Ll({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=n$e(c,s,i);return{subprocess:a,promise:l}},Q0e=(t,e)=>{let r=pp(),n=pp(),i=pp(),o=Array.from({length:e.length-3},pp),s=pp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},pp=()=>{let t=new K0e;return t.end(),t},e$e=()=>new J0e({read(){}}),t$e=()=>new Y0e({write(){}}),r$e=()=>new X0e({read(){},write(){}}),n$e=async(t,e,r)=>zl(t,e,r)});import{createReadStream as H3,createWriteStream as G3}from"node:fs";import{Buffer as i$e}from"node:buffer";import{Readable as mp,Writable as o$e,Duplex as s$e}from"node:stream";var V3,hp,Z3,a$e,W3=y(()=>{uv();iv();wr();V3=(t,e)=>nv(a$e,t,e,!1),hp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${hs[t]}.`)},Z3={fileNumber:hp,generator:AI,asyncGenerator:AI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:s$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},a$e={input:{...Z3,fileUrl:({value:t})=>({stream:H3(t)}),filePath:({value:{file:t}})=>({stream:H3(t)}),webStream:({value:t})=>({stream:mp.fromWeb(t)}),iterable:({value:t})=>({stream:mp.from(t)}),asyncIterable:({value:t})=>({stream:mp.from(t)}),string:({value:t})=>({stream:mp.from(t)}),uint8Array:({value:t})=>({stream:mp.from(i$e.from(t))})},output:{...Z3,fileUrl:({value:t})=>({stream:G3(t)}),filePath:({value:{file:t,append:e}})=>({stream:G3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:o$e.fromWeb(t)}),iterable:hp,asyncIterable:hp,string:hp,uint8Array:hp}}});import{on as c$e,once as K3}from"node:events";import{PassThrough as l$e,getDefaultHighWaterMark as u$e}from"node:stream";import{finished as X3}from"node:stream/promises";function za(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)MI(i);let e=t.some(({readableObjectMode:i})=>i),r=d$e(t,e),n=new jI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var d$e,jI,f$e,p$e,m$e,MI,h$e,g$e,y$e,_$e,b$e,Q3,eK,FI,tK,v$e,pv,J3,Y3,mv=y(()=>{d$e=(t,e)=>{if(t.length===0)return u$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},jI=class extends l$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(MI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=f$e(this,this.#t,this.#o);let r=h$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(MI(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)}},f$e=async(t,e,r)=>{pv(t,J3);let n=new AbortController;try{await Promise.race([p$e(t,n),m$e(t,e,r,n)])}finally{n.abort(),pv(t,-J3)}},p$e=async(t,{signal:e})=>{try{await X3(t,{signal:e,cleanup:!0})}catch(r){throw Q3(t,r),r}},m$e=async(t,e,r,{signal:n})=>{for await(let[i]of c$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},MI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},h$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{pv(t,Y3);let a=new AbortController;try{await Promise.race([g$e(o,e,a),y$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),_$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),pv(t,-Y3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?FI(t):b$e(t))},g$e=async(t,e,{signal:r})=>{try{await t,r.aborted||FI(e)}catch(n){r.aborted||Q3(e,n)}},y$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await X3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;eK(s)?i.add(e):tK(t,s)}},_$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await K3(t,i,{signal:o}),!t.readable)return K3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},b$e=t=>{t.writable&&t.end()},Q3=(t,e)=>{eK(e)?FI(t):tK(t,e)},eK=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",FI=t=>{(t.readable||t.writable)&&t.destroy()},tK=(t,e)=>{t.destroyed||(t.once("error",v$e),t.destroy(e))},v$e=()=>{},pv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},J3=2,Y3=1});import{finished as rK}from"node:stream/promises";var ql,S$e,LI,w$e,zI,hv=y(()=>{vo();ql=(t,e)=>{t.pipe(e),S$e(t,e),w$e(t,e)},S$e=async(t,e)=>{if(!(ti(t)||ti(e))){try{await rK(t,{cleanup:!0,readable:!0,writable:!1})}catch{}LI(e)}},LI=t=>{t.writable&&t.end()},w$e=async(t,e)=>{if(!(ti(t)||ti(e))){try{await rK(e,{cleanup:!0,readable:!1,writable:!0})}catch{}zI(t)}},zI=t=>{t.readable&&t.destroy()}});var nK,x$e,$$e,k$e,E$e,A$e,iK=y(()=>{mv();vo();kb();wr();hv();nK=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Pn.has(c)))x$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Pn.has(c)))k$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]:za(o);ql(s,i)}},x$e=(t,e,r,n)=>{r==="output"?ql(t.stdio[n],e):ql(e,t.stdio[n]);let i=$$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},$$e=["stdin","stdout","stderr"],k$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;E$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},E$e=(t,{signal:e})=>{ti(t)&&Ca(t,A$e,e)},A$e=2});var Ua,oK=y(()=>{Ua=[];Ua.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ua.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ua.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var gv,UI,qI,T$e,BI,yv,O$e,HI,GI,ZI,sK,jat,Mat,aK=y(()=>{oK();gv=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",UI=Symbol.for("signal-exit emitter"),qI=globalThis,T$e=Object.defineProperty.bind(Object),BI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(qI[UI])return qI[UI];T$e(qI,UI,{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}},yv=class{},O$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),HI=class extends yv{onExit(){return()=>{}}load(){}unload(){}},GI=class extends yv{#t=ZI.platform==="win32"?"SIGINT":"SIGHUP";#r=new BI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ua)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(!gv(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 Ua)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,Ua.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 gv(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"&&gv(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)}},ZI=globalThis.process,{onExit:sK,load:jat,unload:Mat}=O$e(gv(ZI)?new GI(ZI):new HI)});import{addAbortListener as R$e}from"node:events";var cK,lK=y(()=>{aK();cK=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=sK(()=>{t.kill()});R$e(n,()=>{i()})}});var dK,I$e,P$e,uK,C$e,fK=y(()=>{gR();fb();ps();El();dK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=db(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=I$e(r,n,i),{sourceStream:d,sourceError:f}=C$e(t,l),{options:p,fileDescriptors:m}=Ni.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},I$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=P$e(t,e,...r),a=$b(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},P$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(uK,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||mR(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]=eb(r,...n);return{destination:e(uK)(i,o,s),pipeOptions:s}}if(Ni.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}`)},uK=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),C$e=(t,e)=>{try{return{sourceStream:jl(t,e)}}catch(r){return{sourceError:r}}}});var mK,D$e,VI,pK,WI=y(()=>{up();hv();mK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=D$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw VI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},D$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return zI(t),n;if(e!==void 0)return LI(r),e},VI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Ll({error:t,command:pK,escapedCommand:pK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),pK="source.pipe(destination)"});var hK,gK=y(()=>{hK=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 N$e}from"node:stream/promises";var yK,j$e,M$e,F$e,_v,L$e,z$e,_K=y(()=>{mv();kb();hv();yK=(t,e,r)=>{let n=_v.has(e)?M$e(t,e):j$e(t,e);return Ca(t,L$e,r.signal),Ca(e,z$e,r.signal),F$e(e),n},j$e=(t,e)=>{let r=za([t]);return ql(r,e),_v.set(e,r),r},M$e=(t,e)=>{let r=_v.get(e);return r.add(t),r},F$e=async t=>{try{await N$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}_v.delete(t)},_v=new WeakMap,L$e=2,z$e=1});import{aborted as U$e}from"node:util";var bK,q$e,vK=y(()=>{WI();bK=(t,e)=>t===void 0?[]:[q$e(t,e)],q$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await U$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw VI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var bv,B$e,H$e,SK=y(()=>{_o();fK();WI();gK();_K();vK();bv=(t,...e)=>{if(Ot(e[0]))return bv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=dK(t,...e),i=B$e({...n,destination:r});return i.pipe=bv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},B$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=H$e(t,i);mK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=yK(e,o,d);return await Promise.race([hK(u),...bK(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},H$e=(t,e)=>Promise.allSettled([t,e])});import{on as G$e}from"node:events";import{getDefaultHighWaterMark as Z$e}from"node:stream";var vv,V$e,KI,W$e,xK,JI,wK,K$e,J$e,Sv=y(()=>{xI();sv();EI();vv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return V$e(e,s),xK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},V$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},KI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;W$e(e,s,t);let a=t.readableObjectMode&&!o;return xK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},W$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},xK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=G$e(t,"data",{signal:e.signal,highWaterMark:wK,highWatermark:wK});return K$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},JI=Z$e(!0),wK=JI,K$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=J$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*La(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*fp(a)}},J$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[av(t,r,!e),ov(t,i,!n,{})].filter(Boolean)});import{setImmediate as Y$e}from"node:timers/promises";var $K,X$e,Q$e,eke,YI,kK,XI=y(()=>{Jb();sn();TI();Sv();Ma();dp();$K=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=X$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Q$e(t),d]);return}let f=vI(c,r),p=KI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([eke({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},X$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!dv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=KI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await b3(a,t,r,o)},Q$e=async t=>{await Y$e(),t.readableFlowing===null&&t.resume()},eke=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 Vb(r,{maxBuffer:o})):await Kb(r,{maxBuffer:o})}catch(a){return kK(nW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},YI=async t=>{try{return await t}catch(e){return kK(e)}},kK=({bufferedData:t})=>KG(t)?new Uint8Array(t):t});import{finished as tke}from"node:stream/promises";var gp,rke,nke,ike,oke,ske,QI,wv,EK,xv=y(()=>{gp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=rke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],tke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||oke(a,e,r,n)}finally{s.abort()}},rke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&nke(t,r,n),n},nke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{ike(e,r),n.call(t,...i)}},ike=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},oke=(t,e,r,n)=>{if(!ske(t,e,r,n))throw t},ske=(t,e,r,n=!0)=>r.propagating?EK(t)||wv(t):(r.propagating=!0,QI(r,e)===n?EK(t):wv(t)),QI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",wv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",EK=t=>t?.code==="EPIPE"});var AK,eP,tP=y(()=>{XI();xv();AK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>eP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),eP=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=gp(t,e,l);if(QI(l,e)){await u;return}let[d]=await Promise.all([$K({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 TK,OK,ake,cke,rP=y(()=>{mv();tP();TK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?za([t,e].filter(Boolean)):void 0,OK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>eP({...ake(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:cke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),ake=({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}},cke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var RK,IK,PK=y(()=>{Ol();ds();RK=t=>Tl(t,"ipc"),IK=(t,e)=>{let r=ub(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var CK,DK,NK=y(()=>{Ma();PK();wo();DI();CK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=RK(o),a=So(e,"ipc"),c=So(r,"ipc");for await(let l of CI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(iW(t,i,c),i.push(l)),s&&IK(l,o);return i},DK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as lke}from"node:events";var jK,uke,dke,fke,MK=y(()=>{ja();KR();zR();WR();vo();wr();XI();NK();YR();rP();tP();II();xv();jK=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 _=E3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=AK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=OK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=CK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=uke(h,t,S),D=dke(m,S);try{return await Promise.race([Promise.all([{},T3(_),Promise.all(x),w,T,OV(t,d),...A,...D]),g,fke(t,b),...$V(t,o,f,b),...H9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...wV({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=>YI(re))),YI(w),DK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},uke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:gp(n,i,r)),dke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ii(o,{checkOpen:!1})&&!ti(o)).map(({type:i,value:o,stream:s=o})=>gp(s,n,e,{isSameDirection:Pn.has(i),stopOnExit:i==="native"}))),fke=async(t,{signal:e})=>{let[r]=await lke(t,"error",{signal:e});throw r}});var FK,yp,Bl,$v=y(()=>{Nl();FK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),yp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Di();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Bl=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 LK}from"node:stream/promises";var nP,zK,iP,oP,kv,Ev,sP=y(()=>{xv();nP=async t=>{if(t!==void 0)try{await iP(t)}catch{}},zK=async t=>{if(t!==void 0)try{await oP(t)}catch{}},iP=async t=>{await LK(t,{cleanup:!0,readable:!1,writable:!0})},oP=async t=>{await LK(t,{cleanup:!0,readable:!0,writable:!1})},kv=async(t,e)=>{if(await t,e)throw e},Ev=(t,e,r)=>{r&&!wv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as pke}from"node:stream";import{callbackify as mke}from"node:util";var UK,aP,cP,lP,hke,uP,dP,qK,fP=y(()=>{Da();ps();Sv();Nl();$v();sP();UK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||an.has(r),{subprocessStdout:a,waitReadableDestroy:c}=aP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=cP(a,s),{read:f,onStdoutDataDone:p}=lP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new pke({read:f,destroy:mke(dP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return uP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},aP=(t,e,r)=>{let n=jl(t,e),i=yp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},cP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:JI},lP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Di(),s=vv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){hke(this,s,o)},onStdoutDataDone:o}},hke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},uP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await oP(t),await n,await nP(i),await e,r.readable&&r.push(null)}catch(o){await nP(i),qK(r,o)}},dP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Bl(r,e)&&(qK(t,n),await kv(e,n))},qK=(t,e)=>{Ev(t,t.readable,e)}});import{Writable as gke}from"node:stream";import{callbackify as BK}from"node:util";var HK,pP,mP,yke,_ke,hP,gP,GK,yP=y(()=>{ps();$v();sP();HK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=pP(t,r,e),s=new gke({...mP(n,t,i),destroy:BK(gP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return hP(n,s),s},pP=(t,e,r)=>{let n=$b(t,e),i=yp(r,n,"writableFinal"),o=yp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},mP=(t,e,r)=>({write:yke.bind(void 0,t),final:BK(_ke.bind(void 0,t,e,r))}),yke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},_ke=async(t,e,r)=>{await Bl(r,e)&&(t.writable&&t.end(),await e)},hP=async(t,e,r)=>{try{await iP(t),e.writable&&e.end()}catch(n){await zK(r),GK(e,n)}},gP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Bl(r,e),await Bl(n,e)&&(GK(t,i),await kv(e,i))},GK=(t,e)=>{Ev(t,t.writable,e)}});import{Duplex as bke}from"node:stream";import{callbackify as vke}from"node:util";var ZK,Ske,VK=y(()=>{Da();fP();yP();ZK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||an.has(r),{subprocessStdout:c,waitReadableDestroy:l}=aP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=pP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=cP(c,a),{read:g,onStdoutDataDone:b}=lP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new bke({read:g,...mP(u,t,d),destroy:vke(Ske.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 uP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),hP(u,_,c),_},Ske=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([dP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),gP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var _P,wke,WK=y(()=>{Da();ps();Sv();_P=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||an.has(e),s=jl(t,r),a=vv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return wke(a,s,t)},wke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var KK,JK=y(()=>{$v();fP();yP();VK();WK();KK=(t,{encoding:e})=>{let r=FK();t.readable=UK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=HK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=ZK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=_P.bind(void 0,t,e),t[Symbol.asyncIterator]=_P.bind(void 0,t,e,{})}});var YK,xke,$ke,XK=y(()=>{YK=(t,e)=>{for(let[r,n]of $ke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},xke=(async()=>{})().constructor.prototype,$ke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(xke,t)])});import{setMaxListeners as kke}from"node:events";import{spawn as Eke}from"node:child_process";var QK,Ake,Tke,Oke,Rke,Ike,eJ=y(()=>{Jb();ER();eI();ps();tI();NI();up();Qb();B3();W3();dp();iK();vb();lK();SK();rP();MK();JK();Nl();XK();QK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Ake(t,e,r),{subprocess:f,promise:p}=Oke({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=bv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),YK(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},Ake=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=pb(t,e,r),{file:a,commandArguments:c,options:l}=zb(t,e,r),u=Tke(l),d=V3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Tke=({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}},Oke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Eke(...Ub(t,e,r))}catch(m){return q3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;kke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];nK(c,a,l),cK(c,r,l);let d={},f=Di();c.kill=q9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=TK(c,r),KK(c,r),L3(c,r);let p=Rke({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}},Rke=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 jK({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)=>$o(x,e,w)),_=$o(h,e,"all"),S=Ike({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return zl(S,n,e)},Ike=({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?lp({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 ji,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Xb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Av,Pke,Cke,tJ=y(()=>{_o();wo();Av=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Pke(n,t[n],i)]));return{...t,...r}},Pke=(t,e,r)=>Cke.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,Cke=new Set(["env",...SR])});var gs,Dke,Nke,rJ=y(()=>{_o();gR();nZ();P3();eJ();tJ();gs=(t,e,r,n)=>{let i=(s,a,c)=>gs(s,a,r,c),o=(...s)=>Dke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Dke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Av(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Nke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?I3(a,c,l):QK(a,c,l,i)},Nke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=tZ(e)?rZ(e,r):[e,...r],[s,a,c]=eb(...o),l=Av(Av(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 nJ,iJ,oJ,jke,Mke,sJ=y(()=>{nJ=({file:t,commandArguments:e})=>oJ(t,e),iJ=({file:t,commandArguments:e})=>({...oJ(t,e),isSync:!0}),oJ=(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]=jke(t);return{file:r,commandArguments:n}},jke=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(Mke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},Mke=/ +/g});var aJ,cJ,Fke,lJ,Lke,uJ,dJ=y(()=>{aJ=(t,e,r)=>{t.sync=e(Fke,r),t.s=t.sync},cJ=({options:t})=>lJ(t),Fke=({options:t})=>({...lJ(t),isSync:!0}),lJ=t=>({options:{...Lke(t),...t}}),Lke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},uJ={preferLocal:!0}});var Eut,We,Aut,Tut,Out,Rut,Iut,Put,Cut,Dut,Lr=y(()=>{rJ();sJ();JR();dJ();NI();Eut=gs(()=>({})),We=gs(()=>({isSync:!0})),Aut=gs(nJ),Tut=gs(iJ),Out=gs(EV),Rut=gs(cJ,{},uJ,aJ),{sendMessage:Iut,getOneMessage:Put,getEachMessage:Cut,getCancelSignal:Dut}=z3()});import{existsSync as Tv,statSync as zke}from"node:fs";import{dirname as bP,extname as Uke,isAbsolute as fJ,join as vP,relative as SP,resolve as Ov,sep as qke}from"node:path";function Rv(t){return t==="./gradlew"||t==="gradle"}function Bke(t){return(Tv(vP(t,"build.gradle.kts"))||Tv(vP(t,"build.gradle")))&&Tv(vP(t,"gradle.properties"))}function Hke(t,e){let n=SP(t,e).split(qke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ys(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Gke(t,e){let r=Ov(t,e),n=r;Tv(r)?zke(r).isFile()&&(n=bP(r)):Uke(r)!==""&&(n=bP(r));let i=SP(t,n);if(i.startsWith("..")||fJ(i))return null;let o=n;for(;;){if(Bke(o))return o;if(Ov(o)===Ov(t))return null;let s=bP(o);if(s===o)return null;let a=SP(t,s);if(a.startsWith("..")||fJ(a))return null;o=s}}function Iv(t,e){let r=Ov(t),n=new Map,i=[];for(let o of e){let s=Gke(r,o);if(!s){i.push(o);continue}let a=Hke(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 Pv=y(()=>{"use strict"});import{existsSync as xP,readFileSync as Zke}from"node:fs";import{join as Hl}from"node:path";function Gl(t="."){let e=Hl(t,".cladding","config.yaml");if(!xP(e))return wP;try{let n=(0,pJ.parse)(Zke(e,"utf8"))?.gate;if(!n)return wP;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 Vke){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 wP}}function mJ(t="."){let e=Gl(t).testReport,r=e?[e,...$P]:$P;return[...new Set(r.map(n=>Hl(t,n)))]}function hJ(t="."){let e=Gl(t).testReport;if(e){let r=Hl(t,e);return xP(r)?r:null}return $P.map(r=>Hl(t,r)).find(r=>xP(r))??null}function gJ(t,e){let r=[],n=!1;for(let i of t){let o=Wke.exec(i);if(o){n=!0;for(let s of e)r.push(ys(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 pJ,Vke,wP,$P,Wke,_p=y(()=>{"use strict";pJ=St(er(),1);Pv();Vke=["type","lint","test","coverage"],wP={scope:"feature"},$P=["test-report.junit.xml",Hl("coverage","junit.xml"),Hl(".cladding","test-report.junit.xml")];Wke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as EP,readFileSync as yJ,readdirSync as Kke,statSync as Jke}from"node:fs";import{join as Cv}from"node:path";function OP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Cv(t,e);if(EP(r))try{if(_J.test(yJ(r,"utf8")))return!0}catch{}}return!1}function bJ(t){try{return EP(t)&&_J.test(yJ(t,"utf8"))}catch{return!1}}function vJ(t,e=0){if(e>4||!EP(t))return!1;let r;try{r=Kke(t)}catch{return!1}for(let n of r){let i=Cv(t,n),o=!1;try{o=Jke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(vJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&bJ(i))return!0}return!1}function Qke(t){if(OP(t))return!0;for(let e of Yke)if(bJ(Cv(t,e)))return!0;for(let e of Xke)if(vJ(Cv(t,e)))return!0;return!1}function SJ(t="."){let e=Gl(t).coverage;return e||(Qke(t)?"kover":"jacoco")}function wJ(t="."){return AP[SJ(t)]}function xJ(t="."){return kP[SJ(t)]}var AP,kP,TP,_J,Yke,Xke,Dv=y(()=>{"use strict";_p();AP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},kP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},TP=[kP.kover,kP.jacoco],_J=/kover/i;Yke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Xke=["buildSrc","build-logic"]});import{existsSync as vp,readFileSync as IP,readdirSync as kJ,statSync as eEe}from"node:fs";import{dirname as tEe,join as xr,resolve as rEe}from"node:path";import Zl from"node:process";function PP(t){return vp(xr(t,"gradlew"))?"./gradlew":"gradle"}function nEe(t){let e=PP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[wJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function iEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(IP(xr(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 sEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function lEe(t,e){for(let r of e)if(vp(xr(t,r)))return r}function uEe(t,e){try{return kJ(t).find(n=>n.endsWith(e))}catch{return}}function mEe(t){let e=[],r=Zl.platform==="win32";r||e.push(xr("/etc","madge","config"),xr("/etc","madgerc"));let n=r?Zl.env.USERPROFILE:Zl.env.HOME;n&&e.push(xr(n,".config","madge","config"),xr(n,".config","madge"),xr(n,".madge","config"),xr(n,".madgerc"));for(let o=rEe(t);;){e.push(xr(o,".madgerc"));let s=tEe(o);if(s===o)break;o=s}let i=Zl.env.MADGE_config??Zl.env.madge_config;return i&&e.push(i),e}function hEe(){for(let[t,e]of Object.entries(Zl.env))if(/^madge_excluderegexp/i.test(t)&&typeof e=="string"&&e.trim().length>0)return!0;return!1}function EJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function yEe(t){try{return eEe(t).isFile()}catch{return!1}}function _Ee(t){let e;try{e=IP(t,"utf8")}catch{return!0}try{return EJ(JSON.parse(e).excludeRegExp)}catch{return gEe.test(e)}}function bEe(t,e){let r=e.madge;return r&&typeof r=="object"&&EJ(r.excludeRegExp)||hEe()?!0:mEe(t).some(n=>yEe(n)&&_Ee(n))}function vEe(t){try{return JSON.parse(IP(xr(t,"package.json"),"utf8").replace(/^\uFEFF/,""))}catch{return{}}}function bp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function $J(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function SEe(t,e,r){if(bEe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",pEe),{...e,args:n}}function wEe(t,e,r){if(bp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of dEe)if(n.configs.some(i=>vp(xr(t,i))))return n.gate;if(fEe.some(n=>vp(xr(t,n)))||r.eslintConfig!==void 0)return e}function $Ee(t,e){return xEe.some(r=>vp(xr(t,r)))?!0:e.jest!==void 0}function kEe(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 RP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function EEe(t,e){let r=vEe(t),n=e.lint?wEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:SEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:RP(i,"lint"),s=bp(r,"test"),a=s?kEe(s):void 0;return s&&!a?(o=RP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...bp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&$Ee(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!bp(r,"coverage")&&!$J(r,"@vitest/coverage-v8")&&!$J(r,"@vitest/coverage-istanbul")?o=RP(o,"coverage"):a==="vitest"&&bp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function dt(t="."){for(let e of aEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=uEe(t,o):r=lEe(t,[o]),r)break;if(!r||e.requiresSource&&!sEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?EEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return cEe}var Fi,oEe,aEe,cEe,dEe,fEe,pEe,gEe,xEe,cn=y(()=>{"use strict";Dv();Fi=["--offline","--no-install"];oEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);aEe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Fi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Fi,"eslint","."]},test:{cmd:"npx",args:[...Fi,"vitest","run"]},coverage:{cmd:"npx",args:[...Fi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Fi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Fi,"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:nEe},{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:iEe}],cEe={language:"unknown",manifest:"",gates:{}};dEe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Fi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Fi,"oxlint"]}}],fEe=["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"],pEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";gEe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;xEe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as AEe,readFileSync as TEe}from"node:fs";import{join as OEe}from"node:path";function qa(t){return t.code==="ENOENT"}function Nv(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=[s,o].filter(c=>c.length>0).join(` +`).slice(0,2e3)||`exit ${i}`;return AJ.test(o)||AJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(qa(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.stdout??"").trim(),String(e.stderr??"").trim()].filter(i=>i.length>0).join(` +`);return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Vl(t,e){let r=OEe(t,"package.json");if(!AEe(r))return!1;try{return!!JSON.parse(TEe(r,"utf8")).scripts?.[e]}catch{return!1}}var AJ,Cn=y(()=>{"use strict";AJ=/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:jv,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 qa(i)?[{detector:jv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Nv(i,jv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var jv,Ba,Mv=y(()=>{"use strict";Lr();cn();Cn();jv="ARCHITECTURE_VIOLATION";Ba={name:jv,subprocess:!0,run:REe}});function IEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Fv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return qa(i)?[{detector:Fv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Nv(i,Fv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Fv,Ha,Lv=y(()=>{"use strict";Lr();cn();Cn();Fv="HARDCODED_SECRET";Ha={name:Fv,subprocess:!0,run:IEe}});import{existsSync as CP,readdirSync as TJ}from"node:fs";import{join as zv}from"node:path";function CEe(t,e){let r=zv(t,e.path);if(!CP(r))return!0;if(e.isDirectory)try{return TJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function DEe(t){let{cwd:e="."}=t,r=[];for(let i of PEe)CEe(e,i)&&r.push({detector:Sp,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=zv(e,"spec.yaml");if(CP(n)){let i=MEe(n),o=i?null:NEe(e);if(i)r.push({detector:Sp,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:Sp,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=jEe(e);s&&r.push({detector:Sp,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 NEe(t){for(let e of["spec/features","spec/scenarios"]){let r=zv(t,e);if(!CP(r))continue;let n;try{n=TJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ri(zv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function jEe(t){try{return q(t),null}catch(e){return e.message}}function MEe(t){let e;try{e=Ri(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Sp,PEe,OJ,RJ=y(()=>{"use strict";Ue();H_();Sp="ABSENCE_OF_GOVERNANCE",PEe=[{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}];OJ={name:Sp,run:DEe}});function Uv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function DP(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=Uv(r)==="while",o=LEe.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 '${Uv(r)}'`}let n=FEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Uv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Uv(r)}'`:null}function zEe(t,e){let r=DP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function IJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...zEe(r,n));return e}var FEe,LEe,NP=y(()=>{"use strict";FEe={event:"when",state:"while",optional:"where",unwanted:"if"},LEe=/\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 UEe(t){let{cwd:e="."}=t;return ge(e,qv,qEe)}function qEe(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:qv,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 IJ(t.features))e.push({detector:qv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var qv,PJ,CJ=y(()=>{"use strict";NP();wt();qv="AC_DRIFT";PJ={name:qv,run:UEe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return NJ[n]??DJ}var BEe,HEe,GEe,DJ,ZEe,VEe,NJ,WEe,jJ,Ga=y(()=>{"use strict";cn();BEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,HEe=/^[ \t]*import\s+([\w.]+)/gm,GEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,DJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:BEe,importStyle:"relative"},ZEe={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:HEe,importStyle:"dotted"},VEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:GEe,importStyle:"dotted"},NJ={typescript:DJ,kotlin:ZEe,python:VEe},WEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],jJ=new Set([...Object.values(NJ).flatMap(t=>t?.extensions??[]),...WEe].map(t=>t.toLowerCase()))});import{existsSync as KEe,readFileSync as JEe,readdirSync as YEe,statSync as XEe}from"node:fs";import{join as FJ,relative as MJ}from"node:path";function QEe(t,e){if(!KEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=YEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=FJ(i,s),c;try{c=XEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function eAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function rAe(t){return tAe.test(t)}function nAe(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=Li(e,r.project?.language),o=i.sourceRoots.flatMap(a=>QEe(FJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=JEe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Ue();Ga();LJ="AI_HINTS_FORBIDDEN_PATTERN";tAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;zJ={name:LJ,run:nAe}});function iAe(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:qJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var qJ,BJ,HJ=y(()=>{"use strict";Ue();qJ="AC_DUPLICATE_WITHIN_FEATURE";BJ={name:qJ,run:iAe}});import{createRequire as oAe}from"module";import{basename as sAe,dirname as MP,normalize as aAe,relative as cAe,resolve as lAe,sep as VJ}from"path";import*as uAe from"fs";function dAe(t){let e=aAe(t);return e.length>1&&e[e.length-1]===VJ&&(e=e.substring(0,e.length-1)),e}function WJ(t,e){return t.replace(fAe,e)}function mAe(t){return t==="/"||pAe.test(t)}function jP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=lAe(t)),(n||o)&&(t=dAe(t)),t===".")return"";let s=t[t.length-1]!==i;return WJ(s?t+i:t,i)}function KJ(t,e){return e+t}function hAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:WJ(cAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function gAe(t){return t}function yAe(t,e,r){return e+t+r}function _Ae(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?hAe(t,e):n?KJ:gAe}function bAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function vAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function $Ae(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?vAe(t):bAe(t):n&&n.length?wAe:SAe:xAe}function RAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?OAe:r&&r.length?n?kAe:EAe:n?AAe:TAe}function CAe(t){return t.group?PAe:IAe}function jAe(t){return t.group?DAe:NAe}function LAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?FAe:MAe}function JJ(t,e,r){if(r.options.useRealPaths)return zAe(e,r);let n=MP(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=MP(n)}return r.symlinks.set(t,e),i>1}function zAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Bv(t,e,r,n){e(t&&!n?t:null,r)}function KAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?UAe:GAe:n?e?qAe:WAe:i?e?HAe:VAe:e?BAe:ZAe}function XAe(t){return t?YAe:JAe}function rTe(t,e){return new Promise((r,n)=>{QJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function QJ(t,e,r){new XJ(t,e,r).start()}function nTe(t,e){return new XJ(t,e).start()}var GJ,fAe,pAe,SAe,wAe,xAe,kAe,EAe,AAe,TAe,OAe,IAe,PAe,DAe,NAe,MAe,FAe,UAe,qAe,BAe,HAe,GAe,ZAe,VAe,WAe,YJ,JAe,YAe,QAe,eTe,tTe,XJ,ZJ,e8,t8,r8=y(()=>{GJ=oAe(import.meta.url);fAe=/[\\/]/g;pAe=/^[a-z]:[\\/]$/i;SAe=(t,e)=>{e.push(t||".")},wAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},xAe=()=>{};kAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},EAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},AAe=(t,e,r,n)=>{r.files++},TAe=(t,e)=>{e.push(t)},OAe=()=>{};IAe=t=>t,PAe=()=>[""].slice(0,0);DAe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},NAe=()=>{};MAe=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()&&JJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},FAe=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()&&JJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};UAe=t=>t.counts,qAe=t=>t.groups,BAe=t=>t.paths,HAe=t=>t.paths.slice(0,t.options.maxFiles),GAe=(t,e,r)=>(Bv(e,r,t.counts,t.options.suppressErrors),null),ZAe=(t,e,r)=>(Bv(e,r,t.paths,t.options.suppressErrors),null),VAe=(t,e,r)=>(Bv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),WAe=(t,e,r)=>(Bv(e,r,t.groups,t.options.suppressErrors),null);YJ={withFileTypes:!0},JAe=(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||".",YJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},YAe=(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||".",YJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};QAe=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))}},eTe=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}},tTe=class{aborted=!1;abort(){this.aborted=!0}},XJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=KAe(e,this.isSynchronous),this.root=jP(t,e),this.state={root:mAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new eTe,options:e,queue:new QAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new tTe,fs:e.fs||uAe},this.joinPath=_Ae(this.root,e),this.pushDirectory=$Ae(this.root,e),this.pushFile=RAe(e),this.getArray=CAe(e),this.groupFiles=jAe(e),this.resolveSymlink=LAe(e,this.isSynchronous),this.walkDirectory=XAe(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(_=jP(_,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=sAe(_),x=jP(MP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};ZJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return rTe(this.root,this.options)}withCallback(t){QJ(this.root,this.options,t)}sync(){return nTe(this.root,this.options)}},e8=null;try{GJ.resolve("picomatch"),e8=GJ("picomatch")}catch{}t8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:VJ,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 ZJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new ZJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||e8;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 wp=v((Fdt,a8)=>{"use strict";var n8="[^\\\\/]",iTe="(?=.)",i8="[^/]",FP="(?:\\/|$)",o8="(?:^|\\/)",LP=`\\.{1,2}${FP}`,oTe="(?!\\.)",sTe=`(?!${o8}${LP})`,aTe=`(?!\\.{0,1}${FP})`,cTe=`(?!${LP})`,lTe="[^.\\/]",uTe=`${i8}*?`,dTe="/",s8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:iTe,QMARK:i8,END_ANCHOR:FP,DOTS_SLASH:LP,NO_DOT:oTe,NO_DOTS:sTe,NO_DOT_SLASH:aTe,NO_DOTS_SLASH:cTe,QMARK_NO_DOT:lTe,STAR:uTe,START_ANCHOR:o8,SEP:dTe},fTe={...s8,SLASH_LITERAL:"[\\\\/]",QMARK:n8,STAR:`${n8}*?`,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:"\\"},pTe={__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"};a8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pTe,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?fTe:s8}}});var xp=v(zr=>{"use strict";var{REGEX_BACKSLASH:mTe,REGEX_REMOVE_BACKSLASH:hTe,REGEX_SPECIAL_CHARS:gTe,REGEX_SPECIAL_CHARS_GLOBAL:yTe}=wp();zr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);zr.hasRegexChars=t=>gTe.test(t);zr.isRegexChar=t=>t.length===1&&zr.hasRegexChars(t);zr.escapeRegex=t=>t.replace(yTe,"\\$1");zr.toPosixSlashes=t=>t.replace(mTe,"/");zr.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};zr.removeBackslashes=t=>t.replace(hTe,e=>e==="\\"?"":e);zr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?zr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};zr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};zr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};zr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var h8=v((zdt,m8)=>{"use strict";var c8=xp(),{CHAR_ASTERISK:zP,CHAR_AT:_Te,CHAR_BACKWARD_SLASH:$p,CHAR_COMMA:bTe,CHAR_DOT:UP,CHAR_EXCLAMATION_MARK:qP,CHAR_FORWARD_SLASH:p8,CHAR_LEFT_CURLY_BRACE:BP,CHAR_LEFT_PARENTHESES:HP,CHAR_LEFT_SQUARE_BRACKET:vTe,CHAR_PLUS:STe,CHAR_QUESTION_MARK:l8,CHAR_RIGHT_CURLY_BRACE:wTe,CHAR_RIGHT_PARENTHESES:u8,CHAR_RIGHT_SQUARE_BRACKET:xTe}=wp(),d8=t=>t===p8||t===$p,f8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$Te=(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&&d8(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=c8.removeBackslashes(P)),xe&&_===!0&&(xe=c8.removeBackslashes(xe)));let Cr={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&&(Cr.maxDepth=0,d8(A)||s.push(D),Cr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var kp=wp(),ln=xp(),{MAX_LENGTH:Hv,POSIX_REGEX_SOURCE:kTe,REGEX_NON_SPECIAL_CHARS:ETe,REGEX_SPECIAL_CHARS_BACKREF:ATe,REPLACEMENTS:g8}=kp,TTe=(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=>ln.escapeRegex(i)).join("..")}return r},Wl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,y8=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},OTe=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},_8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(OTe(e))return e.replace(/\\(.)/g,"$1")},RTe=t=>{let e=t.map(_8).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}}}}},ITe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=_8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?ln.escapeRegex(r[0]):`[${r.map(i=>ln.escapeRegex(i)).join("")}]`}*`},PTe=t=>{let e=0,r=t.trim(),n=GP(r);for(;n;)e++,r=n.body.trim(),n=GP(r);return e},CTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:kp.DEFAULT_MAX_EXTGLOB_RECURSION,n=y8(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=ITe(i);if(o)return{risky:!0,safeOutput:o};if(PTe(i)>r)return{risky:!0}}return{risky:!1}},ZP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=g8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Hv,r.maxLength):Hv,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=kp.globChars(r.windows),l=kp.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=G=>`(${a}(?:(?!${w}${G.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=ln.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Cr=()=>$.index===i-1,se=$.peek=(G=1)=>t[$.index+G],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(G="",ht=0)=>{$.consumed+=G,$.index+=ht},Xt=G=>{$.output+=G.output!=null?G.output:G.value,dr(G.value)},uo=()=>{let G=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,G++;return G%2===0?!1:($.negated=!0,$.start++,!0)},ki=G=>{$[G]++,xe.push(G)},en=G=>{$[G]--,xe.pop()},de=G=>{if(C.type==="globstar"){let ht=$.braces>0&&(G.type==="comma"||G.type==="brace"),H=G.extglob===!0||re.length&&(G.type==="pipe"||G.type==="paren");G.type!=="slash"&&G.type!=="paren"&&!ht&&!H&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(re.length&&G.type!=="paren"&&(re[re.length-1].inner+=G.value),(G.value||G.output)&&Xt(G),C&&C.type==="text"&&G.type==="text"){C.output=(C.output||C.value)+G.value,C.value+=G.value;return}G.prev=C,s.push(G),C=G},fo=(G,ht)=>{let H={...l[ht],conditions:1,inner:""};H.prev=C,H.parens=$.parens,H.output=$.output,H.startIndex=$.index,H.tokensIndex=s.length;let Oe=(r.capture?"(":"")+H.open;ki("parens"),de({type:G,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),re.push(H)},Jde=G=>{let ht=t.slice(G.startIndex,$.index+1),H=t.slice(G.startIndex+2,$.index),Oe=CTe(H,r);if((G.type==="plus"||G.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(G.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,Ei=s[G.tokensIndex];Ei.type="text",Ei.value=ht,Ei.output=lt||ln.escapeRegex(ht);for(let Ai=G.tokensIndex+1;Ai1&&G.inner.includes("/")&&(lt=O(r)),(lt!==D||Cr()||/^\)+$/.test(Kt()))&&(ut=G.close=`)$))${lt}`),G.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let Ei=ZP(zt,{...e,fastpaths:!1}).output;ut=G.close=`)${Ei})${lt})`}G.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),en("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let G=!1,ht=t.replace(ATe,(H,Oe,ut,zt,lt,Ei)=>zt==="\\"?(G=!0,H):zt==="?"?Oe?Oe+zt+(lt?_.repeat(lt.length):""):Ei===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):zt==="."?u.repeat(ut.length):zt==="*"?Oe?Oe+zt+(lt?D:""):D:Oe?H:`\\${H}`);return G===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,H=>H.length%2===0?"\\\\":H?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=ln.wrapOutput(ht,$,e),$)}for(;!Cr();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let H=se();if(H==="/"&&r.bash!==!0||H==="."||H===";")continue;if(!H){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 H=C.value.slice(1);if(H.includes("[")&&(C.posix=!0,H.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),zt=C.value.slice(Oe+2),lt=kTe[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=ln.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==="("){ki("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Wl("opening","("));let H=re[re.length-1];if(H&&$.parens===H.parens+1){Jde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),en("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Wl("closing","]"));P=`\\${P}`}else ki("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(Wl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}en("brackets");let H=C.value.slice(1);if(C.posix!==!0&&H[0]==="^"&&!H.includes("/")&&(P=`/${P}`),C.value+=P,Xt({value:P}),r.literalBrackets===!1||ln.hasRegexChars(H))continue;let Oe=ln.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){ki("braces");let H={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(H),de(H);continue}if(P==="}"){let H=K[K.length-1];if(r.nobrace===!0||!H){de({type:"text",value:P,output:P});continue}let Oe=")";if(H.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=TTe(zt,r),$.backtrack=!0}if(H.comma!==!0&&H.dots!==!0){let ut=$.output.slice(0,H.outputIndex),zt=$.tokens.slice(H.tokensIndex);H.value=H.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of zt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),en("braces"),K.pop();continue}if(P==="|"){re.length>0&&re[re.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let H=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,H="|"),de({type:"comma",value:P,output:H});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 H=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,H.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)!=="?"){fo("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)))){fo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){uo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fo("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 H=ETe.exec(Kt());H&&(P+=H[0],$.index+=H[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 G=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(G)){fo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let H=C.prev,Oe=H.prev,ut=H.type==="slash"||H.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||G[0]&&G[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(H.type==="comma"||H.type==="brace"),Ei=re.length&&(H.type==="pipe"||H.type==="paren");if(!ut&&H.type!=="paren"&&!lt&&!Ei){de({type:"star",value:P,output:""});continue}for(;G.slice(0,3)==="/**";){let Ai=t[$.index+4];if(Ai&&Ai!=="/")break;G=G.slice(3),dr("/**",3)}if(H.type==="bos"&&Cr()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&!zt&&Cr()){$.output=$.output.slice(0,-(H.output+C.output).length),H.output=`(?:${H.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=H.output+C.output,dr(P);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&G[0]==="/"){let Ai=G[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(H.output+C.output).length),H.output=`(?:${H.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${Ai})`,C.value+=P,$.output+=H.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(H.type==="bos"&&G[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(Wl("closing","]"));$.output=ln.escapeLast($.output,"["),en("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing",")"));$.output=ln.escapeLast($.output,"("),en("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing","}"));$.output=ln.escapeLast($.output,"{"),en("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let G of $.tokens)$.output+=G.output!=null?G.output:G.value,G.suffix&&($.output+=G.suffix)}return $};ZP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Hv,r.maxLength):Hv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=g8[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}=kp.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=ln.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};b8.exports=ZP});var x8=v((qdt,w8)=>{"use strict";var DTe=h8(),VP=v8(),S8=xp(),NTe=wp(),jTe=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=jTe(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?S8.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(S8.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)):VP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>DTe(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=VP.fastpaths(t,e)),i.output||(i=VP(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=NTe;w8.exports=Rt});var A8=v((Bdt,E8)=>{"use strict";var $8=x8(),MTe=xp();function k8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:MTe.isWindows()}),$8(t,e,r)}Object.assign(k8,$8);E8.exports=k8});import{readdir as FTe,readdirSync as LTe,realpath as zTe,realpathSync as UTe,stat as qTe,statSync as BTe}from"fs";import{isAbsolute as HTe,posix as Za,resolve as GTe}from"path";import{fileURLToPath as ZTe}from"url";function KTe(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]===".."&&WTe.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=>Za.relative(t,n)||".":n=>Za.relative(t,`${e}/${n}`)||"."}function XTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Za.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function I8(t){var e;let r=Kl.default.scan(t,QTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function oOe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Kl.default.scan(t);return r.isGlob||r.negated}function Ep(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function P8(t){return typeof t=="string"?[t]:t??[]}function WP(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=iOe(o);s=HTe(s.replace(aOe,""))?Za.relative(a,s):Za.normalize(s);let c=(i=sOe.exec(s))===null||i===void 0?void 0:i[0],l=I8(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?Za.join(o,...d):o}return s}function cOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(WP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(WP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(WP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function lOe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=cOe(t,e,n);t.debug&&Ep("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(O8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Kl.default)(i.match,f),m=(0,Kl.default)(i.ignore,f),h=KTe(i.match,f),g=T8(r,d,o),b=o?g:T8(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 t8({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&Ep(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return Ep(`${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&&Ep("internal properties:",{...n,root:d}),[x,r!==d&&!o&&XTe(r,d)]}function uOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function fOe(t){let e={...dOe,...t};return e.cwd=(e.cwd instanceof URL?ZTe(e.cwd):GTe(e.cwd)).replace(O8,"/"),e.ignore=P8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||FTe,readdirSync:e.fs.readdirSync||LTe,realpath:e.fs.realpath||zTe,realpathSync:e.fs.realpathSync||UTe,stat:e.fs.stat||qTe,statSync:e.fs.statSync||BTe}),e.debug&&Ep("globbing with options:",e),e}function pOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=VTe(t)||typeof t=="string",i=P8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=fOe(n?e:t);return i.length>0?lOe(o,i):[]}function _s(t,e){let[r,n]=pOe(t,e);return r?uOe(r.sync(),n):[]}var Kl,VTe,O8,R8,WTe,JTe,YTe,QTe,eOe,tOe,rOe,nOe,iOe,sOe,aOe,dOe,Ap=y(()=>{r8();Kl=St(A8(),1),VTe=Array.isArray,O8=/\\/g,R8=process.platform==="win32",WTe=/^(\/?\.\.)+$/;JTe=/^[A-Z]:\/$/i,YTe=R8?t=>JTe.test(t):t=>t==="/";QTe={parts:!0};eOe=/(?t.replace(eOe,"\\$&"),nOe=t=>t.replace(tOe,"\\$&"),iOe=R8?nOe:rOe;sOe=/^(\/?\.\.)+/,aOe=/\\(?=[()[\]{}!*+?@|])/g;dOe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Tp,readFileSync as mOe,readdirSync as hOe,statSync as C8}from"node:fs";import{join as Va}from"node:path";function gOe(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=Li(e,n),o=[],{layers:s,forbiddenImports:a}=KP(r);return(s.size>0||a.length>0)&&!Tp(Va(e,i.mainRoot))?[{detector:Op,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&&(yOe(e,i,s,o),_Oe(e,i,s,o)),a.length>0&&bOe(e,i,a,o),o)}function KP(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 yOe(t,e,r,n){let i=e.mainRoot,o=Va(t,i);if(Tp(o))for(let s of hOe(o)){let a=Va(o,s);C8(a).isDirectory()&&(r.has(s)||n.push({detector:Op,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function _Oe(t,e,r,n){let i=e.mainRoot,o=Va(t,i);if(Tp(o))for(let s of r){let a=Va(o,s);Tp(a)&&C8(a).isDirectory()||n.push({detector:Op,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 bOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Va(t,i,s.from);if(!Tp(a))continue;let c=_s([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Va(a,l),d;try{d=mOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];vOe(p,s.to,e.importStyle)&&n.push({detector:Op,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 vOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Op,D8,JP=y(()=>{"use strict";Ap();Ue();Ga();Op="ARCHITECTURE_FROM_SPEC";D8={name:Op,run:gOe}});import{existsSync as SOe,readFileSync as wOe}from"node:fs";import{join as xOe}from"node:path";function kOe(t){let{cwd:e="."}=t,r=xOe(e,"spec/capabilities.yaml");if(!SOe(r))return[];let n;try{let u=wOe(r,"utf8"),d=N8.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<$Oe;for(let u of i){if(typeof u!="object"||u===null)continue;let d=String(u.id??"(unnamed)"),f=Array.isArray(u.features)?u.features:[];if(f.length===0){a.push({detector:Gv,severity:l?"info":"warn",path:"spec/capabilities.yaml",message:l?`capability "${d}" has no features mapped yet \u2014 retained as future onboarding intent; bind it when a matching feature lands`:`capability "${d}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let p of f){let m=String(p);o.has(m)?c.add(m):a.push({detector:Gv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${d}" references feature ${m} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let u of o)c.has(u)||a.push({detector:Gv,severity:"info",path:"spec.yaml",message:`feature ${u} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return a}var N8,Gv,$Oe,j8,M8=y(()=>{"use strict";N8=St(er(),1);Ue();Gv="CAPABILITIES_FEATURE_MAPPING",$Oe=8;j8={name:Gv,run:kOe}});import{existsSync as EOe,readFileSync as AOe}from"node:fs";import{join as TOe}from"node:path";function OOe(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,YP,r=>IOe(r,e))}function IOe(t,e){let r=Li(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=TOe(e,o);if(!EOe(s))continue;let a=AOe(s,"utf8");OOe(a)||n.push({detector:YP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var YP,F8,L8=y(()=>{"use strict";Ga();wt();YP="CONVENTION_DRIFT";F8={name:YP,run:ROe}});import{existsSync as XP,readFileSync as z8}from"node:fs";import{join as Zv}from"node:path";function POe(t){return JSON.parse(t).total?.lines?.pct??0}function U8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function NOe(t,e){if(!Rv(dt(t).gates.coverage?.cmd))return null;let r;try{r=Iv(t,e)}catch(c){return[{detector:ko,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=TP.find(d=>XP(Zv(c.dir,d)));if(!l){s.push(c.path);continue}let u=U8(z8(Zv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:ko,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=q8(n,i);return a0?[{detector:ko,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function jOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=NOe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=dt(e).language==="kotlin"?TP.find(a=>XP(Zv(e,a)))??xJ(e):n.coverageSummary,o=Zv(e,i);if(!XP(o))return[{detector:ko,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=z8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?COe(a):n.coverageFormat==="cobertura-xml"?DOe(a):POe(a)}catch(a){return[{detector:ko,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:ko,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Vv?[]:[{detector:ko,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Vv}%`}]}var ko,Vv,B8,H8=y(()=>{"use strict";Ue();Dv();Ga();Pv();cn();ko="COVERAGE_DROP",Vv=70;B8={name:ko,run:jOe}});import{existsSync as MOe}from"node:fs";import{join as FOe}from"node:path";function zOe(t){let{cwd:e="."}=t;return ge(e,Wv,r=>UOe(r,e))}function UOe(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();Wv="DELIVERABLE_INTEGRITY",LOe=8;G8={name:Wv,run:zOe}});function qOe(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:Kv,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 BOe(t){let e=qOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Kv,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 HOe(t){let{cwd:e="."}=t;return ge(e,Kv,r=>BOe(r))}var Kv,V8,W8=y(()=>{"use strict";wt();Kv="SMOKE_PROBE_DEMAND";V8={name:Kv,run:HOe}});function GOe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>ZOe(r,e))}function ZOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ls(e);if(n===null)return[{detector:Jv,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=J_(n,e,o);s.state!=="fresh"&&i.push({detector:Jv,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 Jv,Yv,QP=y(()=>{"use strict";xl();wt();Jv="STALE_ATTESTATION";Yv={name:Jv,run:GOe}});function VOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return WOe(r)}function WOe(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:K8,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 K8,Xv,eC=y(()=>{"use strict";Ue();K8="DEPENDENCY_CYCLE";Xv={name:K8,run:VOe}});import{appendFileSync as KOe,existsSync as J8,mkdirSync as JOe,readFileSync as YOe}from"node:fs";import{dirname as XOe,join as QOe}from"node:path";function Y8(t){return QOe(t,eRe,tRe)}function X8(t){return tC.add(t),()=>tC.delete(t)}function Wa(t,e){let r=Y8(t),n=XOe(r);J8(n)||JOe(n,{recursive:!0}),KOe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of tC)try{i(t,e)}catch{}}function fr(t){let e=Y8(t);if(!J8(e))return[];let r=YOe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var eRe,tRe,tC,un=y(()=>{"use strict";eRe=".cladding",tRe="audit.log.jsonl";tC=new Set});import{existsSync as rRe}from"node:fs";import{join as nRe}from"node:path";function iRe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:rC,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&&(rRe(nRe(e,i.artifact))||n.push({detector:rC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var rC,Q8,e5=y(()=>{"use strict";un();rC="EVIDENCE_MISMATCH";Q8={name:rC,run:iRe}});import{existsSync as oRe,readFileSync as sRe}from"node:fs";import{join as aRe}from"node:path";function cRe(t){let e=aRe(t,i5);if(!oRe(e))return null;try{let n=((0,n5.parse)(sRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*r5(t,e){for(let r of t??[])r.startsWith(t5)&&(yield{ref:r,name:r.slice(t5.length),field:e})}function lRe(t){let{cwd:e="."}=t,r=cRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:nC,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=[...r5(s.evidence_refs,"evidence_refs"),...r5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:nC,severity:"warn",path:i5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var n5,nC,t5,i5,o5,s5=y(()=>{"use strict";n5=St(er(),1);Ue();nC="FIXTURE_REFERENCE_INVALID",t5="fixture:",i5="conformance/fixtures.yaml";o5={name:nC,run:lRe}});import{existsSync as Jl,readFileSync as iC}from"node:fs";import{join as Ka}from"node:path";function uRe(t){return _s(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Rp(t){if(!Jl(t))return null;try{return JSON.parse(iC(t,"utf8"))}catch{return null}}function dRe(t,e){let r=Ka(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(iC(r,"utf8"))}catch(c){e.push({detector:Eo,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:Eo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=uRe(t);s!==a&&e.push({detector:Eo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function fRe(t,e){for(let r of a5){let n=Ka(t,r.path);if(!Jl(n))continue;let i=Rp(n);if(!i){e.push({detector:Eo,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:Eo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function pRe(t,e){let r=Rp(Ka(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of a5){let s=Ka(t,o.path);if(!Jl(s))continue;let a=Rp(s);a?.version&&a.version!==n&&e.push({detector:Eo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ka(t,".claude-plugin","marketplace.json");if(Jl(i)){let o=Rp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Eo,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function mRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function hRe(t,e){let r=Ka(t,"src","cli","clad.ts"),n=Ka(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Jl(r)||!Jl(n))return;let i=mRe(iC(r,"utf8"));if(i.length===0)return;let s=Rp(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:Eo,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function gRe(t){let{cwd:e="."}=t,r=[];return dRe(e,r),hRe(e,r),fRe(e,r),pRe(e,r),r}var Eo,a5,c5,l5=y(()=>{"use strict";Ap();Eo="HARNESS_INTEGRITY",a5=[{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"]}];c5={name:Eo,run:gRe}});import{existsSync as yRe,readFileSync as _Re}from"node:fs";import{join as bRe}from"node:path";function SRe(t){let{cwd:e="."}=t;return ge(e,Qv,r=>xRe(r,e))}function wRe(t){let e=bRe(t,"spec/capabilities.yaml");if(!yRe(e))return!1;try{let r=u5.default.parse(_Re(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function xRe(t,e){let r=t.features.length;if(r{"use strict";u5=St(er(),1);wt();Qv="HOLLOW_GOVERNANCE",vRe=8;d5={name:Qv,run:SRe}});import{existsSync as p5,readFileSync as m5}from"node:fs";import{join as h5}from"node:path";function g5(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 ERe(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 ARe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function TRe(t){let e=h5(t,"README.md"),r=h5(t,"docs","dogfood","matrix.md");if(!p5(e)||!p5(r))return[];let n=g5(m5(e,"utf8"),$Re),i=g5(m5(r,"utf8"),kRe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=ARe(a);if(c===null)continue;let l=i[s]??"not-run",u=ERe(l);u!==null&&c>u&&o.push({detector:y5,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 ORe(t){let{cwd:e="."}=t;return TRe(e)}var y5,$Re,kRe,_5,b5=y(()=>{"use strict";y5="HOST_CLAIM_DRIFT",$Re=//,kRe=//;_5={name:y5,run:ORe}});function RRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return v5(r.features.map(i=>i.id),"feature","spec/features/",n),v5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function v5(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:S5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var S5,w5,x5=y(()=>{"use strict";Ue();S5="ID_COLLISION";w5={name:S5,run:RRe}});import{existsSync as Ip,readFileSync as oC,readdirSync as sC,statSync as IRe,writeFileSync as k5}from"node:fs";import{join as Ao}from"node:path";function $5(t){if(!Ip(t))return 0;try{return sC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function PRe(t){if(!Ip(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=sC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Ao(n,o),a;try{a=IRe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function CRe(t){let e=Ao(t,"spec","capabilities.yaml");if(!Ip(e))return 0;try{let r=eS.default.parse(oC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function bs(t="."){let e=$5(Ao(t,"spec","features")),r=$5(Ao(t,"spec","scenarios")),n=CRe(t),i=PRe(Ao(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Yl(t,e){let r=Ao(t,"spec.yaml");if(!Ip(r))return;let n=oC(r,"utf8"),i=DRe(n,e);i!==n&&k5(r,i)}function DRe(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 +273,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=Eo(t,"spec","features");if(!kp(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(` +`))}function Ja(t="."){let e=Ao(t,"spec","features");if(!Ip(e))return!1;let r=[];for(let i of sC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,eS.parse)(oC(Ao(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 m5(Eo(t,"spec","index.yaml"),n,"utf8"),!0}var Wv,Ep=y(()=>{"use strict";Wv=St(er(),1)});import{existsSync as h5,readFileSync as g5,readdirSync as uRe}from"node:fs";import{join as tC}from"node:path";function dRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=_s(e),i=r.inventory;if(!i){let s=y5.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:Ap,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 y5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Ap,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(!h5(e)||!h5(r))return[];let n=new Map;try{for(let l of g5(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 uRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=g5(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:Ap,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:Ap,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 Ap,y5,_5,b5=y(()=>{"use strict";Ep();Ue();Ap="INVENTORY_DRIFT",y5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];_5={name:Ap,run:dRe}});import{existsSync as fRe,readFileSync as pRe}from"node:fs";import{join as mRe}from"node:path";function gRe(t){let{cwd:e="."}=t,r=mRe(e,"src","spec","schema.json"),n=[];if(fRe(r)){let i;try{i=JSON.parse(pRe(r,"utf8"))}catch(o){n.push({detector:Tp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of hRe)i.required?.includes(o)||n.push({detector:Tp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Tp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==v5&&n.push({detector:Tp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${v5}'`})}catch{}return n}var Tp,hRe,v5,S5,w5=y(()=>{"use strict";Ue();Tp="META_INTEGRITY",hRe=["schema","project","features"],v5="0.1";S5={name:Tp,run:gRe}});function yRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return x5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),x5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function x5(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:$5,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 $5,k5,E5=y(()=>{"use strict";Ue();$5="SLUG_CONFLICT";k5={name:$5,run:yRe}});function Wl(t){return t==="planned"||t==="in_progress"}var Kv=y(()=>{"use strict"});import{existsSync as _Re}from"node:fs";import{join as bRe}from"node:path";function vRe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>SRe(r,e))}function SRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=bRe(e,i);_Re(o)||r.push(wRe(n.id,i,n.status))}return r}function wRe(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:vRe}});function xRe(t){let{cwd:e="."}=t;return ge(e,iC,$Re)}function $Re(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:xRe}});import{existsSync as kRe,readFileSync as ERe}from"node:fs";import{join as A5}from"node:path";function T5(t){if(kRe(t))try{return JSON.parse(ERe(t,"utf8"))}catch{return}}function RRe(t){let{cwd:e="."}=t,r=T5(A5(e,ARe)),n=T5(A5(e,TRe));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>ORe&&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,ARe,TRe,ORe,O5,R5=y(()=>{"use strict";sC="PERFORMANCE_DRIFT",ARe="perf/baseline.json",TRe="perf/current.json",ORe=10;O5={name:sC,run:RRe}});import{existsSync as IRe}from"node:fs";import{join as PRe}from"node:path";function DRe(t){let{cwd:e="."}=t;return ge(e,aC,r=>jRe(r,e))}function NRe(t,e){return(t.modules??[]).some(r=>IRe(PRe(e,r)))}function jRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||NRe(s,e)||r.push(s.id);let n=CRe;if(r.length<=n)return[];let i=r.slice(0,I5).join(", "),o=r.length>I5?", \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,CRe,I5,P5,C5=y(()=>{"use strict";wt();aC="PLANNED_BACKLOG",CRe=5,I5=8;P5={name:aC,run:DRe}});import{existsSync as MRe,readFileSync as FRe}from"node:fs";import{join as LRe}from"node:path";function qRe(t){let{cwd:e="."}=t;return ge(e,cC,r=>BRe(r,e))}function BRe(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,zRe,URe,D5,N5=y(()=>{"use strict";wt();cC="PROJECT_CONTEXT_DRIFT",zRe=8,URe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];D5={name:cC,run:qRe}});function j5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Qv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function HRe(t){let{cwd:e="."}=t;return ge(e,Qv,GRe)}function GRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...j5(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(...j5(e,n.features,`scenario ${n.id}.features`));return r}var Qv,eS,lC=y(()=>{"use strict";wt();Qv="REFERENCE_INTEGRITY";eS={name:Qv,run:HRe}});function Op(t=""){return new RegExp(ZRe,t)}var ZRe,uC=y(()=>{"use strict";ZRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as VRe,readdirSync as WRe,readFileSync as KRe,statSync as JRe,writeFileSync as YRe}from"node:fs";import{dirname as XRe,join as Rp,normalize as QRe,relative as eIe}from"node:path";function oIe(t){let e=[];for(let r of t.matchAll(iIe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Op("g"))??[])e.push(n);return[...new Set(e)].sort()}function sIe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function M5(t){return t.split("\\").join("/")}function aIe(t){return tIe.some(e=>t===e||t.startsWith(`${e}/`))}function cIe(t){let e=Rp(t,"docs");if(!VRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=WRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Rp(i,s),c;try{c=JRe(a)}catch{continue}let l=M5(eIe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function lIe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=QRe(Rp(XRe(t),e));return M5(r)}function Ip(t="."){let e=[];for(let r of cIe(t)){let n;try{n=KRe(Rp(t,r),"utf8")}catch{continue}let i=sIe(n),o=oIe(i);if(aIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(rIe)?[]:i.match(Op("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(nIe)){let d=lIe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function F5(t="."){let e=Ip(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 YRe(Rp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return k5(Ao(t,"spec","index.yaml"),n,"utf8"),!0}var eS,Pp=y(()=>{"use strict";eS=St(er(),1)});import{existsSync as E5,readFileSync as A5,readdirSync as NRe}from"node:fs";import{join as aC}from"node:path";function jRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=bs(e),i=r.inventory;if(!i){let s=T5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return cC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...cC(e),{detector:Cp,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 T5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Cp,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(...cC(e)),o}function cC(t){let e=aC(t,"spec","index.yaml"),r=aC(t,"spec","features");if(!E5(e)||!E5(r))return[];let n=new Map;try{for(let l of A5(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 NRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=A5(aC(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:Cp,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:Cp,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 Cp,T5,O5,R5=y(()=>{"use strict";Pp();Ue();Cp="INVENTORY_DRIFT",T5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];O5={name:Cp,run:jRe}});import{existsSync as MRe,readFileSync as FRe}from"node:fs";import{join as LRe}from"node:path";function URe(t){let{cwd:e="."}=t,r=LRe(e,"src","spec","schema.json"),n=[];if(MRe(r)){let i;try{i=JSON.parse(FRe(r,"utf8"))}catch(o){n.push({detector:Dp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of zRe)i.required?.includes(o)||n.push({detector:Dp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Dp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==I5&&n.push({detector:Dp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${I5}'`})}catch{}return n}var Dp,zRe,I5,P5,C5=y(()=>{"use strict";Ue();Dp="META_INTEGRITY",zRe=["schema","project","features"],I5="0.1";P5={name:Dp,run:URe}});function qRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return D5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),D5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function D5(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:N5,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 N5,j5,M5=y(()=>{"use strict";Ue();N5="SLUG_CONFLICT";j5={name:N5,run:qRe}});function Xl(t){return t==="planned"||t==="in_progress"}var tS=y(()=>{"use strict"});import{existsSync as BRe}from"node:fs";import{join as HRe}from"node:path";function GRe(t){let{cwd:e="."}=t;return ge(e,rS,r=>ZRe(r,e))}function ZRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=HRe(e,i);BRe(o)||r.push(VRe(n.id,i,n.status))}return r}function VRe(t,e,r){return Xl(r)?{detector:rS,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:rS,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var rS,nS,lC=y(()=>{"use strict";tS();wt();rS="MISSING_IMPLEMENTATION";nS={name:rS,run:GRe}});function WRe(t){let{cwd:e="."}=t;return ge(e,uC,KRe)}function KRe(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:uC,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 uC,iS,dC=y(()=>{"use strict";wt();uC="MISSING_TESTS";iS={name:uC,run:WRe}});import{existsSync as JRe,readFileSync as YRe}from"node:fs";import{join as F5}from"node:path";function L5(t){if(JRe(t))try{return JSON.parse(YRe(t,"utf8"))}catch{return}}function tIe(t){let{cwd:e="."}=t,r=L5(F5(e,XRe)),n=L5(F5(e,QRe));if(!r||!n)return[{detector:fC,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>eIe&&i.push({detector:fC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var fC,XRe,QRe,eIe,z5,U5=y(()=>{"use strict";fC="PERFORMANCE_DRIFT",XRe="perf/baseline.json",QRe="perf/current.json",eIe=10;z5={name:fC,run:tIe}});import{existsSync as rIe}from"node:fs";import{join as nIe}from"node:path";function oIe(t){let{cwd:e="."}=t;return ge(e,pC,r=>aIe(r,e))}function sIe(t,e){return(t.modules??[]).some(r=>rIe(nIe(e,r)))}function aIe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||sIe(s,e)||r.push(s.id);let n=iIe;if(r.length<=n)return[];let i=r.slice(0,q5).join(", "),o=r.length>q5?", \u2026":"";return[{detector:pC,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 pC,iIe,q5,B5,H5=y(()=>{"use strict";wt();pC="PLANNED_BACKLOG",iIe=5,q5=8;B5={name:pC,run:oIe}});import{existsSync as cIe,readFileSync as lIe}from"node:fs";import{join as uIe}from"node:path";function pIe(t){let{cwd:e="."}=t;return ge(e,mC,r=>mIe(r,e))}function mIe(t,e){if(t.features.lengthn.includes(i))?[{detector:mC,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 mC,dIe,fIe,G5,Z5=y(()=>{"use strict";wt();mC="PROJECT_CONTEXT_DRIFT",dIe=8,fIe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];G5={name:mC,run:pIe}});function V5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:oS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function hIe(t){let{cwd:e="."}=t;return ge(e,oS,gIe)}function gIe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...V5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:oS,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...V5(e,n.features,`scenario ${n.id}.features`));return r}var oS,sS,hC=y(()=>{"use strict";wt();oS="REFERENCE_INTEGRITY";sS={name:oS,run:hIe}});function Np(t=""){return new RegExp(yIe,t)}var yIe,gC=y(()=>{"use strict";yIe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as _Ie,readdirSync as bIe,readFileSync as vIe,statSync as SIe,writeFileSync as wIe}from"node:fs";import{dirname as xIe,join as jp,normalize as $Ie,relative as kIe}from"node:path";function RIe(t){let e=[];for(let r of t.matchAll(OIe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Np("g"))??[])e.push(n);return[...new Set(e)].sort()}function IIe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function W5(t){return t.split("\\").join("/")}function PIe(t){return EIe.some(e=>t===e||t.startsWith(`${e}/`))}function CIe(t){let e=jp(t,"docs");if(!_Ie(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=bIe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=jp(i,s),c;try{c=SIe(a)}catch{continue}let l=W5(kIe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function DIe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=$Ie(jp(xIe(t),e));return W5(r)}function Mp(t="."){let e=[];for(let r of CIe(t)){let n;try{n=vIe(jp(t,r),"utf8")}catch{continue}let i=IIe(n),o=RIe(i);if(PIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(AIe)?[]:i.match(Np("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(TIe)){let d=DIe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function K5(t="."){let e=Mp(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 wIe(jp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var tIe,rIe,nIe,iIe,tS=y(()=>{"use strict";uC();tIe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],rIe="clad-doc-links: ignore",nIe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,iIe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as uIe}from"node:fs";import{join as dIe}from"node:path";function fIe(t){let{cwd:e="."}=t;return ge(e,rS,r=>pIe(r,e))}function pIe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Ip(e).docs){for(let o of i.doc_links)uIe(dIe(e,o))||n.push({detector:rS,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:rS,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 rS,nS,dC=y(()=>{"use strict";tS();wt();rS="DOC_LINK_INTEGRITY";nS={name:rS,run:fIe}});function mIe(t){let{cwd:e="."}=t;return ge(e,Pp,r=>hIe(r))}function hIe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=L5,o=t.project.onboarding_seeded===!0&&!i;r>=L5&&n.length===0&&e.push({detector:Pp,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:Pp,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:Pp,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 Pp,L5,z5,U5=y(()=>{"use strict";wt();Pp="SCENARIO_COVERAGE",L5=8;z5={name:Pp,run:mIe}});import{createHash as gIe}from"node:crypto";function yIe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Cp(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??q5),sample:yIe(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(q5),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Dp(t){return(t.features??[]).filter(e=>e.status==="done").length}function _Ie(t,e){return e<=0?!1:e>=1?!0:parseInt(gIe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var q5,iS=y(()=>{"use strict";q5=["unwanted"]});import{chmodSync as bIe,existsSync as H5,readFileSync as vIe,readdirSync as SIe,statSync as G5,unlinkSync as wIe,utimesSync as xIe,writeFileSync as $Ie}from"node:fs";import{join as Z5}from"node:path";import V5 from"node:process";function kIe(t){return nJ(t).map(e=>{try{let r=G5(e);return r.isFile()?{path:e,body:vIe(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 EIe(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!H5(r.path))continue;if(!G5(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}wIe(r.path);continue}$Ie(r.path,r.body),r.mode!==void 0&&bIe(r.path,r.mode),r.atime&&r.mtime&&xIe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function AIe(t){let e=!1,r=n=>{for(let i of SIe(n,{withFileTypes:!0})){if(e)return;let o=Z5(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 fC(t={}){let{cwd:e="."}=t,r=Z5(e,bs);if(!H5(r)||!AIe(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=kIe(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=We(i.cmd,c,{cwd:e,reject:!1})}catch(d){a=d}let l=EIe(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=Nt(Ka,i.cmd,s,c);return u||Yt(Ka,s)}var Ka,bs,TIe,pC=y(()=>{"use strict";Fr();an();fp();Pn();Ka="stage_2.3",bs="tests/oracle";TIe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${V5.argv[1]}`;if(TIe){let t=fC();console.log(JSON.stringify(t)),V5.exit(t.exitCode)}});import{existsSync as OIe}from"node:fs";import{join as RIe}from"node:path";function IIe(t){let{cwd:e="."}=t;return ge(e,ii,r=>PIe(r,e))}function PIe(t,e){let r=[],n=Cp(t.project,Dp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?fr(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(Np(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:ii,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(!OIe(RIe(e,f))){r.push({detector:ii,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:ii,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:ii,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:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ii,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:ii,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:ii,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:ii,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 ii,W5,K5=y(()=>{"use strict";ln();iS();pC();wt();ii="SPEC_CONFORMANCE";W5={name:ii,run:IIe}});function CIe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:mC,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>J5&&i.push({detector:mC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${J5})`})}return i}var mC,J5,Y5,X5=y(()=>{"use strict";ln();mC="STALE_EVIDENCE",J5=90;Y5={name:mC,run:CIe}});import{existsSync as Q5}from"node:fs";import{join as eY}from"node:path";function DIe(t){let{cwd:e="."}=t;return ge(e,Kl,r=>NIe(r,e))}function NIe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Kl,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:Kl,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=>Q5(eY(e,o)));i.length>0&&r.push({detector:Kl,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Wl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>Q5(eY(e,i)))&&r.push({detector:Kl,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 Kl,oS,hC=y(()=>{"use strict";Kv();wt();Kl="STALE_SPECIFICATION";oS={name:Kl,run:DIe}});import{existsSync as tY,statSync as rY}from"node:fs";import{join as nY}from"node:path";function MIe(t,e){let r=0;for(let n of e){let i=nY(t,n);if(!tY(i))continue;let o=rY(i).mtimeMs;o>r&&(r=o)}return r}function FIe(t){let{cwd:e="."}=t;return ge(e,gC,r=>LIe(r,e))}function LIe(t,e){let r=Fi(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=MIe(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=nY(e,a);if(!tY(c))continue;let l=rY(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>jIe&&s.push({detector:gC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var gC,jIe,sS,yC=y(()=>{"use strict";Sp();Ba();wt();gC="STALE_TESTS",jIe=30;sS={name:gC,run:FIe}});import{existsSync as zIe}from"node:fs";import{join as UIe}from"node:path";function qIe(t){let{cwd:e="."}=t;return ge(e,jp,r=>BIe(r,e))}function BIe(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:jp,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=>!zIe(UIe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:jp,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:jp,severity:Wl(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 jp,aS,_C=y(()=>{"use strict";Kv();wt();jp="STATUS_DRIFT";aS={name:jp,run:qIe}});function HIe(t){let{cwd:e="."}=t;return ge(e,cS,r=>GIe(r,e))}function GIe(t,e){let r=dt(e).language;return r==="unknown"?[{detector:cS,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:cS,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var cS,iY,oY=y(()=>{"use strict";an();wt();cS="TECH_STACK_MISMATCH";iY={name:cS,run:HIe}});function KIe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function JIe(t){let{cwd:e="."}=t;return ge(e,bC,r=>YIe(r,e))}function YIe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=ys([...KIe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:bC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var bC,sY,ZIe,VIe,WIe,lS,vC=y(()=>{"use strict";Sp();HP();wt();bC="UNMAPPED_ARTIFACT",sY=["src/stages/**/*.ts","src/spec/**/*.ts"],ZIe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},VIe={kotlin:"src/main/kotlin"},WIe=8;lS={name:bC,run:JIe}});import{existsSync as aY}from"node:fs";import{join as cY}from"node:path";function QIe(t){return XIe.some(e=>t.startsWith(e))}function ePe(t){let{cwd:e="."}=t;return ge(e,SC,r=>tPe(r,e))}function tPe(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];aY(cY(e,o))||s&&aY(cY(e,s))||r.push({detector:SC,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 qx(t){return`${JSON.stringify(t,null,2)} +`}function _te(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?`[[${mte(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(hte);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(hte);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}/${mte(s)}.md`,`${a.join(` +`)}`)}return o}function hte(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as wqe}from"node:fs";import{dirname as xqe,join as Pj}from"node:path";import{fileURLToPath as $qe}from"node:url";var Cj=xqe($qe(import.meta.url));function bte(t){for(let e of[Pj(Cj,"viewer",t),Pj(Cj,"..","graph","viewer",t),Pj(Cj,"..","..","dist","viewer",t)])try{return wqe(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function vte(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -896,57 +903,61 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}WP();dC();nC();oC();lC();VP();yC();_C();vC();wC();Jm();uC();Ue();var YUe=[Xv,uS,Yv,lS,eS,nS,Zv,aS,sS,Gv];function XUe(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=Op().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 YUe){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 XUe(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}Tj();Ue();Ii();var eqe=new Set(["mermaid","dot","json","obsidian","html"]);function dte(t={}){try{let e=t.format??"mermaid";if(!eqe.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=ate(i);for(let[c,l]of a){let u=QUe(s,c);Oj(Ij(u),{recursive:!0}),Rj(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,"."));Oj(Ij(t.out),{recursive:!0}),Rj(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"?ste(i):r==="json"?jx(i):ote(i);t.out?(Oj(Ij(t.out),{recursive:!0}),Rj(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 fte(){try{let t=wc(q(),".");process.stdout.write(ute(Lx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Jm();import{createServer as tqe}from"node:http";import{existsSync as rqe,watch as nqe}from"node:fs";import{join as iqe}from"node:path";Ue();Ii();function oqe(t={}){let e=t.cwd??".",r=new Set,n=()=>wc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}eC();yC();lC();dC();hC();QP();xC();$C();EC();TC();rh();gC();Ue();var kqe=[iS,gS,nS,hS,sS,lS,Xv,pS,fS,Yv];function Eqe(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=Np().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Hx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,q(e))}catch{}try{for(let o of kqe){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 Eqe(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}Dj();Ue();Pi();var Tqe=new Set(["mermaid","dot","json","obsidian","html"]);function wte(t={}){try{let e=t.format??"mermaid";if(!Tqe.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=$c(n,".");if(t.focus){let s=Fx(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=Mx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=_te(i);for(let[c,l]of a){let u=Aqe(s,c);Nj(Mj(u),{recursive:!0}),jj(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=Bx(i,Hx(i,"."));Nj(Mj(t.out),{recursive:!0}),jj(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"?yte(i):r==="json"?qx(i):gte(i);t.out?(Nj(Mj(t.out),{recursive:!0}),jj(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 xte(){try{let t=$c(q(),".");process.stdout.write(Ste(Gx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}rh();import{createServer as Oqe}from"node:http";import{existsSync as Rqe,watch as Iqe}from"node:fs";import{join as Pqe}from"node:path";Ue();Pi();function Cqe(t={}){let e=t.cwd??".",r=new Set,n=()=>$c(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=tqe((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 +`)}catch{r.delete(u)}},o=Oqe((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=qx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Hx(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=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=iqe(e,u);if(rqe(d))try{let f=nqe(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=Bx(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=Pqe(e,u);if(Rqe(d))try{let f=Iqe(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 pte(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await oqe({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 sqe=["stage_1.1","stage_2.1","stage_2.3"];function aqe(t){return(t.features??[]).filter(e=>e.status==="done")}function cqe(t,e){let r=aqe(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 mte(t,e){let r=[];for(let n of sqe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=cqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}wS();import hte from"node:process";function lqe(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=lqe(n,t);i.pass||r.push(i)}return r}ln();var Pj="stage_4.1";function Cj(t={}){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return{stage:Pj,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:Pj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Pj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var uqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hte.argv[1]}`;if(uqe){let t=Cj();console.log(JSON.stringify(t)),hte.exit(t.exitCode)}Sl();import{randomBytes as dqe}from"node:crypto";import{unlinkSync as fqe}from"node:fs";import{tmpdir as pqe}from"node:os";import{join as mqe,resolve as Dj}from"node:path";import hqe from"node:process";var Br=null;function gte(t){Br={cwd:Dj(t),run:null,jsonFile:null}}function Nj(){return Br!==null}function jj(t,e){if(!Br||Br.cwd!==Dj(t))return null;if(Br.run)return Br.run;let r=mqe(pqe(),`clad-shared-vitest-${hqe.pid}-${dqe(6).toString("hex")}.json`);Br.jsonFile=r;let n=e(r);return Br.run={proc:n,jsonFile:r},Br.run}function yte(t){return!Br||Br.cwd!==Dj(t)?null:Br.run}function Mj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function _te(){let t=Br?.jsonFile;if(Br=null,t)try{fqe(t)}catch{}}Fr();import bte from"node:process";var Ux="stage_1.4";function Fj(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 gqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${bte.argv[1]}`;if(gqe){let t=Fj();console.log(JSON.stringify(t)),bte.exit(t.exitCode)}Fr();import vte from"node:process";Ym();Pn();var qx="stage_2.2";function Lj(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=yte(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(qx,r,s,n);return a||Yt(qx,s)}var bqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vte.argv[1]}`;if(bqe){let t=Lj();console.log(JSON.stringify(t)),vte.exit(t.exitCode)}Fp();zj();Fr();an();Pn();import wte from"node:process";var Gx="stage_3.2";function Uj(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 Lqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wte.argv[1]}`;if(Lqe){let t=Uj();console.log(JSON.stringify(t)),wte.exit(t.exitCode)}Fr();Ue();Pn();import{existsSync as zqe}from"node:fs";import{resolve as $te}from"node:path";import kte from"node:process";var di="stage_2.4",qj=5e3,Uqe=3e4;function Bj(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 Bqe(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=$te(e,r.path);if(!zqe(s))return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??qj,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 xte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},qqe={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*qj,Uqe),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(Hqe(t,s,r))}return Gqe(o)}function Hqe(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("/")?$te(t,a):a,u=qj,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 Gqe(t){let e="skip";for(let o of t)xte[o.disposition]>xte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${qqe[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 Zqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${kte.argv[1]}`;if(Zqe){let t=Bj();console.log(JSON.stringify(t)),kte.exit(t.exitCode)}Fr();an();Pn();import Ete from"node:process";var Zx="stage_3.1";function Hj(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 Vqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ete.argv[1]}`;if(Vqe){let t=Hj();console.log(JSON.stringify(t)),Ete.exit(t.exitCode)}pC();Gj();Zj();Fr();Bx();import{randomBytes as e4e}from"node:crypto";import{unlinkSync as t4e}from"node:fs";import{tmpdir as r4e}from"node:os";import{join as n4e}from"node:path";import Wj from"node:process";Ym();Pn();Ue();import{readFileSync as Jqe}from"node:fs";import{resolve as Ote}from"node:path";function Yqe(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=Ote(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 Xqe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function Qqe(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=Xqe(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(Ote(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 Vj(t,e){try{let r=Yqe(Jqe(t,"utf8"));return r?Qqe(q(e),r,e):[]}catch{return[]}}var Hr="stage_2.1";function Rte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Ite(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Pte(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 i4e(t,e,r){let n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Rte(n,i))return null;let o=n,s=i,a=jj(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(Hr,n,c,s))return null;let u=Yt(Hr,c);if(Mj(u)==="fallback")return null;if(r){let d=Vj(l,e);if(d.length>0)return{stage:Hr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Hr,pass:!0,exitCode:0}}function o4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Ite(n,i))return null;let o=n,s=i,a=jj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Hr,o,a.proc,s))return null;let c=Yt(Hr,a.proc);if(Mj(c)==="fallback")return null;if(r&&Pte(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Hr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Hr,pass:!0,exitCode:0}}function Kj(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:Hr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Hr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Rte(n,i),a=Ite(n,i),c=r&&s;if(Nj()&&s){let d=i4e(t,e,c);if(d)return d}if(Nj()&&a){let d=o4e(t,e);if(d)return d}let l,u=i;c&&(l=n4e(r4e(),`clad-vitest-${Wj.pid}-${e4e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Hr,n,d,u);if(f)return f;let p=Pu("unit",Yt(Hr,d),d);if(r&&p.pass&&Pte(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Hr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Vj(l,e);if(m.length>0)return{stage:Hr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{t4e(l)}catch{}}}var s4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Wj.argv[1]}`;if(s4e){let t=Kj();console.log(JSON.stringify(t)),Wj.exit(t.exitCode)}Fr();an();Pn();import Cte from"node:process";var Kx="stage_3.3";function Jj(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 a4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Cte.argv[1]}`;if(a4e){let t=Jj();console.log(JSON.stringify(t)),Cte.exit(t.exitCode)}hC();Ff();_a();Xj();Ep();tS();var zte=St(er(),1);import{existsSync as Qj,readFileSync as _4e,readdirSync as Lte,statSync as b4e,writeFileSync as v4e}from"node:fs";import{basename as rh,join as nh,relative as Fte}from"node:path";var S4e=["self-dogfood:","fixture:","derived:"],Ute=/\.(test|spec)\.[jt]sx?$/;function qte(t,e=t,r=[]){let n;try{n=Lte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=nh(e,i);try{b4e(o).isDirectory()?qte(t,o,r):Ute.test(i)&&r.push(o)}catch{continue}}return r}function Bte(t="."){let e=nh(t,"spec","features"),r=nh(t,"tests"),n=[],i=[];if(!Qj(e)||!Qj(r))return{repaired:n,suggested:i};let o=qte(r),s=new Map;for(let a of o){let c=Fte(t,a).split("\\").join("/"),l=s.get(rh(a))??[];l.push(c),s.set(rh(a),l)}for(let a of Lte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=nh(e,a),l,u;try{l=_4e(c,"utf8"),u=(0,zte.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(S4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Qj(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=>Fte(t,h).split("\\").join("/")).find(h=>{let g=rh(h).replace(Ute,"");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 $te(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await Cqe({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 Dqe=["stage_1.1","stage_2.1","stage_2.3"];function Nqe(t){return(t.features??[]).filter(e=>e.status==="done")}function jqe(t,e){let r=Nqe(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 kte(t,e){let r=[];for(let n of Dqe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=jqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}TS();import Ete from"node:process";function Mqe(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=Mqe(n,t);i.pass||r.push(i)}return r}un();var Fj="stage_4.1";function Lj(t={}){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return{stage:Fj,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:Fj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Fj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var Fqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ete.argv[1]}`;if(Fqe){let t=Lj();console.log(JSON.stringify(t)),Ete.exit(t.exitCode)}$l();import{randomBytes as Lqe}from"node:crypto";import{unlinkSync as zqe}from"node:fs";import{tmpdir as Uqe}from"node:os";import{join as qqe,resolve as zj}from"node:path";import Bqe from"node:process";var Hr=null;function Ate(t){Hr={cwd:zj(t),run:null,jsonFile:null}}function Uj(){return Hr!==null}function qj(t,e){if(!Hr||Hr.cwd!==zj(t))return null;if(Hr.run)return Hr.run;let r=qqe(Uqe(),`clad-shared-vitest-${Bqe.pid}-${Lqe(6).toString("hex")}.json`);Hr.jsonFile=r;let n=e(r);return Hr.run={proc:n,jsonFile:r},Hr.run}function Tte(t){return!Hr||Hr.cwd!==zj(t)?null:Hr.run}function Bj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Ote(){let t=Hr?.jsonFile;if(Hr=null,t)try{zqe(t)}catch{}}Lr();import Rte from"node:process";var Vx="stage_1.4";function Hj(t={}){let{cwd:e="."}=t,r;try{r=We("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Vx,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:Vx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Vx,pass:!0,exitCode:0}:{stage:Vx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var Hqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rte.argv[1]}`;if(Hqe){let t=Hj();console.log(JSON.stringify(t)),Rte.exit(t.exitCode)}Lr();import Ite from"node:process";nh();Cn();var Wx="stage_2.2";function Gj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:Wx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Wx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Tte(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(Wx,r,s,n);return a||Yt(Wx,s)}var Vqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ite.argv[1]}`;if(Vqe){let t=Gj();console.log(JSON.stringify(t)),Ite.exit(t.exitCode)}Hp();Zj();Lr();cn();Cn();import Cte from"node:process";var Yx="stage_3.2";function Vj(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:Yx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:Yx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Yx,i,s,o);return a||Yt(Yx,s)}var p4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Cte.argv[1]}`;if(p4e){let t=Vj();console.log(JSON.stringify(t)),Cte.exit(t.exitCode)}Lr();Ue();Cn();import{existsSync as m4e}from"node:fs";import{resolve as Nte}from"node:path";import jte from"node:process";var fi="stage_2.4",Wj=5e3,h4e=3e4;function Kj(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:fi,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return y4e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:fi,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:fi,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Nte(e,r.path);if(!m4e(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Wj,c;try{c=We(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(fi,r.path,c);if(l)return l;if(c.timedOut)return{stage:fi,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:fi,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Dte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},g4e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function y4e(t,e,r){let n=Math.min(e.length*Wj,h4e),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(_4e(t,s,r))}return b4e(o)}function _4e(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("/")?Nte(t,a):a,u=Wj,d;try{d=We(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(qa(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 b4e(t){let e="skip";for(let o of t)Dte[o.disposition]>Dte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${g4e[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:fi,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:fi,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var v4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${jte.argv[1]}`;if(v4e){let t=Kj();console.log(JSON.stringify(t)),jte.exit(t.exitCode)}Lr();cn();Cn();import Mte from"node:process";var Xx="stage_3.1";function Jj(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:Xx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:Xx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Xx,i,s,o);return a||Yt(Xx,s)}var S4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Mte.argv[1]}`;if(S4e){let t=Jj();console.log(JSON.stringify(t)),Mte.exit(t.exitCode)}bC();Yj();Xj();Lr();Kx();import{randomBytes as T4e}from"node:crypto";import{unlinkSync as O4e}from"node:fs";import{tmpdir as R4e}from"node:os";import{join as I4e}from"node:path";import eM from"node:process";nh();Cn();Ue();import{readFileSync as $4e}from"node:fs";import{resolve as zte}from"node:path";function k4e(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=zte(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 E4e(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function A4e(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=E4e(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(zte(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 Qj(t,e){try{let r=k4e($4e(t,"utf8"));return r?A4e(q(e),r,e):[]}catch{return[]}}var Gr="stage_2.1";function Ute(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function qte(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Bte(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 P4e(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Ute(n,i))return null;let o=n,s=i,a=qj(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(Gr,n,c,s))return null;let u=Yt(Gr,c);if(Bj(u)==="fallback")return null;if(r){let d=Qj(l,e);if(d.length>0)return{stage:Gr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Gr,pass:!0,exitCode:0}}function C4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!qte(n,i))return null;let o=n,s=i,a=qj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Gr,o,a.proc,s))return null;let c=Yt(Gr,a.proc);if(Bj(c)==="fallback")return null;if(r&&Bte(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Gr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Gr,pass:!0,exitCode:0}}function tM(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Xi("test",t))}catch(d){return{stage:Gr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Gr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Ute(n,i),a=qte(n,i),c=r&&s;if(Uj()&&s){let d=P4e(t,e,c);if(d)return d}if(Uj()&&a){let d=C4e(t,e);if(d)return d}let l,u=i;c&&(l=I4e(R4e(),`clad-vitest-${eM.pid}-${T4e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Gr,n,d,u);if(f)return f;let p=ju("unit",Yt(Gr,d),d);if(r&&p.pass&&Bte(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Gr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Qj(l,e);if(m.length>0)return{stage:Gr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{O4e(l)}catch{}}}var D4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${eM.argv[1]}`;if(D4e){let t=tM();console.log(JSON.stringify(t)),eM.exit(t.exitCode)}Lr();cn();Cn();import Hte from"node:process";var t0="stage_3.3";function rM(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:t0,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:t0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(t0,i,s,o);return a||Yt(t0,s)}var N4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Hte.argv[1]}`;if(N4e){let t=rM();console.log(JSON.stringify(t)),Hte.exit(t.exitCode)}SC();Bf();ba();iM();Pp();aS();var Yte=St(er(),1);import{existsSync as oM,readFileSync as Z4e,readdirSync as Jte,statSync as V4e,writeFileSync as W4e}from"node:fs";import{basename as ch,join as lh,relative as Kte}from"node:path";var K4e=["self-dogfood:","fixture:","derived:"],Xte=/\.(test|spec)\.[jt]sx?$/;function Qte(t,e=t,r=[]){let n;try{n=Jte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=lh(e,i);try{V4e(o).isDirectory()?Qte(t,o,r):Xte.test(i)&&r.push(o)}catch{continue}}return r}function ere(t="."){let e=lh(t,"spec","features"),r=lh(t,"tests"),n=[],i=[];if(!oM(e)||!oM(r))return{repaired:n,suggested:i};let o=Qte(r),s=new Map;for(let a of o){let c=Kte(t,a).split("\\").join("/"),l=s.get(ch(a))??[];l.push(c),s.set(ch(a),l)}for(let a of Jte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=lh(e,a),l,u;try{l=Z4e(c,"utf8"),u=(0,Yte.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(K4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(oM(lh(t,b)))continue;let _=s.get(ch(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=>ch(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Kte(t,h).split("\\").join("/")).find(h=>{let g=ch(h).replace(Xte,"");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&&v4e(c,l,"utf8")}return{repaired:n,suggested:i}}vl();import{existsSync as w4e,readFileSync as x4e}from"node:fs";import{join as $4e}from"node:path";function k4e(t,e){let r=$4e(t,e);if(!w4e(r))return[];let n=[];for(let i of x4e(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 Hte(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=>k4e(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 Gte(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();ln();Ii();ln();vl();var eM=["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"],E4e=[...eM,"att"];function A4e(t,e,r){if(e.startsWith("stage_4")){let n=fr(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 T4e(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:[...eM.map(o=>A4e(i,o,e)),T4e(i,r,e)]}));return{columns:E4e,rows:n}}function Zte(t,e=".",r={}){let n=r.internal??!1,i=Qx(t,e),o=[...eM.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 r5e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(ade(),sde)),Promise.resolve().then(()=>(fde(),dde)),Promise.resolve().then(()=>(Qp(),w7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Yee(s),prepareInit:({cwd:s,mode:a,intent:c})=>Kee(s,a,c),initialize:hj,prepareClarify:(s,{cwd:a})=>Jee(a,s),clarify:bj,resolveReview:(s,{cwd:a})=>Gee(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 n5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await hj({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(` +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&W4e(c,l,"utf8")}return{repaired:n,suggested:i}}xl();import{existsSync as J4e,readFileSync as Y4e}from"node:fs";import{join as X4e}from"node:path";function Q4e(t,e){let r=X4e(t,e);if(!J4e(r))return[];let n=[];for(let i of Y4e(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 tre(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=>Q4e(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 rre(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(` +`)}uS();Ue();un();Pi();un();xl();var sM=["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"],e6e=[...sM,"att"];function t6e(t,e,r){if(e.startsWith("stage_4")){let n=fr(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 r6e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":J_(e,r,t).state==="fresh"?"\u2713":"!"}function o0(t,e="."){let r=ls(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...sM.map(o=>t6e(i,o,e)),r6e(i,r,e)]}));return{columns:e6e,rows:n}}function nre(t,e=".",r={}){let n=r.internal??!1,i=o0(t,e),o=[...sM.map(c=>n?c.replace("stage_",""):n6e(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 n6e(t){return Ta(t).slice(0,3)}async function R5e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(_de(),yde)),Promise.resolve().then(()=>(xde(),wde)),Promise.resolve().then(()=>(om(),C7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>cte(s),prepareInit:({cwd:s,mode:a,intent:c})=>ste(s,a,c),initialize:Sj,prepareClarify:(s,{cwd:a})=>ate(a,s),clarify:kj,resolveReview:(s,{cwd:a})=>rte(s,{cwd:a})}});n(i.server);let o=new r;B.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function I5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await Sj({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){B.stdout.write(`${JSON.stringify(n,null,2)} +`),B.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){B.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: -`);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(` +`);for(let[o,s]of n.clarifyingQuestions.entries())B.stdout.write(` ${o+1}. ${s} +`);B.stdout.write(` +`)}else r||n.created.some(s=>s==="docs/conventions.md")&&(B.stdout.write(` \u{1F4A1} Tip: for a more precise scaffold, describe the project: -`),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 i5e(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(()=>(Mde(),jde)),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=`${mG(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 o5e(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("."),F5(".");let n=ru(".");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=Bte(".");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 s5e(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 a5e(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 c5e(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 l5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await ZX(".",{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(` +`),B.stdout.write(` clad init +`),B.stdout.write(` e.g. clad init payment SaaS for B2B +`),B.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. + +`));B.exit(0)}async function P5e(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(()=>(Wde(),Vde)),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}`),B.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=q(e.cwd??"."),a=n.featuresTouched.map(l=>uR(l,s)),c=`${wG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&B.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.`),B.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function C5e(t={}){try{let e=q();if(_a("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=bs(".");Yl(".",r),Ja("."),K5(".");let n=su(".");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=ere(".");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=i0(".");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=dS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),B.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)`),B.exit(0);return}L("pass","sync",`${e.features.length} features valid`),B.exit(0)}catch(e){L("fail","sync",e.message),B.exit(1)}}function D5e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),B.exit(2);return}let e=C_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),B.exit(0)}function N5e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),B.exit(2);return}let r=D_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),B.exit(1);return}N_(".",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?B.stdout.write(`Run: git checkout ${r.gitHead} +`):B.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. +`),B.exit(0)}async function j5e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await eD({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});B.exit(r.errors.length>0?1:0)}async function M5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await n7(".",{wireHosts:async()=>(await eD({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."),B.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);B.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),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 u5e={"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=u5e[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",Fj],["stage_1.5",rc],["stage_1.6",Vp],["stage_2.1",()=>Kj({...i,strict:t.strict})],["stage_2.2",()=>Lj(i)],["stage_2.3",fC],["stage_2.4",Bj],["stage_3.1",Hj],["stage_3.2",Uj],["stage_3.3",Jj],["stage_4.1",Cj],["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_("."),gte(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=CX(p);ci(h)&&(c=!0,a=Math.max(a,DX(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)&&_5e(p))}}finally{V_(),_te()}if(t.strict)try{let d=q();for(let f of mte(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{NG(".",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 d5e(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 f5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=Sr(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 p5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=dS(e,o=>{try{return Lde(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 m5e(t={}){try{if(t.sessions){ete(t);return}if(t.trend!==void 0&&t.trend!==!1){tte(t);return}let e=q(),n=CH(e,o=>{try{return Lde(o,"utf8")}catch{return null}},"."),i=NH(".",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(` +`),IA({tier:"pre-commit",strict:!0}).anyFailed?B.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"),B.exit(t.code)}var F5e={"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 IA(t){let e=t.tier??"all",r=t.silent===!0,n=F5e[e];if(!n)return t.json&&!r?B.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",()=>sh(i)],["stage_1.2",()=>oh(i)],["stage_1.3",()=>si({...i,strict:t.strict})],["stage_1.4",Hj],["stage_1.5",ic],["stage_1.6",Qp],["stage_2.1",()=>tM({...i,strict:t.strict})],["stage_2.2",()=>Gj(i)],["stage_2.3",_C],["stage_2.4",Kj],["stage_3.1",Jj],["stage_3.2",Vj],["stage_3.3",rM],["stage_4.1",Lj],["stage_4.2",ah]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":li(d)?"fail":"skip",u=[];Y_("."),Ate(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=HX(p);li(h)&&(c=!0,a=Math.max(a,GX(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),li(h)&&Z5e(p))}}finally{Q_(),Ote()}if(t.strict)try{let d=q();for(let f of kte(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"||!li(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=>li(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(_a("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{ZG(".",q())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?B.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&B.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 L5e(t){try{let e=q(),r=gl(e,t);B.stdout.write(`${JSON.stringify(r,null,2)} +`),B.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),B.exit(1)}}function z5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=Sr(r,t,{depth:n});B.stdout.write(`${JSON.stringify(i,null,2)} +`),B.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),B.exit(1)}}function U5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=yS(e,o=>{try{return Kde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});B.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),B.exit(0)}catch(e){L("fail","infer-deps",e.message),B.exit(1)}}function q5e(t={}){try{if(t.sessions){dte(t);return}if(t.trend!==void 0&&t.trend!==!1){fte(t);return}let e=q(),n=UH(e,o=>{try{return Kde(o,"utf8")}catch{return null}},"."),i=BH(".",n);if(t.json)B.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)}`,` ${yl}`];B.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)")}G.exit(0)}catch(e){L("fail","measure",e.message),G.exit(1)}}function h5e(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=pX(".");n&&G.stdout.write(`\u2139 ${n} -`)}G.exitCode=r.worst}function g5e(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:fr(".")}}catch{e=void 0}let r=nX(".",t,{checkStages:kA,onIndex:Wa,gitOpInProgress:kO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}G.exit(r.code)}function y5e(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=B5(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(` +`),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)")}B.exit(0)}catch(e){L("fail","measure",e.message),B.exit(1)}}function B5e(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`),B.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),B.exit(1)}let r=IA({...t,focusModules:e});if(!t.json){let n=$X(".");n&&B.stdout.write(`\u2139 ${n} +`)}B.exitCode=r.worst}function H5e(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:fr(".")}}catch{e=void 0}let r=mX(".",t,{checkStages:IA,onIndex:Ja,gitOpInProgress:PO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}B.exit(r.code)}function G5e(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),B.exit(1);return}if(e.required){t&&B.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=eY(n);if(o.length===0){B.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),B.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";B.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} +`)}B.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),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=Hte(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(`${Gte(i)} -`),G.exit(0)}function _5e(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=Fde(_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}\` +`),B.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"),B.exit(1);return}let i=tre(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`),B.exit(1);return}B.stdout.write(`${rre(i)} +`),B.exit(0)}function Z5e(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=y4(Oa(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";if(B.stdout.write(` ${o}${s} [${i.detector}] +`),Oa(i.detector,i.message)!==i.message){let c=i.message.split(` +`).map(l=>l.trim()).filter(l=>l.length>0);for(let l of c.slice(0,4))B.stdout.write(` ${y4(l,160)} +`);c.length>4&&B.stdout.write(` \u2026 and ${c.length-4} more line(s) \u2014 see \`clad check --json\` +`)}}n.length>3&&B.stdout.write(` \u2026 and ${n.length-3} more finding(s) +`),t.hint&&B.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&&G.stdout.write(` ${Fde(e.trim(),160)} -`)}}function Fde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function b5e(t){let e=q();if(t.json){G.stdout.write(`${JSON.stringify(Qx(e,"."),null,2)} -`),G.exitCode=0;return}G.stdout.write(`${Zte(e,".",{internal:t.internal})} -`),G.exit(0)}function v5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function S5e(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=AG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{t5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${v5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function w5e(t){let e=HA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function x5e(){let t=new $4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),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(n5e),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(i5e),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(o5e),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(c5e),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(l5e),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(h5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(s5e),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(g5e),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)=>y5e(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(a5e),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(b5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(d5e),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)=>f5e(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=>UX(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=>p5e(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=>m5e(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=>dte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>fte()),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=>{pte(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=>pG(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=>$Y(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=>S5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(w5e),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(PX),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(r5e),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){QY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}AY(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(Wee),t}var $5e=!!globalThis.__CLADDING_BUNDLED,k5e=$5e||import.meta.url===`file://${G.argv[1]}`;k5e&&x5e().parse();export{u5e as TIER_STAGES,x5e as createProgram,S5e as runBundleCommand,h5e as runCheckCommand,kA as runCheckStages,s5e as runCheckpointCommand,d5e as runContextCommand,g5e as runDoneCommand,f5e as runImpactCommand,p5e as runInferDepsCommand,n5e as runInitCommand,m5e as runMeasureCommand,y5e as runOracleCommand,a5e as runRollbackCommand,w5e as runRouteCommand,i5e as runRunCommand,r5e as runServeCommand,c5e as runSetupCommand,b5e as runStatusCommand,o5e as runSyncCommand,l5e as runUpdateCommand}; +`).map(r=>r.trim()).filter(r=>r.length>0);for(let r of e.slice(0,5))B.stdout.write(` ${y4(r,160)} +`);e.length>5&&B.stdout.write(` \u2026 and ${e.length-5} more line(s) \u2014 see \`clad check --json\` +`)}}function y4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function V5e(t){let e=q();if(t.json){B.stdout.write(`${JSON.stringify(o0(e,"."),null,2)} +`),B.exitCode=0;return}B.stdout.write(`${nre(e,".",{internal:t.internal})} +`),B.exit(0)}function W5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function K5e(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"),B.exit(1);return}let n;try{let i=q(e),o=o0(i,e),s={gitHead:Sa(e),version:ru(),generatedAt:t.now??new Date().toISOString()},a=vl(i),c;try{let l=t.since??ns(e),u=is(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:_l(u),auditMarkdown:bl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=NG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),B.exit(1);return}try{O5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),B.exit(1);return}L("pass","bundle",`${r} \xB7 ${W5e(Buffer.byteLength(n,"utf8"))}`),B.exit(0)}function J5e(t){let e=JA(t);L("note",`route \u2192 ${e}`,t),B.exit(e==="unknown"?1:0)}function Y5e(){let t=new I4;t.name("clad").description("Reference Ironclad CLI").version("0.9.3"),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(I5e),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(P5e),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(C5e),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(j5e),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(M5e),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(B5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(D5e),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(H5e),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)=>G5e(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(N5e),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(V5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(L5e),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)=>z5e(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=>XX(r,{checkStages:IA})),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=>q5e(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=>wte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>xte()),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=>{$te(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 entry movement (from the changelog), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, 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 six-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=>NY(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=>K5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(J5e),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(BX),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(R5e),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){uX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}FY(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(ote),t}var X5e=!!globalThis.__CLADDING_BUNDLED,Q5e=X5e||import.meta.url===`file://${B.argv[1]}`;Q5e&&Y5e().parse();export{F5e as TIER_STAGES,Y5e as createProgram,K5e as runBundleCommand,B5e as runCheckCommand,IA as runCheckStages,D5e as runCheckpointCommand,L5e as runContextCommand,H5e as runDoneCommand,z5e as runImpactCommand,U5e as runInferDepsCommand,I5e as runInitCommand,q5e as runMeasureCommand,G5e as runOracleCommand,N5e as runRollbackCommand,J5e as runRouteCommand,P5e as runRunCommand,R5e as runServeCommand,j5e as runSetupCommand,V5e as runStatusCommand,C5e as runSyncCommand,M5e as runUpdateCommand}; diff --git a/plugins/codex/.codex-plugin/plugin.json b/plugins/codex/.codex-plugin/plugin.json index 5751c097..0d5cc9d7 100644 --- a/plugins/codex/.codex-plugin/plugin.json +++ b/plugins/codex/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.2", + "version": "0.9.3", "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/planner/SKILL.md b/plugins/codex/skills/planner/SKILL.md index 74a4755f..f3cacac9 100644 --- a/plugins/codex/skills/planner/SKILL.md +++ b/plugins/codex/skills/planner/SKILL.md @@ -52,7 +52,7 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read ## What you don't do - You do not write production code or tests (`developer` does). - You do not pass philosophical judgement (`reviewer` does). -- You do not silently drop ACs — every removal needs an `archive_reason`. +- You do not silently drop ACs — say why in the criterion's `notes` first. ## EARS reminder diff --git a/plugins/gemini-cli/gemini-extension.json b/plugins/gemini-cli/gemini-extension.json index a00d0f3b..f3f74882 100644 --- a/plugins/gemini-cli/gemini-extension.json +++ b/plugins/gemini-cli/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.2", + "version": "0.9.3", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Gemini CLI. Exposes spec validation, drift detection, 15 Iron Law stages, and 5 agent personas as custom commands + an auto-launched MCP server.", "contextFileName": "GEMINI.md", "mcpServers": { diff --git a/spec.yaml b/spec.yaml index d584a432..6afa3f68 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.2" + version: "0.9.3" 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: 271 + features: 273 scenarios: 2 capabilities: 6 - test_files: 248 + test_files: 249 diff --git a/spec/attestation.yaml b/spec/attestation.yaml index e98085a0..8c131933 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: 033d721cd4fe05a4 + CHANGELOG.md: f2d8bae463e3279e CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 490eab86b9c0d208 - README.ja.md: 3c4f3453ba97a3a6 - README.ko.html: dd48adf81a1d382c - README.ko.md: 383011eabecf55a2 - README.md: c84d37f3d8726f5c - README.zh.md: 014fe3859fdbb8dc + README.html: 042398234df7c6db + README.ja.md: c0e21f65682fdddf + README.ko.html: c6c9c457101a7faa + README.ko.md: d5c8665fb5126908 + README.md: 988329327e2b04dd + README.zh.md: ac6e59d1dfb425da SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -56,7 +56,7 @@ attested_modules: docs/dogfood/cursor-agent-2026-07-15.md: a2f621fd0c3b57af docs/dogfood/gemini-cli-2026-05-20.md: 2da1ba66c4f108f0 docs/feature-cycle.md: e1847cc9fe9b6eb6 - docs/glossary.md: 9e897b963c3aa88f + docs/glossary.md: fc7258d4d3dcb9a2 docs/img/en/ecosystem.svg: ed14d1d17f088b00 docs/img/en/independence.svg: 1b3048b3b5206483 docs/img/en/relationship.svg: c7a24203925b4664 @@ -71,24 +71,24 @@ attested_modules: docs/spec-ids-multi-dev.md: 28d58e84879f58b1 docs/ssot-model.md: 66b9439e2f71ac4b docs/ssot-testing.md: abf3b2bd5acb29a1 - package-lock.json: efa9090e0ef4bf1f - package.json: 00272205b48b15df - plugins/claude-code/.claude-plugin/plugin.json: fcfe09c82ca6492b + package-lock.json: 505b6ea10c37fcf6 + package.json: bc72ea4dbf16fc7d + plugins/claude-code/.claude-plugin/plugin.json: e46cfdf3bf480696 plugins/claude-code/agents/developer.md: 3002b4ef69ddab43 plugins/claude-code/agents/observability.md: 637fde18c012e2a7 plugins/claude-code/agents/orchestrator.md: 1b758de0bdab8eb0 - plugins/claude-code/agents/planner.md: d1f895a20fb3a3ed + plugins/claude-code/agents/planner.md: 2ca87ed1fe99c913 plugins/claude-code/agents/reviewer.md: cdf7469a3e58b438 plugins/claude-code/commands/init.md: 5529b13d0f1ab4bf plugins/claude-code/hooks/hooks.json: 42321ead26fb1da8 - plugins/codex/.codex-plugin/plugin.json: da272fa283026dc2 + plugins/codex/.codex-plugin/plugin.json: b662ba85804e6abb plugins/codex/.mcp.json: 43e3f4b2af24aa18 plugins/codex/skills/check/SKILL.md: 6a665422af510e72 plugins/codex/skills/developer/SKILL.md: 3002b4ef69ddab43 plugins/codex/skills/init/SKILL.md: 5529b13d0f1ab4bf plugins/codex/skills/observability/SKILL.md: 637fde18c012e2a7 plugins/codex/skills/orchestrator/SKILL.md: 1b758de0bdab8eb0 - plugins/codex/skills/planner/SKILL.md: d1f895a20fb3a3ed + plugins/codex/skills/planner/SKILL.md: 2ca87ed1fe99c913 plugins/codex/skills/reviewer/SKILL.md: cdf7469a3e58b438 plugins/codex/skills/run/SKILL.md: 9f95ff17d70c8dd1 plugins/codex/skills/serve/SKILL.md: f08bbdbbfeb05041 @@ -97,7 +97,7 @@ attested_modules: plugins/gemini-cli/GEMINI.md: ba08eaf2cd557a65 plugins/gemini-cli/commands/README.md: 3527d771578431bd plugins/gemini-cli/commands/init.toml: e7f310fd7af23f95 - plugins/gemini-cli/gemini-extension.json: 729b2c69fdc0b650 + plugins/gemini-cli/gemini-extension.json: 082af8a03ae1601d scripts/build-plugin.mjs: 7fabe2b6301b142a scripts/build.mjs: 3a4b204063024ef1 scripts/migrate-dogfood-v0.3.16.mjs: 1e265fb370019996 @@ -117,7 +117,7 @@ attested_modules: skills/serve/SKILL.md: f08bbdbbfeb05041 skills/status/SKILL.md: 09faadc50b3449da skills/sync/SKILL.md: 775c0f990a52a3d9 - spec.yaml: ea944be3d843f018 + spec.yaml: 35b159a6c3949112 spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -143,14 +143,14 @@ attested_modules: src/agents/loader.ts: 6d35560c47f9ae85 src/agents/observability.md: 637fde18c012e2a7 src/agents/orchestrator.md: 1b758de0bdab8eb0 - src/agents/planner.md: d1f895a20fb3a3ed + src/agents/planner.md: 2ca87ed1fe99c913 src/agents/reviewer.md: cdf7469a3e58b438 - src/changelog/collect.ts: a6c936a7b8c34e2a + src/changelog/collect.ts: c9ae573dba826a75 src/changelog/render.ts: 83dd2d95f24ca68c src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f src/cli/changelog.ts: 2de1adb009b89ab4 - src/cli/clad.ts: 0501f16f74b2a8dc + src/cli/clad.ts: a02fe02bcb5e942d src/cli/clarify.ts: f17177969d5b75ff src/cli/doctor-hosts.ts: 1f0c2cec5a310b81 src/cli/doctor.ts: b98b955fe75e7f7e @@ -163,7 +163,7 @@ attested_modules: src/cli/init.ts: 91cf7be2b7427fbf src/cli/intent-from-path.ts: e69862821d979f22 src/cli/measure.ts: 3a562f16589e26c2 - src/cli/report.ts: 911f859b2446834b + src/cli/report.ts: ee7d35b6c36dfa76 src/cli/scan/architecture.ts: c9cfd5445ea77e45 src/cli/scan/conventions.ts: 577468c0fc3fdf6a src/cli/scan/dispatcher.ts: 97bd3f12cece4fc4 @@ -184,7 +184,7 @@ attested_modules: src/cli/update.ts: b0151396c9a0f6ca src/cli/verdict.ts: 85a4ef27292b9169 src/core/checkpoint.ts: 63300c2764533b6c - src/core/git-ops.ts: 4544bde493a0628f + src/core/git-ops.ts: c144e5cc253822b3 src/core/postmortem.ts: 73be29d5e8a16fd4 src/core/telemetry-summary.ts: 6782bfaa6c3ecfa6 src/drive: a4d0f0eb87fed960 @@ -207,7 +207,7 @@ attested_modules: src/hitl/audit.ts: 79b06e904815469a src/hitl/identity.ts: 52ff84aa666f1dab src/hitl/independence.ts: 202f4e5ef8bc69e3 - src/init/agents-md.ts: 698b2a38ddd5d1a6 + src/init/agents-md.ts: 5369a15847ce1ae7 src/init/git-hook.ts: b77910b0df392cbf src/init/host-instructions.ts: c598f8598d8d1cd4 src/init/host-setup.ts: 158cc9306a746da1 @@ -228,12 +228,13 @@ attested_modules: src/oracle/payload.ts: 0171633d758ceed8 src/oracle/policy.ts: 8919ad927bd59b08 src/oracle/record.ts: 0b9c124225abe1ac + src/report/ac-delta.ts: f75250d617c710dc src/report/bundle.ts: f8a2fb6c2d02326f - src/report/report.ts: 234d0e0637153478 + src/report/report.ts: f6f6f8bdb679b702 src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: a63dde88609a6abe + src/serve/server.ts: 0a76fefb0aca1434 src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: 294a1e99c42d4aef src/spec/cli.ts: 7a9bcd0f66677810 @@ -245,7 +246,7 @@ attested_modules: src/spec/load.ts: 9fe2fe74053bf7e3 src/spec/new.ts: 4c91f6d41acaab69 src/spec/parse.ts: 1eab9a28c9359a45 - src/spec/reverse-index.ts: d8b003eb8f1918c8 + src/spec/reverse-index.ts: fa54d7203a02799a src/spec/schema.json: 848951cd01d7f82f src/spec/test-ref-repair.ts: 5ce823b479aaaca3 src/spec/types.ts: 5799bc9fc1e00553 @@ -316,7 +317,7 @@ attested_modules: src/stages/spec-conformance.ts: 1e9b052a2a268d7a src/stages/test-run-cache.ts: 462a5ef1d30eb766 src/stages/toolchain/coverage-tool.ts: 310883060ed6d92e - src/stages/toolchain/detect.ts: 36d4947e5567bd5f + src/stages/toolchain/detect.ts: e50845a8aa69c765 src/stages/toolchain/gate-config.ts: 818a0a549d875581 src/stages/toolchain/language-config.ts: 65175718559b0710 src/stages/toolchain/module-scope.ts: 88358ec3b84eedd3 @@ -326,7 +327,7 @@ attested_modules: src/stages/types.ts: 95e8c9e13187d85b src/stages/uat.ts: 62ec3e37a124f8c5 src/stages/unit.ts: b503350b0e5c7e5a - src/stages/util.ts: a024afe34884d653 + src/stages/util.ts: 7c49de3250816de8 src/stages/vacuous-tests.ts: 8e71b81e151325af src/stages/visual.ts: 2b60dd991fa8124e src/ui: a4d0f0eb87fed960 @@ -340,7 +341,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: d559fff3bd530bad + tests/cli/clad.test.ts: 95a6303c6d9437e2 tests/cli/gate-golden-matrix.test.ts: 39cf615407a55abe tests/cli/init.test.ts: 3428a89708fc9330 tests/cli/intent-onboarding.test.ts: 0681b98ce2e74c22 @@ -424,13 +425,13 @@ attested_modules: tests/stages/stale-tests.test.ts: 1467ceedb8019e86 tests/stages/status-drift.test.ts: cff1092eeb23c268 tests/stages/tech-stack-mismatch.test.ts: 878436ffd2f94c97 - tests/stages/toolchain.test.ts: 04e12be4ac1dee5c + tests/stages/toolchain.test.ts: 200184f572abcf88 tests/stages/toolchain/gate-config.test.ts: aef5813a6591b153 tests/stages/type.test.ts: b57cf7455cae3b32 tests/stages/uat.test.ts: 29c5bf3e7f3abc35 tests/stages/unit.test.ts: 97781210eb81bb25 tests/stages/unmapped-artifact.test.ts: 6bfdae66990fd63a - tests/stages/util.test.ts: dd95144b36bfd2b1 + tests/stages/util.test.ts: a162cbe069c85f41 tests/stages/visual.test.ts: dd819e7d25586b92 tests/ui/panel.test.ts: ad9ea207f34b1c51 tests/ui/pulse.test.ts: 30f1d091de9093ad @@ -547,6 +548,7 @@ attested_features: F-284be4f6: ok F-288864ae: ok F-2be3e3bb: ok + F-2c02991f: ok F-2de65d: ok F-2e28cc72: ok F-315fd7: ok @@ -583,6 +585,7 @@ attested_features: F-5b9f9f: ok F-5cac007a: ok F-5d3ed2: ok + F-5dfbac9c: ok F-5f6b45: ok F-600272d7: ok F-63b989e5: ok diff --git a/spec/capabilities.yaml b/spec/capabilities.yaml index 88b62505..66cf4859 100644 --- a/spec/capabilities.yaml +++ b/spec/capabilities.yaml @@ -17,7 +17,7 @@ capabilities: title: "Harness CLI (clad)" summary: "14 verbs covering init, scan, refine, sync, check, drive, serve, doctor, …" surface: tool - features: [F-09d68b, F-bb15e6, F-7afbd4, F-6ba22c5c] + features: [F-09d68b, F-bb15e6, F-7afbd4, F-6ba22c5c, F-5dfbac9c] - id: spec-governance title: "Spec governance (4-tier SSoT)" summary: "Tier A/B/C/D model with explicit refresh authority + banner convention" diff --git a/spec/features/arch-gate-skips-build-output-2c02991f.yaml b/spec/features/arch-gate-skips-build-output-2c02991f.yaml new file mode 100644 index 00000000..981fecfa --- /dev/null +++ b/spec/features/arch-gate-skips-build-output-2c02991f.yaml @@ -0,0 +1,35 @@ +id: F-2c02991f +slug: arch-gate-skips-build-output +title: "The architecture gate scans source, not build output" +status: done +modules: + - src/stages/toolchain/detect.ts +acceptance_criteria: + - id: AC-caa9471d + ears: event + condition: "when the TypeScript or JavaScript architecture gate is composed for a project" + text: "When the TypeScript or JavaScript architecture gate is composed for a project, then the system shall exclude generated build-output directories from the circular-dependency scan — the unambiguous ones at any depth, and the ones whose names also occur as real source directories at the repository root only." + test_refs: ["tests/stages/toolchain.test.ts"] + notes: "WHY: a bundler's output legitimately contains mutual imports, so scanning it reports cycles that exist in no hand-written file. Measured on a live adopter: five recorded hard-blocking gate failures, all five inside a version-ignored bundle — 100% false with respect to source. The adopter's recorded root cause was wrong and the issue stayed open for sixteen days.\n\nWHY THE TWO DEPTHS: excluding `build`, `out` or `target` at any depth would drop hand-written code from the scan, and a false negative is worse than the false RED this fixes. `dist`, `coverage` and the framework caches carry no such risk — no repository on hand commits source under them — and anchoring THEM at the root left a monorepo package or a front-end subdirectory (`frontend/dist`) still blocking.\n\nHONEST SCOPE OF THE MEASUREMENT: the four-cycles-to-zero figure was taken by running the scanner directly in a front-end subdirectory that is not itself a gate root, so it corroborates the pattern rather than measuring gate impact. On the gate roots on record the fix removes no findings today — cladding is already clean, and the adopter that filed the issue has its own scanner config, which makes cladding stand down there by design." + - id: AC-554d9436 + ears: unwanted + condition: "if the project declares its own dependency-scanner configuration" + text: "If the project declares its own dependency-scanner configuration, then the system shall not pass its own exclusion, leaving the project's rules in force." + test_refs: ["tests/stages/toolchain.test.ts"] + notes: "WHY: the scanner REPLACES its configured exclusions with the command-line flag rather than merging them. Passing ours unconditionally would silently delete an adopter's own rules — including the workaround one adopter is currently relying on, which they discovered alone and buried in an unrelated commit." + - id: AC-c04171bd + ears: ubiquitous + text: "The system shall keep the repository root as the scan root, so a project whose layout has no conventional source directory is scanned rather than silently skipped." + test_refs: ["tests/stages/toolchain.test.ts"] + notes: "WHY: narrowing the root to a named directory was measured to be worse than the defect it fixes. A missing root makes the scanner exit with a file-not-found error, which the harness classifies as a setup gap and reports as advisory — so the whole stage skips and the gate goes green having checked nothing. One adopter's front-end has exactly that layout. Trading a loud false failure for a silent pass is a mistake this project has already made once." + - id: AC-dd5c3abf + ears: event + condition: "when a circular dependency exists among hand-written source files" + text: "When a circular dependency exists among hand-written source files, then the system shall still report it after the exclusion is applied." + test_refs: ["tests/stages/toolchain.test.ts"] + notes: "WHY: this change may only remove findings, never hide a real one. Measured before implementing: the excluded files pull ninety-four further files transitively and contain zero source-level cycles, so the measured false-negative count is zero — but that is a property of three repositories, not a proof, so it is pinned as a requirement." +design_impact: + classification: none + rationale: "Corrects which files an existing gate scans. No new capability, no architecture change, no project-context change, no schema field — the gate, its severity, and its exit contract are untouched." + status: resolved + artifacts: [] diff --git a/spec/features/pr-review-packet-f6cc5e5a.yaml b/spec/features/pr-review-packet-f6cc5e5a.yaml index 0c18ae0b..d60963be 100644 --- a/spec/features/pr-review-packet-f6cc5e5a.yaml +++ b/spec/features/pr-review-packet-f6cc5e5a.yaml @@ -11,12 +11,12 @@ acceptance_criteria: - id: AC-cbf1c202 ears: event condition: "when clad report --since runs in a repo with spec.yaml" - text: "When clad report runs, the system shall print a markdown report with four sections — spec changes (from the changelog collector), code changes resolved to owning features via the reverse index, the deduped regression set (union of test_refs across impact slices), and gate plus attestation state — byte-identical across two runs on the same repository state." + text: "When clad report runs, the system shall print a markdown report with six sections — spec entry changes (from the changelog collector), how each acceptance criterion moved, code changes resolved to owning features via the reverse index, the tests those features declare, the deduped regression set (union of test_refs across impact slices), and gate plus attestation state — byte-identical across two runs on the same repository state." test_refs: - - "tests/report/report.test.ts#emits the four mandated sections in order" + - "tests/report/report.test.ts#emits the six mandated sections in order" - "tests/report/report.test.ts#two renders on the same model are byte-identical" - "tests/report/report.test.ts#partitions changed files into owned vs unowned by owner count" - - "tests/report/report-cli.test.ts#AC-cbf1c202 · renders all four sections in order and exits 0" + - "tests/report/report-cli.test.ts#AC-cbf1c202 · renders all six sections in order and exits 0" - "tests/report/report-cli.test.ts#AC-cbf1c202 · two runs on the same repo state are byte-identical" notes: "WHY: the doc-value A/B proved traceability value to reviewers and auditors; a PR is where they consume it without reading the spec tree." - id: AC-7672ce5d diff --git a/spec/features/review-packet-ac-delta-5dfbac9c.yaml b/spec/features/review-packet-ac-delta-5dfbac9c.yaml new file mode 100644 index 00000000..67b871e1 --- /dev/null +++ b/spec/features/review-packet-ac-delta-5dfbac9c.yaml @@ -0,0 +1,54 @@ +id: F-5dfbac9c +slug: review-packet-ac-delta +title: "Review packet shows how the contract itself moved" +status: done +modules: + - src/changelog/collect.ts + - src/report/ac-delta.ts + - src/report/report.ts + - src/cli/report.ts +acceptance_criteria: + - id: AC-a2278f11 + ears: event + condition: "when a review packet is rendered for a git range" + text: "When a review packet is rendered for a git range, then the system shall enumerate every feature spec entry the range touched regardless of that entry's status, so entries still planned or in progress reach the reviewer." + test_refs: ["tests/changelog/collect.test.ts"] + notes: "WHY: the changelog collector is a SHIPPED filter — it keeps only done/archived transitions and drops planned/in_progress outright. Measured on a live corpus, 74% of the range's spec entries fell into that hole, which would make two of the three new sections structurally unbuildable." + - id: AC-c32cbab2 + ears: ubiquitous + text: "The system shall classify each acceptance criterion in the range as new, rewritten, removed, or unchanged by joining the base and head revisions on the criterion id, counting a difference in any field that states the obligation — the statement, the EARS pattern, the trigger condition, the action, or the response — as a rewrite, and ignoring differences that are only whitespace." + test_refs: ["tests/report/ac-delta.test.ts"] + notes: "WHY: a criterion keeps its id across a rewrite — verified on a live reversal where the text flipped polarity while the id held — so the id is a sound join key and the rewrite is invisible to any check that only compares code against the current spec." + - id: AC-1a6cb22f + ears: event + condition: "when the base of the range is resolved" + text: "When the base of the range is resolved, then the system shall use the merge base of the given ref and HEAD for both the spec comparison and the changed-file set, so edits made on the base branch itself are not attributed to the range under review." + test_refs: ["tests/report/report-cli.test.ts"] + notes: "WHY: a two-tree compare against a diverged ref reports the base branch's own work as this range's doing. Measured on a live repository, four unrelated features were misattributed this way." + - id: AC-4b6fe145 + ears: unwanted + condition: "if the merge base cannot be computed" + text: "If the merge base cannot be computed, then the system shall fall back to the given ref and still render the packet, rather than failing." + test_refs: ["tests/report/report-cli.test.ts"] + notes: "WHY: CI checks out at depth 1, where merge-base exits non-zero; unrelated histories do the same. Rendering must degrade, not stop." + - id: AC-e68c868a + ears: ubiquitous + text: "The system shall report, for each acceptance criterion, whether each declared test reference also changed within the range, distinguishing a concrete path that did not change from a placeholder reference that names no real test file." + test_refs: ["tests/report/report.test.ts"] + notes: "WHY: a placeholder reference is written by the harness itself as an unconfirmed suggestion; rendering it as an unchanged test would present a harness guess as a reviewed fact. The existing path normalizer already separates the two and must be reused rather than reimplemented." + - id: AC-8e748acb + ears: unwanted + condition: "if the new sections surface a discrepancy" + text: "If the new sections surface a discrepancy, then the system shall leave the report's exit code unchanged and block nothing." + test_refs: ["tests/report/report-cli.test.ts"] + notes: "WHY: the review packet renders and never disposes. Every judgement stays with the reviewer and with the existing gate." + - id: AC-4faef94d + ears: ubiquitous + text: "The system shall order every delta row by acceptance-criterion id and carry no wall-clock value, so two runs over the same repository state produce byte-identical output." + test_refs: ["tests/report/report.test.ts"] + notes: "WHY: the packet is an audit artifact; reproducibility is what makes it citable. Extends the determinism contract the existing report already holds." +design_impact: + classification: additive + rationale: "Extends the existing review-packet verb with two sections computed from data the spec already holds; no new capability, no architecture change, no project-context change. Binds to the harness CLI capability that owns the verb." + status: resolved + artifacts: [] diff --git a/spec/index.yaml b/spec/index.yaml index 90a96aa8..376866d5 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -114,6 +114,7 @@ features: F-284be4f6: {slug: init-empty-layers-valid-yaml, status: done, modules: 1} F-288864ae: {slug: claude-md-diet, status: done, modules: 2} F-2be3e3bb: {slug: infer-depends-on, status: done, modules: 2} + F-2c02991f: {slug: arch-gate-skips-build-output, status: done, modules: 1} F-2de65d: {slug: drive-auto-rollback, status: done, modules: 1} F-2e28cc72: {slug: clad-verdict, status: done, modules: 2} F-315fd7: {slug: scenario-coverage-detector, status: done, modules: 2} @@ -151,6 +152,7 @@ features: F-5b9f9f: {slug: spec-yaml-inventory-and-hints, status: done, modules: 6} F-5cac007a: {slug: init-onboarding-english-source, status: done, modules: 3} F-5d3ed2: {slug: postmortem-on-rollback, status: done, modules: 2} + F-5dfbac9c: {slug: review-packet-ac-delta, status: done, modules: 4} F-5f6b45: {slug: init-path-intent, status: done, modules: 2} F-600272d7: {slug: orchestrator-contract-card, status: done, modules: 2} F-63b989e5: {slug: impact-card-language-parity, status: done, modules: 2} diff --git a/src/agents/planner.md b/src/agents/planner.md index 74a4755f..f3cacac9 100644 --- a/src/agents/planner.md +++ b/src/agents/planner.md @@ -52,7 +52,7 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read ## What you don't do - You do not write production code or tests (`developer` does). - You do not pass philosophical judgement (`reviewer` does). -- You do not silently drop ACs — every removal needs an `archive_reason`. +- You do not silently drop ACs — say why in the criterion's `notes` first. ## EARS reminder diff --git a/src/changelog/collect.ts b/src/changelog/collect.ts index 1ae26625..8dadec98 100644 --- a/src/changelog/collect.ts +++ b/src/changelog/collect.ts @@ -222,6 +222,76 @@ function isFeatureShard(path: string): boolean { return path.startsWith('spec/features/') && (path.endsWith('.yaml') || path.endsWith('.yml')); } +/** One feature spec entry as it stood at both ends of a range (AC-a2278f11). */ +export interface SpecEntryRevision { + /** Repo-relative path of the entry at HEAD (or at the ref, when deleted). */ + readonly path: string; + readonly id: string; + readonly slug?: string; + readonly title: string; + /** Status at the ref; null when the entry was added within the range. */ + readonly statusBefore: string | null; + /** Status at HEAD; null when the entry was deleted within the range. */ + readonly statusAfter: string | null; + readonly baseAcs: readonly AcceptanceCriterion[]; + readonly headAcs: readonly AcceptanceCriterion[]; +} + +/** + * Every feature spec entry the range touched, at BOTH revisions, regardless of + * status — the review packet's input. + * + * WHY this exists alongside classifyShards: that one is a *shipped* filter. It + * keeps only done/archived lifecycle transitions and drops `planned` / + * `in_progress` entries outright, which is right for a changelog and wrong for + * a reviewer. Measured on a live corpus, 74% of a range's touched entries sat + * in those two states — a review packet built on the changelog's population + * would silently omit most of what the range actually did to the spec. + * + * Same cost discipline as its sibling: ONE `git diff --name-status` classifies + * the candidate set, and `git show` runs only for entries that existed at the + * ref. Sorted by id, so callers serialize deterministically. + */ +export function collectSpecEntryRevisions(cwd: string, sinceRef: string): readonly SpecEntryRevision[] { + assertValidRef(cwd, sinceRef); + const raw = git(cwd, ['diff', '--name-status', `${sinceRef}..HEAD`, '--', 'spec/']); + const out: SpecEntryRevision[] = []; + for (const line of raw.split('\n')) { + if (line.trim().length === 0) continue; + const fields = line.split('\t'); + const status = fields[0] ?? ''; + const oldPath = fields[1] ?? ''; + const newPath = fields.length > 2 ? (fields[2] ?? '') : oldPath; + if (!isFeatureShard(newPath) && !isFeatureShard(oldPath)) continue; + + const added = status.startsWith('A'); + const deleted = status.startsWith('D'); + // BOTH sides are revisions. Reading the head from the working tree let an + // uncommitted edit hide a rewrite that IS in the range, or charge the range + // with one it never made — and the same leak reached the status, which + // manufactures the rewrite-plus-done pairing this data exists to surface. + // The candidate set and the co-change column already come from the + // committed diff; this was the odd one out. + const head = added || !deleted ? parseShard(gitShowOrNull(cwd, 'HEAD', newPath)) : null; + const base = added ? null : parseShard(gitShowOrNull(cwd, sinceRef, oldPath)); + const anchor = head ?? base; + if (!anchor) continue; + + out.push({ + path: deleted ? oldPath : newPath, + id: anchor.id, + ...(anchor.slug ? {slug: anchor.slug} : {}), + title: anchor.title, + statusBefore: base ? base.status : null, + statusAfter: head ? head.status : null, + baseAcs: base?.acceptance_criteria ?? [], + headAcs: head?.acceptance_criteria ?? [], + }); + } + out.sort((a, b) => a.id.localeCompare(b.id)); + return out; +} + function toEntry(doc: ShardDoc, change: FeatureChangeKind): ChangelogFeature { const acceptance = (doc.acceptance_criteria ?? []) .map((ac) => acSentence(ac)) diff --git a/src/cli/clad.ts b/src/cli/clad.ts index c8475424..613bf3c7 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -952,6 +952,20 @@ function printStageDetails( const lead = truncate(plainLead(f.detector, f.message), 140); const where = f.path ? ` — ${f.path}` : ''; process.stdout.write(` ${lead}${where} [${f.detector}]\n`); + // The plain lead names the KIND of problem; when it replaced a message + // that carried the specifics, print those too. Without this a developer + // is told "there is an import loop" and never which files form it — the + // gap that cost a real adopter sixteen days and a wrong root cause. + const spoken = plainLead(f.detector, f.message); + if (spoken !== f.message) { + const detail = f.message.split('\n').map((l) => l.trim()).filter((l) => l.length > 0); + for (const line of detail.slice(0, 4)) { + process.stdout.write(` ${truncate(line, 160)}\n`); + } + if (detail.length > 4) { + process.stdout.write(` … and ${detail.length - 4} more line(s) — see \`clad check --json\`\n`); + } + } } if (surface.length > 3) { process.stdout.write(` … and ${surface.length - 3} more finding(s)\n`); @@ -961,9 +975,15 @@ function printStageDetails( return; } if (r.stderr && r.stderr.trim().length > 0) { - const first = r.stderr.split('\n').find((l) => l.trim().length > 0); - if (first) { - process.stdout.write(` ${truncate(first.trim(), 160)}\n`); + // A tool's diagnostic is a LIST — cycles, type errors, lint hits — and one + // line of it is not actionable. Show the head of the list, not its first + // line, and point at --json for the rest. + const lines = r.stderr.split('\n').map((l) => l.trim()).filter((l) => l.length > 0); + for (const line of lines.slice(0, 5)) { + process.stdout.write(` ${truncate(line, 160)}\n`); + } + if (lines.length > 5) { + process.stdout.write(` … and ${lines.length - 5} more line(s) — see \`clad check --json\`\n`); } } } @@ -1076,7 +1096,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.2'); + program.name('clad').description('Reference Ironclad CLI').version('0.9.3'); program .command('init [intent...]') @@ -1252,15 +1272,16 @@ export function createProgram(): Command { program .command('report') .description( - 'Render one deterministic review packet for a git range (F-f6cc5e5a) — 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.', + 'Render one deterministic review packet for a git range (F-f6cc5e5a) — spec entry movement (from the ' + + 'changelog), how each acceptance criterion moved, changed source files resolved to their owning features ' + + 'via the reverse index, the tests those features declare, 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 — one result per error/warn drift ' + + 'md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 — one result per error/warn drift ' + 'finding, for code-scanning UIs) | json (the raw deterministic model)', ) .action((opts: {since?: string; format?: string}) => runReportCommand(opts)); diff --git a/src/cli/report.ts b/src/cli/report.ts index 088111d8..5c70e6b9 100644 --- a/src/cli/report.ts +++ b/src/cli/report.ts @@ -4,7 +4,8 @@ // rendering lives in the pure foundation layer src/report/. It composes, for a // `..HEAD` range: // -// • spec-shard movement — from the changelog collector +// • spec entry movement — from the changelog collector +// • acceptance-criterion deltas — each criterion at both revisions // • changed source → owning feats — each changed file resolved via the // reverse index's blast-radius slice // • the regression set — deduped union of test_refs across slices @@ -18,10 +19,18 @@ // 1 any other failure. import {execFileSync} from 'node:child_process'; +import {existsSync} from 'node:fs'; +import {join} from 'node:path'; import process from 'node:process'; -import {collectChangelog, defaultSinceRef, type ChangelogManifest} from '../changelog/collect.js'; -import {refExists} from '../core/git-ops.js'; +import { + collectChangelog, + collectSpecEntryRevisions, + defaultSinceRef, + type ChangelogManifest, + type SpecEntryRevision, +} from '../changelog/collect.js'; +import {mergeBaseWithHead, refExists, resolveRefToCommit} from '../core/git-ops.js'; import {latestEventOfType} from '../events/log.js'; import {buildImpactSlice, ledgerOf} from '../optimizer/reverse-slice.js'; import { @@ -35,7 +44,7 @@ import { import {toSarif} from '../report/sarif.js'; import {attestedFeatureCount, readAttestation} from '../spec/attestation.js'; import {loadSpec} from '../spec/load.js'; -import {reverseIndexOf} from '../spec/reverse-index.js'; +import {reverseIndexOf, testRefPath} from '../spec/reverse-index.js'; import type {Feature, Spec} from '../spec/types.js'; import {runDrift} from '../stages/drift.js'; import {pulse} from '../ui/pulse.js'; @@ -87,11 +96,11 @@ function assertRefResolves(cwd: string, ref: string): void { } } -/** Changed source files in `..HEAD`, deduped + sorted. Empty on git failure. */ -function changedSourceFiles(cwd: string, sinceRef: string): readonly string[] { +/** Every path that changed in `..HEAD`, deduped + sorted. Empty on git failure. */ +function changedPaths(cwd: string, baseRef: string): readonly string[] { let raw: string; try { - raw = execFileSync('git', ['diff', '--name-only', `${sinceRef}..HEAD`], { + raw = execFileSync('git', ['diff', '--name-only', `${baseRef}..HEAD`], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], @@ -104,12 +113,33 @@ function changedSourceFiles(cwd: string, sinceRef: string): readonly string[] { raw .split('\n') .map((l) => l.trim()) - .filter((l) => l.length > 0) - .filter(isReviewableSourcePath), + .filter((l) => l.length > 0), ), ].sort((a, b) => a.localeCompare(b)); } +/** + * Declared test paths of the touched entries that have no file behind them. + * + * Existence is impure, so it is resolved here and handed to the pure model as + * data. It matters because every sibling existence check in the harness is + * done-only: for a planned or in-progress entry this section is the only place + * a dangling reference is visible at all, and calling it "unchanged" would read + * as a real test that merely did not move. + */ +function absentTestRefs(cwd: string, entries: readonly SpecEntryRevision[]): readonly string[] { + const missing = new Set(); + for (const entry of entries) { + for (const ac of entry.headAcs) { + for (const ref of ac.test_refs ?? []) { + const p = testRefPath(ref); + if (p !== null && !existsSync(join(cwd, p))) missing.add(p); + } + } + } + return [...missing].sort((a, b) => a.localeCompare(b)); +} + /** Resolves an owning-feature id to its title + slug from the spec. */ function ownerOf(id: string, byId: ReadonlyMap): OwningFeature { const f = byId.get(id); @@ -136,21 +166,33 @@ function gatherGateState(cwd: string): GateStateInput { function gatherInputs( cwd: string, spec: Spec, - sinceRef: string, + baseRef: string, manifest: ChangelogManifest, ): ReportInputs { const ri = reverseIndexOf(spec); const ledgerEmpty = ledgerOf(ri).depends_on_edges === 0; const byId = new Map((spec.features ?? []).map((f) => [f.id, f])); - const codeChanges: CodeChangeInput[] = changedSourceFiles(cwd, sinceRef).map((path) => { - const slice = buildImpactSlice(spec, path); - if ('not_found' in slice) return {path, owners: [], testRefs: []}; - const owners = (slice.focus.owners ?? []).map((id) => ownerOf(id, byId)); - return {path, owners, testRefs: slice.test_refs}; - }); + const allChanged = changedPaths(cwd, baseRef); + const codeChanges: CodeChangeInput[] = allChanged + .filter(isReviewableSourcePath) + .map((path) => { + const slice = buildImpactSlice(spec, path); + if ('not_found' in slice) return {path, owners: [], testRefs: []}; + const owners = (slice.focus.owners ?? []).map((id) => ownerOf(id, byId)); + return {path, owners, testRefs: slice.test_refs}; + }); - return {specChanges: manifest, codeChanges, ledgerEmpty, gate: gatherGateState(cwd)}; + const specEntries = collectSpecEntryRevisions(cwd, baseRef); + return { + specChanges: manifest, + codeChanges, + ledgerEmpty, + gate: gatherGateState(cwd), + specEntries, + changedPaths: allChanged, + missingTestRefs: absentTestRefs(cwd, specEntries), + }; } /** Handler for `clad report --since [--format md|sarif|json]`. */ @@ -184,13 +226,26 @@ export function runReportCommand(opts: ReportCommandOptions): void { const {findings} = runDrift({cwd}); out = `${JSON.stringify(toSarif(findings), null, 2)}\n`; } else { - const manifest = collectChangelog(cwd, sinceRef); + // Anchor on the FORK POINT, not the ref's tip (AC-1a6cb22f). Diffing two + // tips charges the base branch's own commits to the range under review; + // on a live repository that misattributed four untouched features. A + // shallow clone (CI checks out at depth 1) has no merge base, so the + // helper falls back to the ref itself and the packet still renders + // (AC-4b6fe145). + const baseRef = mergeBaseWithHead(cwd, sinceRef); + // Disclose the base only when it is a DIFFERENT commit from the one the + // reader named. `resolveRefToCommit` peels annotated tags, so this is a + // commit-to-commit comparison — comparing the ref NAME to a sha would + // announce a difference on every linear range. + const sinceSha = resolveRefToCommit(cwd, sinceRef); + const disclosedBase = sinceSha !== null && sinceSha !== baseRef ? baseRef : undefined; + const manifest = collectChangelog(cwd, baseRef); const spec = loadSpec(cwd); - const model = buildReportModel(gatherInputs(cwd, spec, sinceRef, manifest)); + const model = buildReportModel(gatherInputs(cwd, spec, baseRef, manifest)); out = format === 'json' - ? `${JSON.stringify({since: sinceRef, head: manifest.head, ...model}, null, 2)}\n` - : `${renderReportMarkdown(model, {sinceRef, head: manifest.head})}\n`; + ? `${JSON.stringify({since: sinceRef, base: baseRef, head: manifest.head, ...model}, null, 2)}\n` + : `${renderReportMarkdown(model, {sinceRef, ...(disclosedBase ? {baseSha: disclosedBase} : {}), head: manifest.head})}\n`; } // Set exitCode and let the event loop DRAIN stdout instead of process.exit(): // the packet can exceed the 64KB pipe buffer, and a forced exit truncates a diff --git a/src/core/git-ops.ts b/src/core/git-ops.ts index 33fc4761..add30da4 100644 --- a/src/core/git-ops.ts +++ b/src/core/git-ops.ts @@ -91,3 +91,31 @@ export function resolveRefToCommit(cwd: string, ref: string): string | null { export function refExists(cwd: string, ref: string): boolean { return resolveRefToCommit(cwd, ref) !== null; } + +/** + * Resolves the merge base of `ref` and HEAD — the commit where the branch under + * review actually diverged — falling back to `ref` itself when git cannot + * compute one. + * + * WHY this matters for a review packet: comparing two tips instead of the fork + * point charges the BASE branch's own commits to the range under review. On a + * live repository that misattributed four untouched features as "code changed + * with no spec movement" — the loudest verdict the packet can print. + * + * WHY it must degrade rather than fail: `git merge-base` exits non-zero on a + * shallow clone (CI checks out at depth 1) and on unrelated histories. A packet + * that refuses to render there would be worse than one anchored slightly wide, + * so the raw ref is the fallback and rendering always proceeds. Never throws. + */ +export function mergeBaseWithHead(cwd: string, ref: string): string { + try { + const sha = execFileSync('git', ['merge-base', ref, 'HEAD'], { + cwd, + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'ignore'], + }).trim(); + return sha.length > 0 ? sha : ref; + } catch { + return ref; + } +} diff --git a/src/init/agents-md.ts b/src/init/agents-md.ts index e18d3e0a..8615546b 100644 --- a/src/init/agents-md.ts +++ b/src/init/agents-md.ts @@ -153,6 +153,45 @@ export function renderAgentsMdManagedBlock(spec: Spec | null, cwd: string = '.') 'GREEN). Package test scripts must not depend on shell-expanded glob patterns. Do not', 'author spec entries ahead of their code, or hand-write `status: done`.', '', + '## Writing an acceptance criterion', + '', + 'Each criterion may declare an `ears` pattern. When it does, its `condition` must open', + 'with that pattern\'s trigger word — the gate rejects the entry otherwise:', + '', + '| `ears` | `condition` must | example |', + '|---|---|---|', + '| `ubiquitous` | be omitted — the rule always holds | *(none)* |', + '| `event` | start with **when** | `when the upload completes` |', + '| `state` | start with **while** | `while the queue is draining` |', + '| `optional` | start with **where** | `where telemetry is enabled` |', + '| `unwanted` | start with **if** | `if the checksum does not match` |', + '| `complex` | start with **while** and also contain a **when** clause | `while offline, when a retry fires` |', + '', + 'Write the obligation in `text`, or in the `action` / `response` fields — both are read', + 'as the requirement. Put the reasoning in `notes`; it is free prose and nothing parses it.', + '', + '## What language to write a spec entry in', + '', + 'Default to English. If the spec already has entries, match the language THEY use — the', + 'entries already written are the answer, so nothing needs configuring and nothing can go', + 'stale. Where they disagree, write English. This keeps one repository speaking with one', + 'voice no matter who is at the keyboard; it is a property of the project, not of whoever', + 'you are talking to right now.', + '', + 'If the user asks for another language, write `title`, `notes` and `text` in it. The next', + 'entry then follows by the rule above, so a one-time request carries forward on its own.', + 'Switching language applies to NEW entries; never rewrite existing ones into another', + 'language — those are the project\'s own words.', + '', + 'Four words stay English wherever they appear, because the gate matches them literally and', + 'EARS is a published notation: **when**, **while**, **if**, **where**. Only the FIRST word', + 'of a `condition` is constrained — the rest of the sentence is yours:', + '', + ' condition: "when the app exits" · condition: "when 앱이 종료될 때"', + '', + 'Identifiers are not prose and are never translated: feature and criterion ids, the `ears`', + 'values themselves, and file paths.', + '', '## Design evolves with each feature', '', 'Before implementation, classify the feature as: no design impact, an additive', diff --git a/src/report/ac-delta.ts b/src/report/ac-delta.ts new file mode 100644 index 00000000..94346526 --- /dev/null +++ b/src/report/ac-delta.ts @@ -0,0 +1,181 @@ +// Cladding · report · how the contract itself moved across a range (F-5dfbac9c) +// +// Every drift detector compares code against the spec as it stands NOW. That +// makes one class of change structurally invisible: rewrite an acceptance +// criterion to match what you built, and code and spec agree, so nothing fires. +// The reversal is real, it is in git, and no reviewer will find it by hand — +// it takes a per-criterion diff of two revisions of the same spec entry. +// +// This module is that diff. Given each touched entry at both ends of the range +// it classifies every criterion as new / rewritten / removed / unchanged, and +// reports the entry's status transition alongside — because a criterion +// rewritten in the same motion that marks the feature done is the case that +// most deserves a second look. +// +// Pure: no I/O, no git, no clock. The CLI gathers the two revisions; this +// decides what changed. Rows sort by criterion id so the packet serializes +// byte-identically for a fixed repository state (AC-4faef94d). +// +// Layer: `report` is foundation-tier (spec/architecture.yaml) — it must never +// import stages/drive/cli/serve. + +import type {SpecEntryRevision} from '../changelog/collect.js'; +import type {AcceptanceCriterion} from '../spec/types.js'; + +/** How one acceptance criterion moved across the range. */ +export type AcChangeKind = 'new' | 'rewritten' | 'removed' | 'unchanged'; + +/** One criterion's verdict, plus the EARS pattern shift when it changed. */ +export interface AcDeltaRow { + readonly id: string; + readonly kind: AcChangeKind; + /** EARS pattern at HEAD (at the ref, for a removed criterion). */ + readonly ears?: string; + /** Set only when the EARS pattern itself changed — e.g. `state → unwanted`. */ + readonly earsShift?: string; +} + +/** Every criterion of one spec entry, with the entry's status transition. */ +export interface SpecEntryDelta { + readonly id: string; + readonly title: string; + readonly path: string; + readonly statusBefore: string | null; + readonly statusAfter: string | null; + readonly rows: readonly AcDeltaRow[]; + readonly counts: Readonly>; +} + +/** + * Collapses runs of whitespace and trims, so reflowing a criterion across + * lines — or fixing a stray double space — never reads as a rewrite. This is + * the "whitespace-only differences are ignored" half of AC-c32cbab2. + */ +function norm(value: string | undefined): string { + return (value ?? '').replace(/\s+/g, ' ').trim(); +} + +/** + * Field separator for the comparison key — a character that cannot occur inside + * any authored field, so a statement ending where the next field begins can never + * make two different contracts read alike. Written as an escape: a raw control + * byte in source would make git treat the file as binary. + */ +const FIELD_SEPARATOR = '\u0000'; + +/** + * The comparison key for a criterion: every field that states the obligation — + * the pre-rendered statement, the EARS pattern, and the structured trigger / + * action / outcome. + * + * `action` and `response` are not decoration. The impl-blind oracle renders + * `action` as "system shall:" (src/oracle/payload.ts), and AC_DRIFT accepts a + * criterion carrying only these fields as fully specified — so a criterion may + * have no `text` at all and still state a complete requirement. Comparing only + * text/ears/condition made this section blind to a rewrite of the obligation + * itself, which is precisely the change it exists to surface. + * + * `notes` stays EXCLUDED — it is the free-prose field authors actually use, and + * treating an expanded rationale as a contract rewrite would make the signal + * fire on the one habit worth encouraging. + */ +function contractKey(ac: AcceptanceCriterion): string { + return [ + norm(ac.text), + norm(ac.ears), + norm(ac.condition), + norm(ac.action), + norm(ac.response), + ].join(FIELD_SEPARATOR); +} + +/** + * Groups criteria by id in DOCUMENT order, keeping every occurrence. + * + * A duplicate id is invalid and the strict gate says so — but this renderer + * gates nothing, so it runs precisely in the window before green. Keeping only + * the first occurrence let a rewrite of a later duplicate report "unchanged" + * while the same packet's spec-changes section printed the new text. + */ +function byId(acs: readonly AcceptanceCriterion[]): Map { + const map = new Map(); + for (const ac of acs) { + if (!ac.id) continue; + const group = map.get(ac.id); + if (group) group.push(ac); + else map.set(ac.id, [ac]); + } + return map; +} + +/** + * Classifies one spec entry's criteria across the range. + * + * The join key is the criterion id, which survives a rewrite: on the live + * reversal that motivated this feature the text flipped polarity + * (`shall run kill-server` → `shall never issue kill-server`) and the EARS + * pattern went `state → unwanted` while the id held. That is exactly the case + * a text-similarity join would miss and an id join catches. + */ +function deltaOf(entry: SpecEntryRevision): SpecEntryDelta { + const base = byId(entry.baseAcs); + const head = byId(entry.headAcs); + const rows: AcDeltaRow[] = []; + + // Occurrences pair positionally: the k-th at head against the k-th at base. + // Surplus on either side is a genuine addition or removal. + for (const [id, group] of head) { + const wasGroup = base.get(id) ?? []; + for (const [k, ac] of group.entries()) { + const was = wasGroup[k]; + if (!was) { + rows.push({id, kind: 'new', ...(ac.ears ? {ears: ac.ears} : {})}); + continue; + } + if (contractKey(ac) === contractKey(was)) { + rows.push({id, kind: 'unchanged', ...(ac.ears ? {ears: ac.ears} : {})}); + continue; + } + const shifted = norm(ac.ears) !== norm(was.ears); + rows.push({ + id, + kind: 'rewritten', + ...(ac.ears ? {ears: ac.ears} : {}), + ...(shifted ? {earsShift: `${was.ears ?? '(none)'} → ${ac.ears ?? '(none)'}`} : {}), + }); + } + } + + for (const [id, group] of base) { + const headCount = head.get(id)?.length ?? 0; + for (const ac of group.slice(headCount)) { + rows.push({id, kind: 'removed', ...(ac.ears ? {ears: ac.ears} : {})}); + } + } + + rows.sort((a, b) => a.id.localeCompare(b.id)); + + const counts: Record = {new: 0, rewritten: 0, removed: 0, unchanged: 0}; + for (const r of rows) counts[r.kind] += 1; + + return { + id: entry.id, + title: entry.title, + path: entry.path, + statusBefore: entry.statusBefore, + statusAfter: entry.statusAfter, + rows, + counts, + }; +} + +/** + * Builds the per-entry criterion deltas for a range, sorted by feature id. + * Entries whose criteria are ALL unchanged are kept: a reviewer reading + * "8 unchanged" learns something different from an entry that is simply absent. + */ +export function buildSpecEntryDeltas( + entries: readonly SpecEntryRevision[], +): readonly SpecEntryDelta[] { + return entries.map(deltaOf).sort((a, b) => a.id.localeCompare(b.id)); +} diff --git a/src/report/report.ts b/src/report/report.ts index 25f7f8e1..a630aa03 100644 --- a/src/report/report.ts +++ b/src/report/report.ts @@ -3,7 +3,7 @@ // A reviewer, team-lead, or auditor opening a pull request wants ONE artifact // that answers "what moved, who owns it, what must I re-run, and was it // verified?" — without walking the spec tree. This module renders that packet -// from data the CLI composes: the changelog collector's spec-shard movement, +// from data the CLI composes: the changelog collector's spec entry movement, // each changed source file resolved to its owning feature(s) via the reverse // index, the deduped regression set (union of test_refs across the impact // slices), and the gate + attestation state. @@ -11,9 +11,9 @@ // It RENDERS; it gates nothing. The gate stays in `clad check`. // // DETERMINISM (AC-cbf1c202): every collection is sorted, and the body carries -// NO wall-clock — the meta range + HEAD sha are the only variable inputs and -// they are stable for a fixed repository state, so two runs serialize -// byte-identically. That is the property that makes the packet auditable. +// NO wall-clock — the meta range, the resolved base and the HEAD sha are the +// only variable inputs, and all three are stable for a fixed repository state, +// so two runs serialize byte-identically. That is what makes the packet auditable. // // HONEST UNDER-REPORTING (AC-7672ce5d): a changed source file that maps to no // feature's `modules` is listed under Unowned changes, never silently dropped — @@ -27,7 +27,10 @@ // no stage runners. The CLI verb (src/cli/report.ts) is the thin impure wrapper // that gathers git/spec/detector state and feeds this renderer. -import type {ChangelogManifest} from '../changelog/collect.js'; +import type {ChangelogManifest, SpecEntryRevision} from '../changelog/collect.js'; +import {testRefPath} from '../spec/reverse-index.js'; + +import {buildSpecEntryDeltas, type SpecEntryDelta} from './ac-delta.js'; /** A feature that owns a changed file — id + title, plus slug for shard lookup. */ export interface OwningFeature { @@ -58,6 +61,25 @@ export interface GateStateInput { } | null; } +/** + * Whether an acceptance criterion's declared test moved with the code. + * + * `missing` is separate from `unchanged` on purpose: a path with no file behind + * it did not "stay put", it was never there. Every sibling existence check in + * the harness is done-only, so this status-blind section is the only surface + * that speaks for planned and in-progress entries. + */ +export type TestRefState = 'co-changed' | 'unchanged' | 'missing' | 'placeholder'; + +/** One declared test reference of one criterion, and how it fared in the range. */ +export interface TestRefRow { + readonly featureId: string; + readonly acId: string; + /** The reference as authored (anchor included) — what the reviewer must find. */ + readonly ref: string; + readonly state: TestRefState; +} + /** Everything the pure model needs — the CLI composes it impurely. */ export interface ReportInputs { readonly specChanges: ChangelogManifest; @@ -65,6 +87,12 @@ export interface ReportInputs { /** True when the project declares zero depends_on edges (blank ledger). */ readonly ledgerEmpty: boolean; readonly gate: GateStateInput; + /** Every feature spec entry the range touched, at both revisions. */ + readonly specEntries?: readonly SpecEntryRevision[]; + /** Every path that changed in the range — the co-change oracle. */ + readonly changedPaths?: readonly string[]; + /** Declared test paths with no file on disk; the CLI resolves existence. */ + readonly missingTestRefs?: readonly string[]; } /** The deterministic, fully-sorted review-packet model. */ @@ -78,6 +106,10 @@ export interface ReportModel { readonly regressionSet: readonly string[]; readonly ledgerEmpty: boolean; readonly gate: GateStateInput; + /** Per-entry acceptance-criterion movement, sorted by feature id. */ + readonly specEntryDeltas: readonly SpecEntryDelta[]; + /** Declared tests of the touched entries, with their co-change state. */ + readonly testRefRows: readonly TestRefRow[]; } /** Stable identifiers stamped into the header — the range + HEAD for a fixed state. */ @@ -85,6 +117,16 @@ export interface ReportMeta { readonly sinceRef: string; /** Full HEAD sha (from `git rev-parse HEAD`); deterministic for a fixed state. */ readonly head: string; + /** + * The commit the packet compared against, set ONLY when it differs from the + * commit `sinceRef` names — the CLI resolves both and decides, because only + * it can peel a ref to a sha (an annotated tag is not its own commit). + * + * When present it is rendered: an audit artifact that silently audited a + * different revision than the reader asked for cannot be reproduced by hand. + * When absent the two are the same commit and there is nothing to disclose. + */ + readonly baseSha?: string; } /** Human-readable label for a changelog change kind. */ @@ -113,6 +155,48 @@ function normalizeOwners(owners: readonly OwningFeature[]): readonly OwningFeatu * changed files into owned / unowned, sorts everything, and computes the * deduped regression set. Pure — no I/O, no clock. */ +/** + * Resolves each declared test reference of the touched entries to one of four + * states. + * + * The third state is load-bearing. `clad sync` writes `derived:` refs into + * spec entries as unconfirmed suggestions; rendering one as "declared but did + * not change" would present a harness guess as a reviewed fact. The shared + * normalizer (src/spec/reverse-index.ts) is what tells the two apart — the same + * rule the citation index uses, so the packet and the index can never disagree. + */ +function buildTestRefRows( + entries: readonly SpecEntryRevision[], + changed: ReadonlySet, + missing: ReadonlySet, +): readonly TestRefRow[] { + const rows: TestRefRow[] = []; + for (const entry of entries) { + for (const ac of entry.headAcs) { + for (const ref of ac.test_refs ?? []) { + const path = testRefPath(ref); + // Existence first: a path that resolves to nothing cannot have moved, + // and calling it co-changed or unchanged both overstate what is known. + const state: TestRefState = + path === null + ? 'placeholder' + : missing.has(path) + ? 'missing' + : changed.has(path) + ? 'co-changed' + : 'unchanged'; + rows.push({featureId: entry.id, acId: ac.id, ref, state}); + } + } + } + return rows.sort( + (a, b) => + a.featureId.localeCompare(b.featureId) || + a.acId.localeCompare(b.acId) || + a.ref.localeCompare(b.ref), + ); +} + export function buildReportModel(inputs: ReportInputs): ReportModel { const withOwners = inputs.codeChanges.map((c) => ({...c, owners: normalizeOwners(c.owners)})); @@ -129,6 +213,9 @@ export function buildReportModel(inputs: ReportInputs): ReportModel { ...new Set(inputs.codeChanges.flatMap((c) => c.testRefs)), ].sort((a, b) => a.localeCompare(b)); + const specEntries = inputs.specEntries ?? []; + const changed = new Set(inputs.changedPaths ?? []); + return { specChanges: inputs.specChanges, codeChanges, @@ -136,6 +223,8 @@ export function buildReportModel(inputs: ReportInputs): ReportModel { regressionSet, ledgerEmpty: inputs.ledgerEmpty, gate: inputs.gate, + specEntryDeltas: buildSpecEntryDeltas(specEntries), + testRefRows: buildTestRefRows(specEntries, changed, new Set(inputs.missingTestRefs ?? [])), }; } @@ -204,6 +293,84 @@ function renderRegressionSet(model: ReportModel): string { return lines.join('\n'); } +/** `planned → done`, or a bare status when the entry only existed at one end. */ +function statusTransition(d: SpecEntryDelta): string { + if (d.statusBefore === null) return `added as ${d.statusAfter ?? 'unknown'}`; + if (d.statusAfter === null) return `was ${d.statusBefore}, now deleted`; + return d.statusBefore === d.statusAfter + ? d.statusAfter + : `${d.statusBefore} → ${d.statusAfter}`; +} + +/** + * Renders the "## How the acceptance criteria moved" section — the answer to + * "did the requirement change, or did the code?" that no drift detector can + * give, because detectors only ever see the spec as it stands now. + */ +function renderSpecEntryDeltas(model: ReportModel): string { + const lines: string[] = ['## How the acceptance criteria moved']; + if (model.specEntryDeltas.length === 0) { + lines.push('', '_No feature spec entry changed in this range._'); + return lines.join('\n'); + } + lines.push( + '', + '_Each criterion compared against its own earlier revision, matched by id. A rewrite is invisible to every drift check if the code was changed to match it._', + ); + for (const d of model.specEntryDeltas) { + const c = d.counts; + lines.push('', `### "${d.title}" (${d.id}) — ${statusTransition(d)}`, ''); + lines.push( + `- new ${c.new} · rewritten ${c.rewritten} · removed ${c.removed} · unchanged ${c.unchanged}`, + ); + for (const r of d.rows) { + if (r.kind === 'unchanged') continue; + const shift = r.earsShift ? ` — pattern ${r.earsShift}` : ''; + lines.push(`- ${r.kind.toUpperCase()} ${r.id}${shift}`); + } + } + return lines.join('\n'); +} + +/** + * Renders the "## Declared tests" section: for every criterion of a touched + * entry, whether the test it names also moved in this range. + * + * It grades nothing. Whether a test genuinely verifies its criterion is not + * mechanically decidable — three separate rules were measured against real + * corpora and each misfired on legitimate code — so the packet shows what was + * declared and leaves the judgement with the reviewer. + */ +function renderTestRefs(model: ReportModel): string { + const lines: string[] = ['## Declared tests']; + if (model.testRefRows.length === 0) { + lines.push('', '_No touched entry declares a test._'); + return lines.join('\n'); + } + lines.push( + '', + '_`changed` = the named file also moved in this range. `unchanged` = declared, untouched. `absent` = a concrete path with no file behind it. `no file` = a placeholder the harness suggested, not a test that exists._', + '', + ); + let current = ''; + for (const row of model.testRefRows) { + if (row.featureId !== current) { + current = row.featureId; + lines.push(`- ${row.featureId}`); + } + const label = + row.state === 'co-changed' + ? 'changed' + : row.state === 'unchanged' + ? 'unchanged' + : row.state === 'missing' + ? 'absent' + : 'no file'; + lines.push(` - ${row.acId} · ${row.ref} — ${label}`); + } + return lines.join('\n'); +} + /** Renders the "## Gate & attestation" section. */ function renderGate(gate: GateStateInput): string { const lines: string[] = ['## Gate & attestation', '']; @@ -231,19 +398,30 @@ function renderGate(gate: GateStateInput): string { } /** - * Renders the full four-section markdown packet. Deterministic: the only + * Renders the full six-section markdown packet. Deterministic: the only * variable inputs are `meta.sinceRef` + `meta.head`, both stable for a fixed * repository state — so two runs produce byte-identical output. */ export function renderReportMarkdown(model: ReportModel, meta: ReportMeta): string { const shortHead = meta.head.slice(0, 12); + // Present iff the CLI resolved a base that is NOT the commit `sinceRef` + // names. Comparing here is impossible: a ref name and a sha are different + // kinds of thing, and only git can tell whether they denote the same commit. + const base = meta.baseSha + ? [`_Compared against ${meta.baseSha.slice(0, 12)} — the merge base of ${meta.sinceRef} and HEAD._`, ''] + : []; return [ `# Review packet — ${meta.sinceRef}..${shortHead}`, '', + ...base, renderSpecChanges(model.specChanges), '', + renderSpecEntryDeltas(model), + '', renderCodeChanges(model), '', + renderTestRefs(model), + '', renderRegressionSet(model), '', renderGate(model.gate), diff --git a/src/serve/server.ts b/src/serve/server.ts index c340949a..c8930933 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.2', + version: opts.version ?? '0.9.3', }, { instructions: diff --git a/src/spec/reverse-index.ts b/src/spec/reverse-index.ts index 1cc594e4..daced8f9 100644 --- a/src/spec/reverse-index.ts +++ b/src/spec/reverse-index.ts @@ -46,8 +46,13 @@ const PSEUDO_REF_PREFIXES = ['derived:', 'fixture:', 'script:', 'self-dogfood:'] * Normalises a test_ref to its file path, or null when it is a pseudo-ref. * Real refs look like `tests/foo.test.ts#a test name` — the `#anchor` (the * vitest test title) is dropped so all refs to the same file collapse to one key. + * + * Exported as the single normalizer every consumer shares: the review packet + * needs the same pseudo-ref/anchor handling to tell "a declared test that did + * not change" apart from "no real test declared at all", and a second private + * copy of this rule would drift from the citation index it must agree with. */ -function testRefPath(ref: string): string | null { +export function testRefPath(ref: string): string | null { for (const prefix of PSEUDO_REF_PREFIXES) { if (ref.startsWith(prefix)) return null; } diff --git a/src/stages/toolchain/detect.ts b/src/stages/toolchain/detect.ts index a52a3a5b..b8832763 100644 --- a/src/stages/toolchain/detect.ts +++ b/src/stages/toolchain/detect.ts @@ -11,9 +11,10 @@ // This is the polyglot adapter: cladding itself stays language-agnostic; // the *user project* decides which language tools run. -import {existsSync, readFileSync, readdirSync} from 'node:fs'; +import {existsSync, readFileSync, readdirSync, statSync} from 'node:fs'; import type {Dirent} from 'node:fs'; -import {join} from 'node:path'; +import {dirname, join, resolve} from 'node:path'; +import process from 'node:process'; import {kotlinCoverageTask} from './coverage-tool.js'; import type {Language, Toolchain, ToolchainGates, ToolSpec} from './types.js'; @@ -46,6 +47,7 @@ interface PackageManifest { readonly peerDependencies?: Readonly>; readonly eslintConfig?: unknown; readonly jest?: unknown; + readonly madge?: unknown; } /** npx must resolve only already-installed/cacheable tools and never touch the network. */ @@ -364,10 +366,155 @@ const ESLINT_CONFIGS: readonly string[] = [ '.eslintrc.yml', ]; -/** Reads package.json once for gate refinement; malformed input declares nothing. */ +/** + * Generated build output, excluded from the circular-dependency scan (AC-caa9471d). + * + * A bundler's output legitimately contains mutual imports — that is what bundling + * produces — so scanning it reports cycles that exist in no hand-written file. On one + * adopter this blocked the gate five times, every one of them inside a version-ignored + * bundle; the recorded root cause was wrong and the issue stayed open for sixteen days. + * + * Two anchorings, because the names differ in how ambiguous they are: + * + * - `dist`, `coverage` and the framework caches are excluded at ANY depth. A + * monorepo package or a front-end subdirectory keeps its bundle one level down + * (`frontend/dist`), and a root-only anchor left exactly those still blocking + * the gate. No repository on hand commits hand-written source under these names. + * - `build`, `out` and `target` stay anchored at the repository root: they DO name + * real source directories often enough (`src/build/…`) that excluding them at + * depth would silently drop hand-written code from the scan — a false negative, + * which is the one outcome worse than a false RED. + */ +const BUILD_OUTPUT_EXCLUDE = + '(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/'; + +/** + * Every path madge's config loader consults, in its own order. + * + * Read off `rc` (madge/bin/cli.js:7) rather than assumed: `/etc/madge/config` + * and `/etc/madgerc` on POSIX, four `$HOME` locations, then the EXACT name + * `.madgerc` walked upward from cwd to the filesystem root. Only that one + * filename is ever read — `.madgerc.json` / `.js` / `.yaml` are not madge + * config at all, and treating them as such silently disabled the exclusion. + */ +function madgeConfigPaths(cwd: string): readonly string[] { + const paths: string[] = []; + const win = process.platform === 'win32'; + if (!win) paths.push(join('/etc', 'madge', 'config'), join('/etc', 'madgerc')); + const home = win ? process.env.USERPROFILE : process.env.HOME; + if (home) { + paths.push( + join(home, '.config', 'madge', 'config'), + join(home, '.config', 'madge'), + join(home, '.madge', 'config'), + join(home, '.madgerc'), + ); + } + // The upward walk is the half a cwd-only check misses — and missing it is the + // damaging direction: we would send `--exclude`, madge would REPLACE the + // user's rules with ours, and cycles they had suppressed would block the gate. + for (let dir = resolve(cwd); ; ) { + paths.push(join(dir, '.madgerc')); + const parent = dirname(dir); + if (parent === dir) break; + dir = parent; + } + const envConfig = process.env.MADGE_config ?? process.env.madge_config; + if (envConfig) paths.push(envConfig); + return paths; +} + +/** + * True when the environment itself sets madge's exclusion. + * + * `rc` folds any `madge_*` variable into the config (case-insensitively), so + * `madge_excludeRegExp=^vendor/` is a live rule with no file behind it. Missing + * it is the damaging direction: cladding would send its own `--exclude`, which + * REPLACES rather than merges, and the user's rule would vanish. + */ +function envDeclaresMadgeExclude(): boolean { + for (const [key, value] of Object.entries(process.env)) { + if (!/^madge_excluderegexp/i.test(key)) continue; + if (typeof value === 'string' && value.trim().length > 0) return true; + } + return false; +} + +/** + * True when this config file actually puts an exclusion in force. + * + * Presence is not enough, and neither is the key: an empty `.madgerc`, one + * carrying only `detectiveOptions` (madge's own README recipe), and one whose + * `excludeRegExp` is `[]`, `null`, `""` or `false` all configure no exclusion — + * standing down for any of them leaves build output blocking the gate while + * cladding believes the project has it handled. + * + * So the test is the EFFECTIVE value, read the way rc reads the file: JSON + * first, ini second. Only an unreadable file returns true unconditionally. + */ +function hasEffectiveExclude(value: unknown): boolean { + if (Array.isArray(value)) return value.length > 0; + return typeof value === 'string' && value.trim().length > 0; +} + +/** + * A light `excludeRegExp` probe for the ini form rc also accepts. Deliberately + * narrow — one key, `name = value` or `name[] = value` — because the only + * question is whether a non-empty value is set, and pulling in a full ini + * parser to answer it would be more surface than the answer is worth. + */ +const INI_EXCLUDE = /^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m; + +/** True only for an existing regular file — a directory carries no config. */ +function isFile(p: string): boolean { + try { + return statSync(p).isFile(); + } catch { + return false; + } +} + +function declaresMadgeExclude(file: string): boolean { + let body: string; + try { + body = readFileSync(file, 'utf8'); + } catch { + // Present but unreadable: we cannot tell, so leave the project alone. + return true; + } + try { + return hasEffectiveExclude((JSON.parse(body) as {excludeRegExp?: unknown}).excludeRegExp); + } catch { + // Not JSON. rc also reads ini, so look for the key there before concluding + // anything — a file we cannot read as either sets no exclusion, exactly as + // it sets none for madge. + return INI_EXCLUDE.test(body); + } +} + +/** True when the project itself has a madge exclusion in force. */ +function madgeExclusionInForce(cwd: string, pkg: PackageManifest): boolean { + // `package.json#madge` is read from cwd only (madge/bin/cli.js:63) — no walk. + const inline = pkg.madge as {excludeRegExp?: unknown} | undefined; + if (inline && typeof inline === 'object' && hasEffectiveExclude(inline.excludeRegExp)) return true; + if (envDeclaresMadgeExclude()) return true; + // A path that is a DIRECTORY is not a config: rc's walk stops there and reads + // nothing, so no exclusion is in force and our default should still apply. + return madgeConfigPaths(cwd).some((p) => isFile(p) && declaresMadgeExclude(p)); +} + +/** + * Reads package.json once for gate refinement; malformed input declares nothing. + * + * The BOM strip is not cosmetic: madge reads this file with `require()`, which + * tolerates a byte-order mark, while `JSON.parse` throws on it. Without this, + * a BOM'd manifest made cladding blind to a `madge` block madge itself honours + * — and since madge REPLACES exclusions rather than merging them, cladding + * would then delete the user's rule. + */ function readPackageManifest(cwd: string): PackageManifest { try { - return JSON.parse(readFileSync(join(cwd, 'package.json'), 'utf8')) as PackageManifest; + return JSON.parse(readFileSync(join(cwd, 'package.json'), 'utf8').replace(/^\uFEFF/, '')) as PackageManifest; } catch { return {}; } @@ -385,6 +532,35 @@ function hasPackageDependency(pkg: PackageManifest, name: string): boolean { .some((group) => group?.[name] !== undefined); } +/** + * The TS/JS architecture gate, with build output excluded unless the project + * configures the scanner itself (AC-caa9471d, AC-554d9436). + * + * The guard is not politeness — madge REPLACES its configured `excludeRegExp` + * with the command-line flag rather than merging the two (madge/bin/cli.js:97). + * Passing ours unconditionally would silently delete an adopter's own rules, + * including the workaround one adopter is currently relying on. When they have + * an exclusion in force we stay out of the way; otherwise we supply the default. + * + * "In force" is decided by CONTENT and over madge's WHOLE search path, not by a + * filename in cwd: the loader walks `.madgerc` up to the filesystem root and + * reads `$HOME` and `/etc` too, so a cwd-only check would send `--exclude` to a + * user whose rules live one directory up and turn their green gate red. + * + * The scan ROOT is deliberately left at `.` (AC-c04171bd): narrowing it to a + * named source directory was measured to be worse than the defect it fixes — + * a missing root makes madge exit with ENOENT, which classifies as a scanner + * setup gap (advisory), so the whole stage skips and the gate goes green having + * checked nothing. + */ +function resolveTsArch(cwd: string, base: ToolSpec, pkg: PackageManifest): ToolSpec { + if (madgeExclusionInForce(cwd, pkg)) return base; + const args = [...base.args]; + // Before the trailing scan root, so the root stays last as madge expects. + args.splice(args.length - 1, 0, '--exclude', BUILD_OUTPUT_EXCLUDE); + return {...base, args}; +} + /** The project's declared TS/JS lint gate, or undefined when lint is unconfigured. */ function resolveTsLint(cwd: string, eslintDefault: ToolSpec, pkg: PackageManifest): ToolSpec | undefined { if (packageScript(pkg, 'lint')) return {cmd: 'npm', args: ['run', '--silent', 'lint']}; @@ -455,7 +631,10 @@ function withoutGate(base: ToolchainGates, gate: 'lint' | 'coverage'): Toolchain function resolveTsGates(cwd: string, base: ToolchainGates): ToolchainGates { const pkg = readPackageManifest(cwd); const lint = base.lint ? resolveTsLint(cwd, base.lint, pkg) : undefined; - let out: ToolchainGates = lint ? {...base, lint} : withoutGate(base, 'lint'); + const withArch: ToolchainGates = base.arch + ? {...base, arch: resolveTsArch(cwd, base.arch, pkg)} + : base; + let out: ToolchainGates = lint ? {...withArch, lint} : withoutGate(withArch, 'lint'); const testScript = packageScript(pkg, 'test'); const runner = testScript ? simpleTestRunner(testScript) : undefined; diff --git a/src/stages/util.ts b/src/stages/util.ts index b0fec62d..2a45968c 100644 --- a/src/stages/util.ts +++ b/src/stages/util.ts @@ -65,7 +65,14 @@ export function classifyScannerExit( if (exitCode === 0) return []; const stderr = (proc.stderr ?? '').toString().trim(); const stdout = (proc.stdout ?? '').toString().trim(); - const detail = (stderr || stdout || `exit ${exitCode}`).slice(0, 200); + // BOTH streams, report first. Scanners print their findings to stdout and + // their progress to stderr — madge writes "- Finding files" to stderr and the + // numbered cycle list to stdout — so taking stderr first handed the developer + // a progress line and threw the answer away. A real adopter spent sixteen + // days on that and recorded the wrong cause. The budget is generous because + // the whole point is the list: one cycle per line, and a truncated list is a + // half-answer that still cannot be acted on. + const detail = [stdout, stderr].filter((s) => s.length > 0).join('\n').slice(0, 2000) || `exit ${exitCode}`; if (SCANNER_SETUP_FAILURE.test(stderr) || SCANNER_SETUP_FAILURE.test(stdout)) { return [{detector, severity: 'info', message: skippedMsg(detail)}]; } @@ -136,8 +143,11 @@ export function missingToolSkip( * only ever mean "skipped". Routing every command stage through here makes that * invariant structural rather than per-stage discipline. * - * Diagnostics: surfaces stderr, falling back to stdout — `tsc` writes its - * diagnostics to stdout, not stderr, so a failing gate still shows WHY. + * Diagnostics: BOTH streams, report first. `tsc` writes its diagnostics to + * stdout; madge writes its cycle list to stdout and only its progress to + * stderr. Preferring stderr therefore surfaced "Processed 9 files (259ms)" and + * discarded the answer — the gap that left a real adopter unable to tell WHICH + * files formed the loop. * * @param stage - Ironclad stage id for the result. * @param proc - The value returned by `execaSync(…, {reject: false})`. @@ -148,7 +158,9 @@ export function ranToolResult( ): StageResult { const ran = proc.exitCode ?? 1; if (ran === 0) return {stage, pass: true, exitCode: 0}; - const detail = String(proc.stderr ?? '').trim() || String(proc.stdout ?? '').trim(); + const detail = [String(proc.stdout ?? '').trim(), String(proc.stderr ?? '').trim()] + .filter((s) => s.length > 0) + .join('\n'); return detail ? {stage, pass: false, exitCode: 1, stderr: detail} : {stage, pass: false, exitCode: 1}; diff --git a/tests/changelog/collect.test.ts b/tests/changelog/collect.test.ts index e0ed900a..72bab1b9 100644 --- a/tests/changelog/collect.test.ts +++ b/tests/changelog/collect.test.ts @@ -16,7 +16,7 @@ import {tmpdir} from 'node:os'; import {join} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; -import {collectChangelog, defaultSinceRef} from '../../src/changelog/collect.js'; +import {collectChangelog, collectSpecEntryRevisions, defaultSinceRef} from '../../src/changelog/collect.js'; function git(dir: string, args: readonly string[]): string { return execFileSync('git', [...args], {cwd: dir, encoding: 'utf8'}); @@ -208,3 +208,188 @@ describe('changelog/collect', () => { } }); }); + +describe('AC-a2278f11 · every touched spec entry, regardless of status', () => { + let dir: string; + + /** A spec entry with an arbitrary criterion list — the shard() helper pins one AC. */ + function entryWith( + file: string, + id: string, + status: string, + acs: readonly {id: string; text: string; ears?: string}[], + ): void { + writeFileSync( + join(dir, 'spec', 'features', file), + [ + `id: ${id}`, + `slug: ${file.replace(/-[a-f0-9]+\.yaml$/, '')}`, + `title: "Entry ${id}"`, + `status: ${status}`, + 'acceptance_criteria:', + ...acs.flatMap((a) => [ + ` - id: ${a.id}`, + ` ears: ${a.ears ?? 'ubiquitous'}`, + ` text: "${a.text}"`, + ]), + '', + ].join('\n'), + ); + } + + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-entryrev-')); + initRepo(dir); + mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); + specYaml(dir, 2); + entryWith('still-planned-aaa001.yaml', 'F-aaa001', 'planned', [ + {id: 'AC-000001', text: 'The system shall hold the original promise.'}, + ]); + entryWith('goes-done-bbb002.yaml', 'F-bbb002', 'planned', [ + {id: 'AC-000002', text: 'The system shall always run the cleanup.', ears: 'state'}, + ]); + commitAll(dir, 'baseline'); + git(dir, ['tag', 'v0']); + }); + + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + test('an entry that stays planned is carried, though the changelog drops it', () => { + entryWith('still-planned-aaa001.yaml', 'F-aaa001', 'planned', [ + {id: 'AC-000001', text: 'The system shall hold a REVISED promise.'}, + ]); + commitAll(dir, 'refine while planned'); + + // The changelog is a shipped-changes filter: no lifecycle transition, no entry. + const shipped = collectChangelog(dir, 'v0').groups.flatMap((g) => g.features).map((f) => f.id); + expect(shipped).not.toContain('F-aaa001'); + + // The review packet's population must still see it. + const revs = collectSpecEntryRevisions(dir, 'v0'); + expect(revs.map((r) => r.id)).toContain('F-aaa001'); + }); + + test('both revisions of the criteria come back, so a rewrite is computable', () => { + entryWith('goes-done-bbb002.yaml', 'F-bbb002', 'done', [ + {id: 'AC-000002', text: 'The system shall never run the cleanup.', ears: 'unwanted'}, + ]); + commitAll(dir, 'flip the contract and mark done'); + + const rev = collectSpecEntryRevisions(dir, 'v0').find((r) => r.id === 'F-bbb002'); + expect(rev?.statusBefore).toBe('planned'); + expect(rev?.statusAfter).toBe('done'); + expect(rev?.baseAcs[0]?.text).toContain('always run the cleanup'); + expect(rev?.headAcs[0]?.text).toContain('never run the cleanup'); + expect(rev?.baseAcs[0]?.ears).toBe('state'); + expect(rev?.headAcs[0]?.ears).toBe('unwanted'); + }); + + test('an entry added within the range has no base revision', () => { + entryWith('fresh-ccc003.yaml', 'F-ccc003', 'in_progress', [ + {id: 'AC-000003', text: 'The system shall be new here.'}, + ]); + commitAll(dir, 'add an entry'); + + const rev = collectSpecEntryRevisions(dir, 'v0').find((r) => r.id === 'F-ccc003'); + expect(rev?.statusBefore).toBeNull(); + expect(rev?.baseAcs).toEqual([]); + expect(rev?.headAcs).toHaveLength(1); + }); + + test('a deleted entry keeps its base revision and reports no head status', () => { + rmSync(join(dir, 'spec', 'features', 'still-planned-aaa001.yaml')); + commitAll(dir, 'remove an entry'); + + const rev = collectSpecEntryRevisions(dir, 'v0').find((r) => r.id === 'F-aaa001'); + expect(rev?.statusAfter).toBeNull(); + expect(rev?.baseAcs).toHaveLength(1); + expect(rev?.headAcs).toEqual([]); + }); + + test('an untouched entry is absent — the range, not the whole spec', () => { + entryWith('goes-done-bbb002.yaml', 'F-bbb002', 'done', [ + {id: 'AC-000002', text: 'The system shall always run the cleanup.', ears: 'state'}, + ]); + commitAll(dir, 'touch only one entry'); + + expect(collectSpecEntryRevisions(dir, 'v0').map((r) => r.id)).toEqual(['F-bbb002']); + }); + + test('results sort by feature id and repeat byte-identically', () => { + entryWith('zeta-zzz009.yaml', 'F-zzz009', 'planned', [{id: 'AC-000009', text: 'Z.'}]); + entryWith('still-planned-aaa001.yaml', 'F-aaa001', 'in_progress', [ + {id: 'AC-000001', text: 'The system shall hold the original promise.'}, + ]); + commitAll(dir, 'two entries'); + + const once = collectSpecEntryRevisions(dir, 'v0'); + expect(once.map((r) => r.id)).toEqual(['F-aaa001', 'F-zzz009']); + expect(JSON.stringify(once)).toBe(JSON.stringify(collectSpecEntryRevisions(dir, 'v0'))); + }); + + test('an unresolvable ref is an error, never a silently empty population', () => { + expect(() => collectSpecEntryRevisions(dir, 'no-such-ref')).toThrow(/does not resolve/); + }); +}); + +describe('AC-a2278f11 · both sides are REVISIONS, not the working tree', () => { + let dir: string; + + function entry(file: string, id: string, status: string, text: string): void { + writeFileSync( + join(dir, 'spec', 'features', file), + [ + `id: ${id}`, + 'slug: thing', + `title: "Entry ${id}"`, + `status: ${status}`, + 'acceptance_criteria:', + ' - id: AC-000001', + ' ears: ubiquitous', + ` text: "${text}"`, + '', + ].join('\n'), + ); + } + + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-rev-')); + initRepo(dir); + mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); + specYaml(dir, 1); + entry('thing-aaa001.yaml', 'F-aaa001', 'planned', 'The system shall do the original thing.'); + commitAll(dir, 'baseline'); + git(dir, ['tag', 'v0']); + entry('thing-aaa001.yaml', 'F-aaa001', 'done', 'The system shall do the REVISED thing.'); + commitAll(dir, 'revise and finish'); + }); + + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + test('an uncommitted edit cannot hide a rewrite that IS in the range', () => { + const committed = collectSpecEntryRevisions(dir, 'v0'); + expect(committed[0]?.headAcs[0]?.text).toContain('REVISED'); + + // Revert the text in the working tree WITHOUT committing. The range still + // contains the rewrite, so the answer must not move. + entry('thing-aaa001.yaml', 'F-aaa001', 'done', 'The system shall do the original thing.'); + const dirty = collectSpecEntryRevisions(dir, 'v0'); + expect(dirty[0]?.headAcs[0]?.text, 'a dirty tree changed what the range says').toContain('REVISED'); + expect(JSON.stringify(dirty)).toBe(JSON.stringify(committed)); + }); + + test('an uncommitted edit cannot invent a rewrite the range never made', () => { + const committed = collectSpecEntryRevisions(dir, 'v0'); + entry('thing-aaa001.yaml', 'F-aaa001', 'done', 'The system shall do something ELSE entirely.'); + expect(JSON.stringify(collectSpecEntryRevisions(dir, 'v0'))).toBe(JSON.stringify(committed)); + }); + + test('an uncommitted status flip cannot manufacture a done transition', () => { + entry('thing-aaa001.yaml', 'F-aaa001', 'archived', 'The system shall do the REVISED thing.'); + expect(collectSpecEntryRevisions(dir, 'v0')[0]?.statusAfter).toBe('done'); + }); +}); diff --git a/tests/cli/clad.test.ts b/tests/cli/clad.test.ts index 2364cfc1..1891590e 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.2'); + expect(program.version()).toBe('0.9.3'); }); }); diff --git a/tests/init/agents-md.test.ts b/tests/init/agents-md.test.ts index eb545f17..ca97cd78 100644 --- a/tests/init/agents-md.test.ts +++ b/tests/init/agents-md.test.ts @@ -27,6 +27,8 @@ import { writeSpecDrivenAgentsMd, } from '../../src/init/agents-md.js'; import {loadSpec} from '../../src/spec/load.js'; +import {checkEarsShape} from '../../src/spec/ears.js'; +import type {EarsPattern} from '../../src/spec/types.js'; /** A spec.yaml with a fully-populated project.ai_hints, matching the shard's * own notes fixture (acme-payments) so assertions read naturally. */ @@ -318,3 +320,76 @@ describe('writeSpecDrivenAgentsMd — AC-1f8d7b02 (markerless / hand-authored fi expect(upsertAgentsMdBlock(malformed, 'fresh block')).toBe(malformed); }); }); + +describe('the managed block teaches EARS, and cannot drift from the validator', () => { + test('every example in the EARS table actually passes checkEarsShape', () => { + // The adopter receives no docs/ — package.json#files ships none — so this + // table is the only place an authoring agent can learn the rules. Two of + // three agents in an A/B run reverse-engineered them from the minified + // bundle instead. A table that drifts from the validator is worse than + // none, so it is checked against the validator rather than eyeballed. + const block = renderAgentsMdManagedBlock(null, '.'); + const rows = block + .split('\n') + .filter((l) => /^\| `(ubiquitous|event|state|optional|unwanted|complex)` \|/.test(l)); + expect(rows.length, 'the EARS table is missing from the managed block').toBe(6); + + for (const row of rows) { + const cells = row.split('|').map((c) => c.trim()); + const pattern = cells[1].replace(/`/g, '') as EarsPattern; + const example = cells[3].replace(/`/g, '').replace(/\*\(none\)\*/, '').trim(); + expect(checkEarsShape(pattern, example), `${pattern}: "${example}"`).toBeNull(); + } + }); + + test('the table covers every pattern the schema accepts', () => { + const block = renderAgentsMdManagedBlock(null, '.'); + for (const pattern of ['ubiquitous', 'event', 'state', 'optional', 'unwanted', 'complex']) { + expect(block, `${pattern} is missing from the EARS table`).toContain(`| \`${pattern}\` |`); + } + }); +}); + +describe('the managed block says what language a spec entry is written in', () => { + // No rule existed, so adopters diverged: two repositories reached ~100% + // Korean titles while two others stayed fully English. The rule lives here + // rather than in the CLAUDE.md block (21 characters of headroom against a + // pinned ceiling) or a persona prompt (3 characters, and it only reaches + // hosts that install the plugin). + const block = () => renderAgentsMdManagedBlock(null, '.'); + + test('it states the default, and that existing entries decide instead', () => { + expect(block()).toContain('Default to English'); + expect(block()).toMatch(/match the language THEY use/); + expect(block()).toMatch(/Where they disagree, write English/); + }); + + test('a language request covers the prose fields and carries forward on its own', () => { + const b = block(); + expect(b).toMatch(/asks for another language/); + for (const field of ['`title`', '`notes`', '`text`']) expect(b).toContain(field); + expect(b).toMatch(/carries forward/); + }); + + test('it forbids rewriting existing entries into another language', () => { + expect(block()).toMatch(/never rewrite existing ones/); + }); + + test('the four trigger words are named as fixed, and only the first word is constrained', () => { + const b = block(); + for (const w of ['when', 'while', 'if', 'where']) expect(b).toContain(`**${w}**`); + expect(b).toMatch(/Only the FIRST word/); + }); + + test('it shows a mixed condition, so "English trigger" is not read as "English sentence"', () => { + // The whole point of naming only four words: everything after them is free. + // A reader who cannot see that will over-translate or under-translate. + const example = block().split('\n').find((l) => l.includes('condition:') && /[가-힣]/.test(l)); + expect(example, 'no mixed-language condition example in the block').toBeDefined(); + expect(example).toMatch(/^\s*condition: "when /m); + }); + + test('identifiers are excluded from translation', () => { + expect(block()).toMatch(/Identifiers are not prose/); + }); +}); diff --git a/tests/report/ac-delta.test.ts b/tests/report/ac-delta.test.ts new file mode 100644 index 00000000..28d8e405 --- /dev/null +++ b/tests/report/ac-delta.test.ts @@ -0,0 +1,217 @@ +// Cladding · unit tests for src/report/ac-delta.ts (F-5dfbac9c) +// +// Written from the acceptance criteria, not the implementation body: synthetic +// revision pairs in, a classification out. +// - AC-c32cbab2 · new / rewritten / removed / unchanged, joined on criterion +// id; a differing text, EARS pattern, or condition is a +// rewrite; a whitespace-only difference is not +// - AC-4faef94d · rows ordered by criterion id, no wall-clock, byte-stable + +import {describe, expect, test} from 'vitest'; + +import type {SpecEntryRevision} from '../../src/changelog/collect.js'; +import {buildSpecEntryDeltas} from '../../src/report/ac-delta.js'; +import type {AcceptanceCriterion} from '../../src/spec/types.js'; + +function ac(id: string, over: Partial = {}): AcceptanceCriterion { + return {id, text: 'the system shall do the thing', ears: 'ubiquitous', ...over}; +} + +function entry( + baseAcs: readonly AcceptanceCriterion[], + headAcs: readonly AcceptanceCriterion[], + over: Partial = {}, +): SpecEntryRevision { + return { + path: 'spec/features/thing-abcd1234.yaml', + id: 'F-abcd1234', + title: 'A thing', + statusBefore: 'planned', + statusAfter: 'done', + baseAcs, + headAcs, + ...over, + }; +} + +/** One entry's delta from a base/head criterion pair — the common shape below. */ +function buildSpecDeltasFor( + baseAcs: readonly AcceptanceCriterion[], + headAcs: readonly AcceptanceCriterion[], +) { + return buildSpecEntryDeltas([entry(baseAcs, headAcs)]); +} + +/** The single row for `id`, asserted to exist. */ +function row(deltas: ReturnType, id: string) { + const found = deltas[0]?.rows.find((r) => r.id === id); + expect(found, `expected a row for ${id}`).toBeDefined(); + return found!; +} + +describe('AC-c32cbab2 · classifying how each criterion moved', () => { + test('a criterion absent at the base is new', () => { + const d = buildSpecEntryDeltas([entry([], [ac('AC-0001')])]); + expect(row(d, 'AC-0001').kind).toBe('new'); + expect(d[0]?.counts.new).toBe(1); + }); + + test('a criterion absent at HEAD is removed — a silent deletion still reports', () => { + const d = buildSpecEntryDeltas([entry([ac('AC-0001')], [])]); + expect(row(d, 'AC-0001').kind).toBe('removed'); + expect(d[0]?.counts.removed).toBe(1); + }); + + test('an identical criterion is unchanged', () => { + const d = buildSpecEntryDeltas([entry([ac('AC-0001')], [ac('AC-0001')])]); + expect(row(d, 'AC-0001').kind).toBe('unchanged'); + }); + + test('changed statement text is a rewrite', () => { + const d = buildSpecEntryDeltas([ + entry([ac('AC-0001', {text: 'shall always run the kill'})], [ac('AC-0001', {text: 'shall never run the kill'})]), + ]); + expect(row(d, 'AC-0001').kind).toBe('rewritten'); + }); + + test('changed trigger condition is a rewrite even when the text is identical', () => { + const d = buildSpecEntryDeltas([ + entry( + [ac('AC-0001', {ears: 'event', condition: 'when the app exits'})], + [ac('AC-0001', {ears: 'event', condition: 'when the device disconnects'})], + ), + ]); + expect(row(d, 'AC-0001').kind).toBe('rewritten'); + }); + + test('a changed EARS pattern is a rewrite and names the shift', () => { + const d = buildSpecEntryDeltas([ + entry([ac('AC-0001', {ears: 'state'})], [ac('AC-0001', {ears: 'unwanted'})]), + ]); + const r = row(d, 'AC-0001'); + expect(r.kind).toBe('rewritten'); + expect(r.earsShift).toBe('state → unwanted'); + }); + + test('an unshifted rewrite carries no pattern annotation', () => { + const d = buildSpecEntryDeltas([ + entry([ac('AC-0001', {text: 'one'})], [ac('AC-0001', {text: 'two'})]), + ]); + expect(row(d, 'AC-0001').earsShift).toBeUndefined(); + }); + + test('whitespace-only differences are not a rewrite — reflowing a line is not a contract change', () => { + const d = buildSpecEntryDeltas([ + entry( + [ac('AC-0001', {text: 'the system shall do\n the thing'})], + [ac('AC-0001', {text: 'the system shall do the thing'})], + ), + ]); + expect(row(d, 'AC-0001').kind).toBe('unchanged'); + }); + + test('a changed EARS action is a rewrite — it IS the obligation', () => { + // `action` renders to the impl-blind oracle as "system shall:", so rewriting + // it rewrites the requirement. 79% of this project's own criteria carry it, + // and a sibling corpus has criteria with NO `text` at all — there the whole + // obligation lives in these fields. + const d = buildSpecDeltasFor( + [ac('AC-0001', {text: undefined, ears: 'event', condition: 'when a file is uploaded', action: 'route it by filename extension'})], + [ac('AC-0001', {text: undefined, ears: 'event', condition: 'when a file is uploaded', action: 'route it by validated content'})], + ); + expect(row(d, 'AC-0001').kind).toBe('rewritten'); + }); + + test('a changed EARS response is a rewrite', () => { + const d = buildSpecDeltasFor( + [ac('AC-0001', {response: 'the upload is accepted'})], + [ac('AC-0001', {response: 'the upload is rejected'})], + ); + expect(row(d, 'AC-0001').kind).toBe('rewritten'); + }); + + test('an identical EARS-only criterion is still unchanged', () => { + const same = {text: undefined, ears: 'state' as const, condition: 'while idle', action: 'hold the latch', response: 'nothing spawns'}; + const d = buildSpecDeltasFor([ac('AC-0001', same)], [ac('AC-0001', same)]); + expect(row(d, 'AC-0001').kind).toBe('unchanged'); + }); + + test('an expanded rationale alone is not a rewrite — notes are outside the contract key', () => { + const d = buildSpecEntryDeltas([ + entry([ac('AC-0001', {notes: 'brief'})], [ac('AC-0001', {notes: 'a much longer WHY'})]), + ]); + expect(row(d, 'AC-0001').kind).toBe('unchanged'); + }); + + test('the id is the join key — a polarity flip under a held id reads as one rewrite, not add+remove', () => { + // The live reversal that motivated the feature: text flipped, pattern moved + // state → unwanted, id unchanged. + const d = buildSpecEntryDeltas([ + entry( + [ac('AC-d7eb3f', {ears: 'state', text: 'the system shall still run adb kill-server'})], + [ac('AC-d7eb3f', {ears: 'unwanted', text: 'the system shall never issue adb kill-server'})], + ), + ]); + expect(d[0]?.counts).toEqual({new: 0, rewritten: 1, removed: 0, unchanged: 0}); + }); + + test('a duplicated criterion id does not let the later occurrence hide a rewrite', () => { + // A duplicate is invalid and the strict gate says so — but `clad report` + // gates nothing, so it renders exactly in the window before green, where a + // first-wins join reported "unchanged" while the packet's own spec-changes + // section printed the new text. The packet must not contradict itself. + const d = buildSpecDeltasFor( + [ac('AC-0001', {text: 'first'}), ac('AC-0001', {text: 'second'})], + [ac('AC-0001', {text: 'first'}), ac('AC-0001', {text: 'second REWRITTEN'})], + ); + expect(d[0]?.counts.rewritten).toBe(1); + expect(d[0]?.counts.unchanged).toBe(1); + }); + + test('a surplus duplicate at head is new; a surplus at base is removed', () => { + const added = buildSpecDeltasFor([ac('AC-0001')], [ac('AC-0001'), ac('AC-0001')]); + expect(added[0]?.counts).toMatchObject({new: 1, unchanged: 1}); + const dropped = buildSpecDeltasFor([ac('AC-0001'), ac('AC-0001')], [ac('AC-0001')]); + expect(dropped[0]?.counts).toMatchObject({removed: 1, unchanged: 1}); + }); + + test('the status transition rides along with the delta', () => { + const d = buildSpecEntryDeltas([entry([], [], {statusBefore: 'planned', statusAfter: 'done'})]); + expect(d[0]?.statusBefore).toBe('planned'); + expect(d[0]?.statusAfter).toBe('done'); + }); + + test('an entry added within the range has a null base status', () => { + const d = buildSpecEntryDeltas([entry([], [ac('AC-0001')], {statusBefore: null})]); + expect(d[0]?.statusBefore).toBeNull(); + expect(row(d, 'AC-0001').kind).toBe('new'); + }); +}); + +describe('AC-4faef94d · deterministic ordering', () => { + test('rows sort by criterion id regardless of authored order', () => { + const d = buildSpecEntryDeltas([ + entry([], [ac('AC-zzzz'), ac('AC-aaaa'), ac('AC-mmmm')]), + ]); + expect(d[0]?.rows.map((r) => r.id)).toEqual(['AC-aaaa', 'AC-mmmm', 'AC-zzzz']); + }); + + test('entries sort by feature id', () => { + const d = buildSpecEntryDeltas([ + entry([], [], {id: 'F-cccc'}), + entry([], [], {id: 'F-aaaa'}), + ]); + expect(d.map((x) => x.id)).toEqual(['F-aaaa', 'F-cccc']); + }); + + test('two builds over the same input serialize byte-identically', () => { + const input = [entry([ac('AC-0002')], [ac('AC-0001'), ac('AC-0002', {text: 'moved'})])]; + expect(JSON.stringify(buildSpecEntryDeltas(input))).toBe( + JSON.stringify(buildSpecEntryDeltas(input)), + ); + }); + + test('an empty range yields an empty delta, not a throw', () => { + expect(buildSpecEntryDeltas([])).toEqual([]); + }); +}); diff --git a/tests/report/report-cli.test.ts b/tests/report/report-cli.test.ts index 0bccd59c..8cc2971a 100644 --- a/tests/report/report-cli.test.ts +++ b/tests/report/report-cli.test.ts @@ -5,7 +5,7 @@ // unowned file), because the CLI's contract is about what git + spec say. The // CLI is spawned as a subprocess so its real exit codes are observable // (runReportCommand calls process.exit on the error paths). -// - AC-cbf1c202 · four sections present; two runs byte-identical; exit 0 +// - AC-cbf1c202 · six sections present; two runs byte-identical; exit 0 // - AC-7672ce5d · the unowned file surfaces; the owned file never does // - AC-67fa1d25 · unresolvable --since → exit 2 naming the ref; valid → exit 0 // - unknown --format → exit 1 (pinned current behaviour) @@ -78,7 +78,9 @@ const SPEC_YAML = [ const SECTIONS = [ '## Spec changes', + '## How the acceptance criteria moved', '## Code changes → owning features', + '## Declared tests', '## Regression set', '## Gate & attestation', ] as const; @@ -116,7 +118,7 @@ describe('clad report — integration (F-f6cc5e5a)', () => { rmSync(dir, {recursive: true, force: true}); }); - test('AC-cbf1c202 · renders all four sections in order and exits 0', () => { + test('AC-cbf1c202 · renders all six sections in order and exits 0', () => { const run = runClad(dir, ['report', '--since', 'v0']); expect(run.status, run.stderr).toBe(0); const positions = SECTIONS.map((h) => run.stdout.indexOf(h)); @@ -180,3 +182,214 @@ describe('clad report — pipe safety (structural pin)', () => { expect(src).not.toContain('process.exit(0)'); }); }); + +describe('AC-1a6cb22f / AC-4b6fe145 / AC-8e748acb · anchoring the range on the fork point', () => { + let dir: string; + + function mkShard(id: string, slug: string, status: string, text: string): string { + return [ + `id: ${id}`, + `slug: ${slug}`, + `title: "${slug}"`, + `status: ${status}`, + 'acceptance_criteria:', + ' - id: AC-000001', + ' ears: ubiquitous', + ` text: "${text}"`, + '', + ].join('\n'); + } + + beforeAll(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-report-fork-')); + git(dir, ['init', '-q']); + git(dir, ['config', 'user.email', 'test@example.com']); + git(dir, ['config', 'user.name', 'test']); + git(dir, ['config', 'commit.gpgsign', 'false']); + git(dir, ['config', 'init.defaultBranch', 'main']); + git(dir, ['checkout', '-q', '-b', 'main']); + mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); + + writeFileSync(join(dir, 'spec.yaml'), SPEC_YAML); + writeFileSync( + join(dir, 'spec', 'features', 'mine-aaaa1111.yaml'), + mkShard('F-aaaa1111', 'mine', 'planned', 'The system shall do my thing.'), + ); + writeFileSync( + join(dir, 'spec', 'features', 'theirs-bbbb2222.yaml'), + mkShard('F-bbbb2222', 'theirs', 'planned', 'The system shall do their thing.'), + ); + git(dir, ['add', '-A']); + git(dir, ['commit', '-q', '-m', 'baseline']); + git(dir, ['tag', 'v0']); + + // The BASE branch moves on after the fork — someone else rewrites their + // own entry's criterion. This must never be charged to our branch. + writeFileSync( + join(dir, 'spec', 'features', 'theirs-bbbb2222.yaml'), + mkShard('F-bbbb2222', 'theirs', 'done', 'The system shall do their thing DIFFERENTLY.'), + ); + git(dir, ['add', '-A']); + git(dir, ['commit', '-q', '-m', 'their work on main']); + + // Our branch forks from v0 and rewrites only our own entry. + git(dir, ['checkout', '-q', '-b', 'feature/mine', 'v0']); + writeFileSync( + join(dir, 'spec', 'features', 'mine-aaaa1111.yaml'), + mkShard('F-aaaa1111', 'mine', 'done', 'The system shall do my thing REVISED.'), + ); + git(dir, ['add', '-A']); + git(dir, ['commit', '-q', '-m', 'my work']); + }); + + afterAll(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + test("AC-1a6cb22f · the base branch's own rewrite is not attributed to this range", () => { + const ran = runClad(dir, ['report', '--since', 'main', '--format', 'json']); + expect(ran.status).toBe(0); + const model = JSON.parse(ran.stdout) as { + specEntryDeltas: {id: string; counts: {rewritten: number}}[]; + }; + const ids = model.specEntryDeltas.map((d) => d.id); + expect(ids).toContain('F-aaaa1111'); + // Diffing tip-to-tip would report F-bbbb2222 as REMOVED-and-rewritten here; + // anchoring on the merge base leaves their work out of our packet. + expect(ids).not.toContain('F-bbbb2222'); + }); + + test('AC-1a6cb22f · our own rewrite is still reported', () => { + const ran = runClad(dir, ['report', '--since', 'main', '--format', 'json']); + const model = JSON.parse(ran.stdout) as { + specEntryDeltas: {id: string; counts: {rewritten: number}}[]; + }; + expect(model.specEntryDeltas.find((d) => d.id === 'F-aaaa1111')?.counts.rewritten).toBe(1); + }); + + test('AC-4b6fe145 · a shallow clone with no merge base still renders a packet', () => { + const shallow = mkdtempSync(join(tmpdir(), 'clad-report-shallow-')); + try { + execFileSync('git', ['clone', '-q', '--depth', '1', `file://${dir}`, shallow, '--branch', 'feature/mine'], { + encoding: 'utf8', + }); + const head = execFileSync('git', ['rev-parse', 'HEAD'], {cwd: shallow, encoding: 'utf8'}).trim(); + // No history to walk: `git merge-base HEAD` cannot resolve a fork + // point here, so the helper must fall back to the ref rather than fail. + const ran = runClad(shallow, ['report', '--since', head, '--format', 'md']); + expect(ran.status).toBe(0); + expect(ran.stdout).toContain('## How the acceptance criteria moved'); + } finally { + rmSync(shallow, {recursive: true, force: true}); + } + }); + + test('AC-8e748acb · a rewritten criterion does not change the exit code', () => { + const withRewrite = runClad(dir, ['report', '--since', 'v0']); + expect(withRewrite.status).toBe(0); + expect(withRewrite.stdout).toContain('REWRITTEN AC-000001'); + + // Same command from a state with no spec movement at all — same exit code. + const noMovement = runClad(dir, ['report', '--since', 'HEAD']); + expect(noMovement.status).toBe(0); + }); +}); + +describe('the packet names the revision it audited against', () => { + test('the json model carries the resolved base alongside the ref the user named', () => { + // Recorded on the fork-point fixture built above: `main` and the merge base + // are different commits there, so `since` alone does not identify the + // comparison. Both must be present for an auditor to reproduce it. + const forked = mkdtempSync(join(tmpdir(), 'clad-report-basestamp-')); + try { + git(forked, ['init', '-q']); + git(forked, ['config', 'user.email', 'test@example.com']); + git(forked, ['config', 'user.name', 'test']); + git(forked, ['config', 'commit.gpgsign', 'false']); + mkdirSync(join(forked, 'spec', 'features'), {recursive: true}); + writeFileSync(join(forked, 'spec.yaml'), SPEC_YAML); + writeFileSync(join(forked, 'spec', 'features', 'owned-feature-aaaa1111.yaml'), shard('in_progress')); + writeFileSync(join(forked, 'src.ts'), 'export const a = 1;\n'); + git(forked, ['add', '-A']); + git(forked, ['commit', '-q', '-m', 'baseline']); + git(forked, ['tag', 'v0']); + git(forked, ['branch', '-M', 'main']); + // main moves on; our branch forks from v0, so v0 !== the merge base of main and HEAD. + writeFileSync(join(forked, 'src.ts'), 'export const a = 2;\n'); + git(forked, ['add', '-A']); + git(forked, ['commit', '-q', '-m', 'their work']); + git(forked, ['checkout', '-q', '-b', 'mine', 'v0']); + writeFileSync(join(forked, 'src.ts'), 'export const a = 3;\n'); + git(forked, ['add', '-A']); + git(forked, ['commit', '-q', '-m', 'my work']); + + const ran = runClad(forked, ['report', '--since', 'main', '--format', 'json']); + expect(ran.status).toBe(0); + const model = JSON.parse(ran.stdout) as {since: string; base: string; head: string}; + expect(model.since).toBe('main'); + expect(model.base).toBeTruthy(); + expect(model.base).not.toBe(model.head); + // The stamped base is the fork point, not the tip of the ref that was named. + const mainTip = execFileSync('git', ['rev-parse', 'main'], {cwd: forked, encoding: 'utf8'}).trim(); + expect(model.base).not.toBe(mainTip); + } finally { + rmSync(forked, {recursive: true, force: true}); + } + }); +}); + +describe('the base disclosure appears only when the base is a different commit', () => { + test('a linear range says nothing — the named ref IS the merge base', () => { + const lin = mkdtempSync(join(tmpdir(), 'clad-report-linear-')); + try { + git(lin, ['init', '-q']); + git(lin, ['config', 'user.email', 'test@example.com']); + git(lin, ['config', 'user.name', 'test']); + git(lin, ['config', 'commit.gpgsign', 'false']); + mkdirSync(join(lin, 'spec', 'features'), {recursive: true}); + writeFileSync(join(lin, 'spec.yaml'), SPEC_YAML); + writeFileSync(join(lin, 'spec', 'features', 'owned-feature-aaaa1111.yaml'), shard('in_progress')); + writeFileSync(join(lin, 'src.ts'), 'export const a = 1;\n'); + git(lin, ['add', '-A']); + git(lin, ['commit', '-q', '-m', 'baseline']); + git(lin, ['tag', 'v0']); + writeFileSync(join(lin, 'src.ts'), 'export const a = 2;\n'); + git(lin, ['add', '-A']); + git(lin, ['commit', '-q', '-m', 'work']); + + const ran = runClad(lin, ['report', '--since', 'v0']); + expect(ran.status).toBe(0); + // Before this was decided by comparing a ref name to a sha, it fired here. + expect(ran.stdout).not.toContain('Compared against'); + } finally { + rmSync(lin, {recursive: true, force: true}); + } + }); + + test('an ANNOTATED tag on the merge base is also silent — the ref is peeled, not string-compared', () => { + const ann = mkdtempSync(join(tmpdir(), 'clad-report-annotated-')); + try { + git(ann, ['init', '-q']); + git(ann, ['config', 'user.email', 'test@example.com']); + git(ann, ['config', 'user.name', 'test']); + git(ann, ['config', 'commit.gpgsign', 'false']); + mkdirSync(join(ann, 'spec', 'features'), {recursive: true}); + writeFileSync(join(ann, 'spec.yaml'), SPEC_YAML); + writeFileSync(join(ann, 'spec', 'features', 'owned-feature-aaaa1111.yaml'), shard('in_progress')); + writeFileSync(join(ann, 'src.ts'), 'export const a = 1;\n'); + git(ann, ['add', '-A']); + git(ann, ['commit', '-q', '-m', 'baseline']); + // An annotated tag object is NOT the commit it points at. + git(ann, ['tag', '-a', 'v1', '-m', 'release one']); + writeFileSync(join(ann, 'src.ts'), 'export const a = 2;\n'); + git(ann, ['add', '-A']); + git(ann, ['commit', '-q', '-m', 'work']); + + const ran = runClad(ann, ['report', '--since', 'v1']); + expect(ran.status).toBe(0); + expect(ran.stdout).not.toContain('Compared against'); + } finally { + rmSync(ann, {recursive: true, force: true}); + } + }); +}); diff --git a/tests/report/report.test.ts b/tests/report/report.test.ts index 59959ca8..2a762991 100644 --- a/tests/report/report.test.ts +++ b/tests/report/report.test.ts @@ -2,7 +2,7 @@ // // Pure-level contract of the review-packet renderer. Written from the ACs, not // the implementation body — a synthetic model in, deterministic markdown out. -// - AC-cbf1c202 · four ## sections in order, byte-identical across two renders +// - AC-cbf1c202 · six ## sections in order, byte-identical across two renders // - AC-cbf1c202 · buildReportModel folds inputs → sorted/deduped model // - AC-7672ce5d · unowned files surface under a section, owned never do, // empty unowned → no section (pinned current behaviour) @@ -10,7 +10,7 @@ import {describe, expect, test} from 'vitest'; -import type {ChangelogManifest} from '../../src/changelog/collect.js'; +import type {ChangelogManifest, SpecEntryRevision} from '../../src/changelog/collect.js'; import { buildReportModel, renderReportMarkdown, @@ -46,10 +46,12 @@ const NO_GATE: GateStateInput = {attestedCount: null, lastGateRun: null}; const META: ReportMeta = {sinceRef: 'v0', head: 'deadbeefcafe0000000000000000000000000000'}; -/** The four mandated section headers, in the order the packet must present them. */ +/** The six mandated section headers, in the order the packet must present them. */ const SECTIONS = [ '## Spec changes', + '## How the acceptance criteria moved', '## Code changes → owning features', + '## Declared tests', '## Regression set', '## Gate & attestation', ] as const; @@ -122,8 +124,8 @@ describe('report/report — buildReportModel (AC-cbf1c202)', () => { }); }); -describe('report/report — renderReportMarkdown four sections + determinism (AC-cbf1c202)', () => { - test('emits the four mandated sections in order', () => { +describe('report/report — renderReportMarkdown six sections + determinism (AC-cbf1c202)', () => { + test('emits the six mandated sections in order', () => { const model = buildReportModel( mkInputs({ codeChanges: [ @@ -162,6 +164,32 @@ describe('report/report — renderReportMarkdown four sections + determinism (AC const md = renderReportMarkdown(buildReportModel(mkInputs()), META); expect(md).toContain('# Review packet — v0..deadbeefcafe'); }); + + test('names the revision actually compared against when it differs from the named ref', () => { + // The packet anchors on the merge base, which on a branch that forked + // earlier is NOT the tag the reader named. An audit artifact that does not + // say what it audited against cannot be reproduced by hand. + const md = renderReportMarkdown(buildReportModel(mkInputs()), { + ...META, + baseSha: 'abc123def4560000000000000000000000000000', + }); + expect(md).toContain('Compared against abc123def456'); + expect(md).toContain('the merge base of v0 and HEAD'); + }); + + test('renders whenever a base is supplied — the CLI, not the renderer, decides', () => { + // A ref NAME and a sha are different kinds of thing; only git can say + // whether they denote the same commit (an annotated tag is not its own + // commit). Comparing them here announced a difference on every linear + // range, so the decision moved to the layer that can resolve refs. + const md = renderReportMarkdown(buildReportModel(mkInputs()), {...META, baseSha: 'abc123def4560000000000000000000000000000'}); + expect(md).toContain('Compared against abc123def456'); + }); + + test('an absent base sha renders as before — the field is additive', () => { + const without = renderReportMarkdown(buildReportModel(mkInputs()), META); + expect(without).not.toContain('Compared against'); + }); }); describe('report/report — unowned surfacing (AC-7672ce5d)', () => { @@ -217,3 +245,158 @@ describe('report/report — blank-ledger disclosure (AC-41572299)', () => { expect(md).not.toContain('dependency ledger is empty'); }); }); + +describe('AC-e68c868a · declared tests and whether they moved with the code', () => { + /** One touched entry whose single criterion declares `refs`. */ + function entryDeclaring(refs: readonly string[]): SpecEntryRevision { + return { + path: 'spec/features/thing-abcd1234.yaml', + id: 'F-abcd1234', + title: 'A thing', + statusBefore: 'planned', + statusAfter: 'done', + baseAcs: [], + headAcs: [{id: 'AC-0001', text: 'shall do the thing', test_refs: refs}], + }; + } + + function statesFor(refs: readonly string[], changed: readonly string[]) { + const model = buildReportModel( + mkInputs({specEntries: [entryDeclaring(refs)], changedPaths: changed}), + ); + return model.testRefRows.map((r) => r.state); + } + + test('a declared test that also changed in the range reads as co-changed', () => { + expect(statesFor(['tests/thing.test.ts'], ['tests/thing.test.ts'])).toEqual(['co-changed']); + }); + + test('a declared test that did not change reads as unchanged', () => { + expect(statesFor(['tests/thing.test.ts'], ['src/thing.ts'])).toEqual(['unchanged']); + }); + + test('an anchored reference resolves on its file path, not the whole string', () => { + expect(statesFor(['tests/thing.test.ts#some case'], ['tests/thing.test.ts'])).toEqual([ + 'co-changed', + ]); + }); + + test('a declared test with no file on disk is not passed off as an untouched test', () => { + // Every sibling existence check is done-only, so this status-blind section + // is the only surface that speaks for planned/in_progress entries — and + // "unchanged" there reads as "a real test that simply did not move". + const model = buildReportModel( + mkInputs({ + specEntries: [entryDeclaring(['tests/gone.test.ts'])], + changedPaths: [], + missingTestRefs: ['tests/gone.test.ts'], + }), + ); + expect(model.testRefRows.map((r) => r.state)).toEqual(['missing']); + }); + + test('a missing file wins over co-change — a path that cannot exist did not move', () => { + const model = buildReportModel( + mkInputs({ + specEntries: [entryDeclaring(['tests/gone.test.ts'])], + changedPaths: ['tests/gone.test.ts'], + missingTestRefs: ['tests/gone.test.ts'], + }), + ); + expect(model.testRefRows[0]?.state).toBe('missing'); + }); + + test('a harness-written placeholder is never reported as an untouched test', () => { + // `clad sync` writes `derived:` refs as unconfirmed suggestions. Rendering + // one as "declared but did not change" would pass a harness guess off as a + // reviewed fact. + for (const pseudo of ['derived:tests/thing.test.ts', 'fixture:NAME', 'script:build', 'self-dogfood:x']) { + expect(statesFor([pseudo], [])).toEqual(['placeholder']); + } + }); + + test('the row keeps the reference exactly as authored, anchor included', () => { + const model = buildReportModel( + mkInputs({specEntries: [entryDeclaring(['tests/thing.test.ts#some case'])], changedPaths: []}), + ); + expect(model.testRefRows[0]?.ref).toBe('tests/thing.test.ts#some case'); + expect(model.testRefRows[0]?.acId).toBe('AC-0001'); + expect(model.testRefRows[0]?.featureId).toBe('F-abcd1234'); + }); + + test('rows sort by feature, then criterion, then reference', () => { + const model = buildReportModel( + mkInputs({specEntries: [entryDeclaring(['tests/z.test.ts', 'tests/a.test.ts'])], changedPaths: []}), + ); + expect(model.testRefRows.map((r) => r.ref)).toEqual(['tests/a.test.ts', 'tests/z.test.ts']); + }); + + test('the section renders and states which files moved', () => { + const md = renderReportMarkdown( + buildReportModel( + mkInputs({specEntries: [entryDeclaring(['tests/thing.test.ts'])], changedPaths: ['tests/thing.test.ts']}), + ), + META, + ); + expect(md).toContain('## Declared tests'); + expect(md).toContain('tests/thing.test.ts'); + }); + + test('a range with no touched entry says so rather than rendering an empty list', () => { + const md = renderReportMarkdown(buildReportModel(mkInputs()), META); + expect(md).toContain('No touched entry declares a test.'); + }); + + test('the packet grades nothing — a production path declared as a test gets the same states as any other', () => { + // Whether a declared test genuinely verifies its criterion is not + // mechanically decidable, so the packet reports movement and withholds + // judgement. A criterion pointing at production source must therefore be + // described exactly like one pointing at a test file. + const model = buildReportModel( + mkInputs({specEntries: [entryDeclaring(['src/thing.ts'])], changedPaths: []}), + ); + expect(model.testRefRows.map((r) => r.state)).toEqual(['unchanged']); + + const md = renderReportMarkdown(model, META); + const section = md.slice(md.indexOf('## Declared tests')); + for (const verdict of ['circular', 'vacuous', 'invalid', 'FAIL', 'suspect']) { + expect(section).not.toContain(verdict); + } + }); +}); + +describe('AC-c32cbab2 · the criterion-movement section in the rendered packet', () => { + test('the section names the status transition and every non-unchanged criterion', () => { + const md = renderReportMarkdown( + buildReportModel( + mkInputs({ + specEntries: [ + { + path: 'spec/features/thing-abcd1234.yaml', + id: 'F-abcd1234', + title: 'A thing', + statusBefore: 'planned', + statusAfter: 'done', + baseAcs: [{id: 'AC-0001', text: 'shall always', ears: 'state'}], + headAcs: [ + {id: 'AC-0001', text: 'shall never', ears: 'unwanted'}, + {id: 'AC-0002', text: 'a fresh one'}, + ], + }, + ], + }), + ), + META, + ); + expect(md).toContain('## How the acceptance criteria moved'); + expect(md).toContain('planned → done'); + expect(md).toContain('REWRITTEN AC-0001'); + expect(md).toContain('state → unwanted'); + expect(md).toContain('NEW AC-0002'); + }); + + test('a range that moved no spec entry says so', () => { + const md = renderReportMarkdown(buildReportModel(mkInputs()), META); + expect(md).toContain('No feature spec entry changed in this range.'); + }); +}); diff --git a/tests/stages/toolchain.test.ts b/tests/stages/toolchain.test.ts index 59fecb89..d302d1f6 100644 --- a/tests/stages/toolchain.test.ts +++ b/tests/stages/toolchain.test.ts @@ -277,7 +277,236 @@ describe('detectToolchain', () => { test('typescript arch gate scans ts,tsx,js,jsx extensions', () => { writeFileSync(join(dir, 'package.json'), '{}'); - expect(detectToolchain(dir).gates.arch).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'madge', '--circular', '--extensions', 'ts,tsx,js,jsx', '.']}); + expect(detectToolchain(dir).gates.arch).toEqual({ + cmd: 'npx', + args: [ + '--offline', '--no-install', 'madge', '--circular', + '--extensions', 'ts,tsx,js,jsx', + '--exclude', '(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/', + '.', + ], + }); + }); + + // ─── Architecture gate scans source, not build output (F-2c02991f) ─── + + /** The exclusion the arch gate carries, read back off the composed gate. */ + function archExclude(cwd: string): string | undefined { + const args = detectToolchain(cwd).gates.arch?.args ?? []; + const i = args.indexOf('--exclude'); + return i >= 0 ? args[i + 1] : undefined; + } + + test('AC-caa9471d · build output is excluded from the circular-dependency scan', () => { + writeFileSync(join(dir, 'package.json'), '{}'); + const pattern = archExclude(dir); + expect(pattern).toBeDefined(); + const re = new RegExp(pattern!); + // A bundler's output legitimately contains mutual imports; scanning it + // reported cycles that exist in no hand-written file. + for (const generated of [ + 'dist/index.js', 'build/main.js', 'out/app.js', 'coverage/lcov-report/x.js', + 'target/classes/a.js', '.next/server/page.js', '.nuxt/dist/client.js', + '.output/server/index.mjs', '.svelte-kit/output/x.js', '.vite/deps/chunk.js', + // A monorepo or a front-end subdirectory puts its bundle one level down. + // Anchoring only at depth 0 left those blocking the gate — the exact + // shape the motivating adopter has (`frontend/dist`). + 'frontend/dist/index.js', 'packages/ui/dist/bundle.js', 'apps/web/.next/x.js', + 'packages/core/coverage/lcov-report/y.js', 'plugins/host/dist/bundle.js', + ]) { + expect(re.test(generated), `${generated} should be excluded`).toBe(true); + } + }); + + test('AC-dd5c3abf · hand-written source stays in scan, so a real cycle is still reported', () => { + writeFileSync(join(dir, 'package.json'), '{}'); + const re = new RegExp(archExclude(dir)!); + for (const source of [ + 'src/index.ts', 'tests/unit.test.ts', 'lib/util.ts', 'app/page.tsx', + 'packages/core/src/a.ts', 'backend/api/main.ts', + // `build`, `out` and `target` are ambiguous — they name real source + // directories often enough that they stay anchored at the repository + // root. (`dist`, `coverage` and the framework caches are not ambiguous: + // no repository on hand commits hand-written source under any of them.) + 'src/build/compile.ts', 'packages/out/index.ts', 'app/target/gen.ts', + ]) { + expect(re.test(source), `${source} must NOT be excluded`).toBe(false); + } + }); + + test('AC-554d9436 · a project that configures the scanner itself keeps its own rules', () => { + // madge REPLACES its configured excludeRegExp with the command-line flag + // rather than merging, so passing ours would silently delete theirs. + const own = mkdtempSync(join(tmpdir(), 'clad-madge-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + writeFileSync(join(own, '.madgerc'), '{"excludeRegExp": ["^vendor/"]}'); + expect(detectToolchain(own).gates.arch?.args).not.toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + }); + + test('AC-554d9436 · an inline package.json madge block also wins', () => { + writeFileSync(join(dir, 'package.json'), JSON.stringify({madge: {excludeRegExp: ['^vendor/']}})); + expect(detectToolchain(dir).gates.arch?.args).not.toContain('--exclude'); + }); + + test('AC-554d9436 · a .madgerc in a PARENT directory is honoured — madge walks up, so must we', () => { + // The config loader recurses from cwd to the filesystem root. A guard that + // looks only in cwd sends --exclude anyway, madge REPLACES the parent's + // rules with ours, and cycles the user had suppressed come back RED. + const parent = mkdtempSync(join(tmpdir(), 'clad-madge-parent-')); + try { + writeFileSync(join(parent, '.madgerc'), '{"excludeRegExp": ["^vendor/"]}'); + const child = join(parent, 'workspace', 'app'); + mkdirSync(child, {recursive: true}); + writeFileSync(join(child, 'package.json'), '{}'); + expect(detectToolchain(child).gates.arch?.args).not.toContain('--exclude'); + } finally { + rmSync(parent, {recursive: true, force: true}); + } + }); + + test('AC-554d9436 · a .madgerc under $HOME is honoured too', () => { + const fakeHome = mkdtempSync(join(tmpdir(), 'clad-madge-home-')); + const realHome = process.env.HOME; + const realProfile = process.env.USERPROFILE; + try { + writeFileSync(join(fakeHome, '.madgerc'), '{"excludeRegExp": ["^vendor/"]}'); + process.env.HOME = fakeHome; + process.env.USERPROFILE = fakeHome; + const own = mkdtempSync(join(tmpdir(), 'clad-madge-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + expect(detectToolchain(own).gates.arch?.args).not.toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + } finally { + if (realHome === undefined) delete process.env.HOME; else process.env.HOME = realHome; + if (realProfile === undefined) delete process.env.USERPROFILE; else process.env.USERPROFILE = realProfile; + rmSync(fakeHome, {recursive: true, force: true}); + } + }); + + test('AC-caa9471d · a config file that puts NO exclusion in force does not switch the fix off', () => { + // The question is not "does a file exist" but "would madge apply an + // exclusion". Every row below exists and sets nothing, so cladding must + // still supply its own — otherwise build-output cycles keep the gate RED + // while cladding believes the project has it covered. + for (const [label, body] of [ + ['empty file', ''], + ['whitespace only', ' \n\t\n'], + ['comment-bearing jsonc', '// no exclusions here\n{}\n'], + ['unparseable garbage', 'not json and not ini {{{'], + ['INI without excludeRegExp', 'detectiveOptions[ts][skipTypeImports] = true\n'], + ['excludeRegExp: []', '{"excludeRegExp": []}'], + ['excludeRegExp: null', '{"excludeRegExp": null}'], + ['excludeRegExp empty string', '{"excludeRegExp": ""}'], + ['excludeRegExp: false', '{"excludeRegExp": false}'], + ] as [string, string][]) { + const own = mkdtempSync(join(tmpdir(), 'clad-madge-vacuous-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + writeFileSync(join(own, '.madgerc'), body); + expect(detectToolchain(own).gates.arch?.args, label).toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + } + }); + + test('AC-554d9436 · a config that DOES set an exclusion still makes cladding stand down', () => { + for (const [label, body] of [ + ['JSON array', '{"excludeRegExp": ["^vendor/"]}'], + ['JSON string', '{"excludeRegExp": "^vendor/"}'], + ['INI array form', 'excludeRegExp[] = ^vendor/\n'], + ['INI scalar form', 'excludeRegExp = ^vendor/\n'], + ] as [string, string][]) { + const own = mkdtempSync(join(tmpdir(), 'clad-madge-inforce-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + writeFileSync(join(own, '.madgerc'), body); + expect(detectToolchain(own).gates.arch?.args, label).not.toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + } + }); + + test('AC-554d9436 · an environment-set exclusion is honoured — it has no file behind it', () => { + // rc folds any madge_* variable into the config, so this is a live rule. + // Missing it is the damaging direction: cladding would send --exclude, + // which REPLACES rather than merges, and the rule would vanish. + const own = mkdtempSync(join(tmpdir(), 'clad-madge-env-')); + const saved = process.env.madge_excludeRegExp; + try { + writeFileSync(join(own, 'package.json'), '{}'); + process.env.madge_excludeRegExp = '^vendor/'; + expect(detectToolchain(own).gates.arch?.args).not.toContain('--exclude'); + } finally { + if (saved === undefined) delete process.env.madge_excludeRegExp; + else process.env.madge_excludeRegExp = saved; + rmSync(own, {recursive: true, force: true}); + } + }); + + test('AC-554d9436 · a BOM in package.json does not hide its madge block', () => { + // madge reads it with require(), which tolerates a BOM; JSON.parse does not. + const own = mkdtempSync(join(tmpdir(), 'clad-madge-bom-')); + try { + writeFileSync(join(own, 'package.json'), '\uFEFF' + JSON.stringify({madge: {excludeRegExp: ['^vendor/']}})); + expect(detectToolchain(own).gates.arch?.args).not.toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + }); + + test('AC-caa9471d · a .madgerc that is a DIRECTORY carries no config', () => { + // rc's walk stops at it and reads nothing, so our default must still apply. + const own = mkdtempSync(join(tmpdir(), 'clad-madge-dir-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + mkdirSync(join(own, '.madgerc')); + expect(detectToolchain(own).gates.arch?.args).toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + }); + + test('AC-caa9471d · legacy: non-madge filenames and empty package blocks still do not switch it off', () => { + // These all EXIST but put no excludeRegExp in force, so build output would + // keep blocking the gate while cladding believed the project had it covered. + for (const [label, write] of [ + ['empty .madgerc', (d: string) => writeFileSync(join(d, '.madgerc'), '{}')], + ['detectiveOptions-only .madgerc', (d: string) => writeFileSync(join(d, '.madgerc'), '{"detectiveOptions": {"ts": {"skipTypeImports": true}}}')], + // Not config files at all — the loader reads only the exact name `.madgerc`. + ['.madgerc.json', (d: string) => writeFileSync(join(d, '.madgerc.json'), '{"excludeRegExp": ["^vendor/"]}')], + ['.madgerc.yaml', (d: string) => writeFileSync(join(d, '.madgerc.yaml'), 'excludeRegExp: ["^vendor/"]')], + ['package.json madge block without excludeRegExp', (d: string) => writeFileSync(join(d, 'package.json'), JSON.stringify({madge: {detectiveOptions: {}}}))], + ] as [string, (d: string) => void][]) { + const own = mkdtempSync(join(tmpdir(), 'clad-madge-inert-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + write(own); + expect(detectToolchain(own).gates.arch?.args, label).toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + } + }); + + + test('AC-c04171bd · the scan root stays the repository root, never a named directory', () => { + // Narrowing the root is worse than the defect: a missing directory makes + // madge exit ENOENT, which classifies as a scanner setup gap and skips the + // whole stage — a green gate that checked nothing. + writeFileSync(join(dir, 'package.json'), '{}'); + const args = detectToolchain(dir).gates.arch?.args ?? []; + expect(args.at(-1)).toBe('.'); + expect(args).not.toContain('src'); + expect(args.filter((a) => a === '.')).toHaveLength(1); }); // ─── Swift (SPM) + Flutter/Dart toolchain (F-e4159959) ─── diff --git a/tests/stages/util.test.ts b/tests/stages/util.test.ts index c957a48f..9623d657 100644 --- a/tests/stages/util.test.ts +++ b/tests/stages/util.test.ts @@ -52,9 +52,22 @@ describe('ranToolResult — ran-tool exit code → stage contract', () => { expect(r.stderr).toContain('TS2322'); // tsc writes to stdout; gate must still show WHY }); - test('stderr wins over stdout when both present', () => { + test('BOTH streams survive, report first — neither displaces the other', () => { + // Previously stderr won outright, which discarded madge's cycle list + // (stdout) in favour of its progress line (stderr) and left the developer + // unable to see WHICH files formed the loop. const r = ranToolResult('stage_x', {exitCode: 1, stdout: 'out', stderr: 'err'}); - expect(r.stderr).toBe('err'); + expect(r.stderr).toBe('out\nerr'); + }); + + test("a scanner's report is not lost behind its progress line", () => { + const r = ranToolResult('stage_1.5', { + exitCode: 1, + stderr: '- Finding files\n✖ Found 2 circular dependencies!', + stdout: 'Processed 9 files (203ms)\n\n1) src/a.ts > src/b.ts\n2) src/c.ts > src/d.ts', + }); + expect(r.stderr).toContain('src/a.ts > src/b.ts'); + expect(r.stderr).toContain('src/c.ts > src/d.ts'); }); test('fail with no output → no stderr field', () => { @@ -152,6 +165,41 @@ describe('classifyScannerExit — finding vs config/setup gap', () => { expect(out[0].severity).toBe('info'); }); + test('the scanner REPORT survives — a progress line on stderr must not displace it', () => { + // madge writes its progress to stderr and its cycle list to stdout. Taking + // stderr first left the developer with "- Finding files" and no idea WHICH + // files form the loop — the whole reason a real adopter spent sixteen days + // on it and recorded the wrong cause. + const out = classifyScannerExit( + { + exitCode: 1, + stderr: '- Finding files\nProcessed 209 files (970ms)', + stdout: '✖ Found 2 circular dependencies!\n1) src/a.ts > src/b.ts\n2) src/c.ts > src/d.ts', + }, + 'ARCHITECTURE_VIOLATION', found, skipped, + ); + expect(out[0].severity).toBe('error'); + expect(out[0].message).toContain('src/a.ts > src/b.ts'); + expect(out[0].message).toContain('src/c.ts > src/d.ts'); + }); + + test('a long report is not cut off after the first cycle or two', () => { + const cycles = Array.from({length: 12}, (_, i) => `${i + 1}) src/very/deeply/nested/module-${i}.ts > src/other/deeply/nested/partner-${i}.ts`); + const out = classifyScannerExit( + {exitCode: 1, stdout: `✖ Found 12 circular dependencies!\n${cycles.join('\n')}`}, + 'ARCHITECTURE_VIOLATION', found, skipped, + ); + expect(out[0].message).toContain('module-11.ts'); + }); + + test('stderr still carries the detail when the scanner says nothing on stdout', () => { + const out = classifyScannerExit( + {exitCode: 1, stderr: 'eslint: Unexpected token in src/x.ts'}, + 'LINT', found, skipped, + ); + expect(out[0].message).toContain('Unexpected token in src/x.ts'); + }); + test('a REAL finding (no setup-error pattern) → ERROR (blocks the gate)', () => { const out = classifyScannerExit( {exitCode: 1, stdout: 'src/leak.ts:1:1 found AWS secret AKIAIOSFODNN7EXAMPLE'},